Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: content/browser/frame_host/frame_tree_node.cc

Issue 1545973002: Remove the is_loading_ field from WebContentsImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + addressed Nasko's nits Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/interstitial_page_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
+ 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
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/interstitial_page_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698