summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/navigation_interception/intercept_navigation_throttle_unittest.cc4
-rw-r--r--content/browser/frame_host/navigation_handle_impl.cc27
-rw-r--r--content/browser/frame_host/navigation_handle_impl.h17
-rw-r--r--content/browser/frame_host/navigation_request.cc4
-rw-r--r--content/browser/frame_host/navigation_request.h2
-rw-r--r--content/browser/frame_host/navigator_impl.cc8
-rw-r--r--content/browser/frame_host/render_frame_host_impl.cc3
-rw-r--r--content/public/browser/navigation_handle.cc9
-rw-r--r--content/public/browser/navigation_handle.h3
9 files changed, 38 insertions, 39 deletions
diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
index 15e05ef..7c95a53 100644
--- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc
+++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
@@ -60,7 +60,7 @@ class InterceptNavigationThrottleTest
SimulateWillStart(const GURL& url, const GURL& sanitized_url, bool is_post) {
scoped_ptr<content::NavigationHandle> test_handle =
content::NavigationHandle::CreateNavigationHandleForTesting(
- url, true, web_contents());
+ url, main_rfh());
test_handle->RegisterThrottleForTesting(
scoped_ptr<NavigationThrottle>(
new InterceptNavigationThrottle(
@@ -76,7 +76,7 @@ class InterceptNavigationThrottleTest
NavigationThrottle::ThrottleCheckResult Simulate302() {
scoped_ptr<content::NavigationHandle> test_handle =
content::NavigationHandle::CreateNavigationHandleForTesting(
- GURL(kTestUrl), true, web_contents());
+ GURL(kTestUrl), main_rfh());
test_handle->RegisterThrottleForTesting(
scoped_ptr<NavigationThrottle>(
new InterceptNavigationThrottle(
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 18a2fcd..786d70a 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -4,6 +4,8 @@
#include "content/browser/frame_host/navigation_handle_impl.h"
+#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/navigator_delegate.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
@@ -14,17 +16,14 @@ namespace content {
// static
scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
const GURL& url,
- bool is_main_frame,
- NavigatorDelegate* delegate) {
+ FrameTreeNode* frame_tree_node) {
return scoped_ptr<NavigationHandleImpl>(
- new NavigationHandleImpl(url, is_main_frame, delegate));
+ new NavigationHandleImpl(url, frame_tree_node));
}
NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
- const bool is_main_frame,
- NavigatorDelegate* delegate)
+ FrameTreeNode* frame_tree_node)
: url_(url),
- is_main_frame_(is_main_frame),
is_post_(false),
has_user_gesture_(false),
transition_(ui::PAGE_TRANSITION_LINK),
@@ -34,12 +33,16 @@ NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
is_same_page_(false),
state_(INITIAL),
is_transferring_(false),
- delegate_(delegate) {
- delegate_->DidStartNavigation(this);
+ frame_tree_node_(frame_tree_node) {
+ GetDelegate()->DidStartNavigation(this);
}
NavigationHandleImpl::~NavigationHandleImpl() {
- delegate_->DidFinishNavigation(this);
+ GetDelegate()->DidFinishNavigation(this);
+}
+
+NavigatorDelegate* NavigationHandleImpl::GetDelegate() const {
+ return frame_tree_node_->navigator()->GetDelegate();
}
const GURL& NavigationHandleImpl::GetURL() {
@@ -47,7 +50,7 @@ const GURL& NavigationHandleImpl::GetURL() {
}
bool NavigationHandleImpl::IsInMainFrame() {
- return is_main_frame_;
+ return frame_tree_node_->IsMainFrame();
}
bool NavigationHandleImpl::IsPost() {
@@ -193,7 +196,7 @@ NavigationHandleImpl::WillRedirectRequest(const GURL& new_url,
void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) {
url_ = new_url;
- delegate_->DidRedirectNavigation(this);
+ GetDelegate()->DidRedirectNavigation(this);
}
void NavigationHandleImpl::ReadyToCommitNavigation(
@@ -201,7 +204,7 @@ void NavigationHandleImpl::ReadyToCommitNavigation(
CHECK(!render_frame_host_);
render_frame_host_ = render_frame_host;
state_ = READY_TO_COMMIT;
- delegate_->ReadyToCommitNavigation(this);
+ GetDelegate()->ReadyToCommitNavigation(this);
}
void NavigationHandleImpl::DidCommitNavigation(
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h
index edd7b55..0fdb07d9 100644
--- a/content/browser/frame_host/navigation_handle_impl.h
+++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -55,9 +55,9 @@ struct NavigationRequestInfo;
// the RenderFrameHost still apply.
class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
public:
- static scoped_ptr<NavigationHandleImpl> Create(const GURL& url,
- bool is_main_frame,
- NavigatorDelegate* delegate);
+ static scoped_ptr<NavigationHandleImpl> Create(
+ const GURL& url,
+ FrameTreeNode* frame_tree_node);
~NavigationHandleImpl() override;
// NavigationHandle implementation:
@@ -87,7 +87,7 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
const GURL& new_referrer_url,
bool new_is_external_protocol) override;
- NavigatorDelegate* delegate() const { return delegate_; }
+ NavigatorDelegate* GetDelegate() const;
void set_net_error_code(net::Error net_error_code) {
net_error_code_ = net_error_code;
@@ -142,12 +142,10 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
};
NavigationHandleImpl(const GURL& url,
- const bool is_main_frame,
- NavigatorDelegate* delegate);
+ FrameTreeNode* frame_tree_node);
// See NavigationHandle for a description of those member variables.
GURL url_;
- const bool is_main_frame_;
bool is_post_;
Referrer sanitized_referrer_;
bool has_user_gesture_;
@@ -164,9 +162,8 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// the DidStartProvisionalLoad is received from the new renderer.
bool is_transferring_;
- // The delegate that should be notified about events related to this
- // navigation.
- NavigatorDelegate* delegate_;
+ // The FrameTreeNode this navigation is happening in.
+ FrameTreeNode* frame_tree_node_;
// A list of Throttles registered for this navigation.
ScopedVector<NavigationThrottle> throttles_;
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 2c784a3..1180edf 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -211,9 +211,9 @@ bool NavigationRequest::BeginNavigation() {
// DidStartProvisionalLoadForFrame for the navigation.
}
-void NavigationRequest::CreateNavigationHandle(NavigatorDelegate* delegate) {
+void NavigationRequest::CreateNavigationHandle() {
navigation_handle_ = NavigationHandleImpl::Create(
- common_params_.url, frame_tree_node_->IsMainFrame(), delegate);
+ common_params_.url, frame_tree_node_);
}
void NavigationRequest::TransferNavigationHandleOwnership(
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h
index b711278..5d3bf110 100644
--- a/content/browser/frame_host/navigation_request.h
+++ b/content/browser/frame_host/navigation_request.h
@@ -128,7 +128,7 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate {
// Creates a NavigationHandle. This should be called after any previous
// NavigationRequest for the FrameTreeNode has been destroyed.
- void CreateNavigationHandle(NavigatorDelegate* delegate);
+ void CreateNavigationHandle();
// Transfers the ownership of the NavigationHandle to |render_frame_host|.
// This should be called when the navigation is ready to commit, because the
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 0759ebf..398beab 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -158,8 +158,8 @@ void NavigatorImpl::DidStartProvisionalLoad(
render_frame_host->SetNavigationHandle(scoped_ptr<NavigationHandleImpl>());
}
- render_frame_host->SetNavigationHandle(
- NavigationHandleImpl::Create(validated_url, is_main_frame, delegate_));
+ render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
+ validated_url, render_frame_host->frame_tree_node()));
}
void NavigatorImpl::DidFailProvisionalLoadWithError(
@@ -686,7 +686,7 @@ void NavigatorImpl::OnBeginNavigation(
controller_->GetLastCommittedEntryIndex(),
controller_->GetEntryCount()));
NavigationRequest* navigation_request = frame_tree_node->navigation_request();
- navigation_request->CreateNavigationHandle(delegate_);
+ navigation_request->CreateNavigationHandle();
if (frame_tree_node->IsMainFrame()) {
// Renderer-initiated main-frame navigations that need to swap processes
@@ -855,7 +855,7 @@ void NavigatorImpl::RequestNavigation(
navigation_type, is_same_document_history_load, navigation_start,
controller_));
NavigationRequest* navigation_request = frame_tree_node->navigation_request();
- navigation_request->CreateNavigationHandle(delegate_);
+ navigation_request->CreateNavigationHandle();
// Have the current renderer execute its beforeunload event if needed. If it
// is not needed (when beforeunload dispatch is not needed or this navigation
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 39116a6..068100e 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -915,8 +915,7 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
// message.
if (!navigation_handle_) {
navigation_handle_ = NavigationHandleImpl::Create(
- validated_params.url, frame_tree_node_->IsMainFrame(),
- frame_tree_node_->navigator()->GetDelegate());
+ validated_params.url, frame_tree_node_);
}
accessibility_reset_count_ = 0;
diff --git a/content/public/browser/navigation_handle.cc b/content/public/browser/navigation_handle.cc
index f5eaa11..0df5535 100644
--- a/content/public/browser/navigation_handle.cc
+++ b/content/public/browser/navigation_handle.cc
@@ -6,6 +6,7 @@
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/navigator.h"
+#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
namespace content {
@@ -14,16 +15,16 @@ WebContents* NavigationHandle::GetWebContents() {
// The NavigationHandleImpl cannot access the WebContentsImpl as it would be
// a layering violation, hence the cast here.
return static_cast<WebContentsImpl*>(
- static_cast<NavigationHandleImpl*>(this)->delegate());
+ static_cast<NavigationHandleImpl*>(this)->GetDelegate());
}
// static
scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting(
const GURL& url,
- bool is_main_frame,
- WebContents* web_contents) {
+ RenderFrameHost* render_frame_host) {
scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create(
- url, is_main_frame, static_cast<WebContentsImpl*>(web_contents));
+ url,
+ static_cast<RenderFrameHostImpl*>(render_frame_host)->frame_tree_node());
return scoped_ptr<NavigationHandle>(handle_impl.Pass());
}
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h
index 2a12cb63..ac00c73 100644
--- a/content/public/browser/navigation_handle.h
+++ b/content/public/browser/navigation_handle.h
@@ -96,8 +96,7 @@ class CONTENT_EXPORT NavigationHandle {
static scoped_ptr<NavigationHandle> CreateNavigationHandleForTesting(
const GURL& url,
- bool is_main_frame,
- WebContents* web_contents);
+ RenderFrameHost* render_frame_host);
// Registers a NavigationThrottle for tests. The throttle can
// modify the request, pause the request or cancel the request. This will