Chromium Code Reviews| Index: content/browser/frame_host/frame_tree_node.cc |
| diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc |
| index cccb3ff18209b54ce0bec80d21889382628a0d8e..b8415a7e4a3caa409d67953de399c65bf72d43e8 100644 |
| --- a/content/browser/frame_host/frame_tree_node.cc |
| +++ b/content/browser/frame_host/frame_tree_node.cc |
| @@ -287,24 +287,26 @@ void FrameTreeNode::CreatedNavigationRequest( |
| scoped_ptr<NavigationRequest> navigation_request) { |
| CHECK(IsBrowserSideNavigationEnabled()); |
| + bool was_previously_loading = frame_tree()->IsLoading(); |
| + |
| // There's no need to reset the state: there's still an ongoing load, and the |
| // RenderFrameHostManager will take care of updates to the speculative |
| // RenderFrameHost in DidCreateNavigationRequest below. |
| - ResetNavigationRequest(true); |
| + if (was_previously_loading) |
| + ResetNavigationRequest(true); |
| + |
| + navigation_request_ = std::move(navigation_request); |
| + render_manager()->DidCreateNavigationRequest(*navigation_request_); |
| // Force the throbber to start to keep it in sync with what is happening in |
| // the UI. Blink doesn't send throb notifications for JavaScript URLs, so it |
| // is not done here either. |
| - if (!navigation_request->common_params().url.SchemeIs( |
| + if (!navigation_request_->common_params().url.SchemeIs( |
| url::kJavaScriptScheme)) { |
| // TODO(fdegans): Check if this is a same-document navigation and set the |
| // proper argument. |
| - DidStartLoading(true); |
| + DidStartLoading(true, was_previously_loading); |
| } |
| - |
| - navigation_request_ = std::move(navigation_request); |
| - |
| - render_manager()->DidCreateNavigationRequest(*navigation_request_); |
| } |
| void FrameTreeNode::ResetNavigationRequest(bool keep_state) { |
| @@ -330,7 +332,8 @@ void FrameTreeNode::reset_loading_progress() { |
| loading_progress_ = kLoadingProgressNotStarted; |
| } |
| -void FrameTreeNode::DidStartLoading(bool to_different_document) { |
| +void FrameTreeNode::DidStartLoading(bool to_different_document, |
| + bool was_previously_loading) { |
| // Any main frame load to a new document should reset the load progress since |
| // it will replace the current page and any frames. The WebContents will |
| // be notified when DidChangeLoadProgress is called. |
| @@ -338,7 +341,7 @@ void FrameTreeNode::DidStartLoading(bool to_different_document) { |
| frame_tree_->ResetLoadProgress(); |
| // Notify the WebContents. |
| - if (!frame_tree_->IsLoading()) |
| + if (!was_previously_loading) |
| navigator()->GetDelegate()->DidStartLoading(this, to_different_document); |
| // Set initial load progress and update overall progress. This will notify |
| @@ -405,4 +408,26 @@ void FrameTreeNode::DidFocus() { |
| FOR_EACH_OBSERVER(Observer, observers_, OnFrameTreeNodeFocused(this)); |
| } |
| +void FrameTreeNode::BeforeUnloadCanceled() { |
| + if (!IsMainFrame()) |
|
Charlie Reis
2016/02/17 05:15:28
Add TODO to support beforeunload in subframes.
clamy
2016/02/18 17:20:26
Done.
|
| + return; |
| + |
| + RenderFrameHostImpl* current_frame_host = |
| + render_manager_.current_frame_host(); |
| + DCHECK(current_frame_host); |
| + current_frame_host->ResetLoadingState(); |
| + |
| + if (IsBrowserSideNavigationEnabled()) { |
| + RenderFrameHostImpl* speculative_frame_host = |
| + render_manager_.speculative_frame_host(); |
| + if (speculative_frame_host) |
| + speculative_frame_host->ResetLoadingState(); |
| + } else { |
| + RenderFrameHostImpl* pending_frame_host = |
| + render_manager_.pending_frame_host(); |
| + if (pending_frame_host) |
| + pending_frame_host->ResetLoadingState(); |
| + } |
| +} |
| + |
| } // namespace content |