diff options
Diffstat (limited to 'content/browser/frame_host')
6 files changed, 30 insertions, 31 deletions
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; |