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

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

Issue 1080143003: Move DidStartLoading, DidStopLoading, DidChangeLoadProgress to RFHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 5 years, 8 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
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index d4cc6f50c5f352ef7c908d8f5601785b97335ec6..604c3ce8aea5c2f078b1c7595201648abbbbdfff 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -385,6 +385,10 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
// The following message is synthetic and doesn't come from RenderFrame, but
// from RenderProcessHost.
IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress,
+ OnDidChangeLoadProgress)
#if defined(OS_MACOSX) || defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
@@ -842,11 +846,11 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
}
void RenderFrameHostImpl::OnDidDropNavigation() {
- // At the end of Navigate(), the delegate's DidStartLoading is called to force
- // the spinner to start, even if the renderer didn't yet begin the load. If it
- // turns out that the renderer dropped the navigation, we need to turn off the
- // spinner.
- delegate_->DidStopLoading();
+ // At the end of Navigate(), the Navigator's DidStartLoading is called to
+ // force the spinner to start, even if the renderer didn't yet begin the load.
+ // If it turns out that the renderer dropped the navigation, the spinner needs
+ // to be turned off.
+ frame_tree_node_->navigator()->DidStopLoading();
Fabrice (no longer in Chrome) 2015/04/14 16:54:11 We have to go through the navigator here because c
nasko 2015/04/14 19:54:41 I don't quite follow. During Navigate() we simulat
Fabrice (no longer in Chrome) 2015/04/15 15:15:03 I think this is going to break some tests, trying
nasko 2015/04/15 15:39:28 Different CL or a new patchset?
Fabrice (no longer in Chrome) 2015/04/15 17:46:05 New patchset, sorry.
}
RenderWidgetHostImpl* RenderFrameHostImpl::GetRenderWidgetHost() {
@@ -1403,6 +1407,45 @@ void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) {
render_view_host_->WasResized();
}
+void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) {
+ // Any main frame load to a new document should reset the load since it will
+ // replace the current page and any frames.
+ if (to_different_document && !GetParent())
+ is_loading_ = false;
+
+ // This method should never be called when the frame is loading.
+ // Unfortunately, it can happen if a history navigation happens during a
+ // BeforeUnload or Unload event.
+ // TODO(fdegans): Change this to a DCHECK after LoadEventProgress has been
+ // refactored in Blink. See crbug.com/466089
+ if (is_loading_) {
+ LOG(WARNING) << "OnDidStartLoading was called twice.";
+ return;
+ }
+
+ frame_tree_node_->DidStartLoading(to_different_document);
Fabrice (no longer in Chrome) 2015/04/14 16:54:11 Here and below, it is not clear to me that this wi
nasko 2015/04/14 19:54:41 It is the job of the FTN to ensure that it does th
Fabrice (no longer in Chrome) 2015/04/15 15:15:03 The main issue is you now have to consider 4 diffe
+ is_loading_ = true;
+}
+
+void RenderFrameHostImpl::OnDidStopLoading() {
+ // This method should never be called when the frame is not loading.
+ // Unfortunately, it can happen if a history navigation happens during a
+ // BeforeUnload or Unload event.
+ // TODO(fdegans): Change this to a DCHECK after LoadEventProgress has been
+ // refactored in Blink. See crbug.com/466089
+ if (!is_loading_) {
+ LOG(WARNING) << "OnDidStopLoading was called twice.";
+ return;
+ }
+
+ is_loading_ = false;
+ frame_tree_node_->DidStopLoading();
Fabrice (no longer in Chrome) 2015/04/14 16:54:11 Same as above, it is not clear we'll end up in Web
nasko 2015/04/14 19:54:41 Why do we care to know here whether we end up in W
Fabrice (no longer in Chrome) 2015/04/15 15:15:03 Acknowledged.
+}
+
+void RenderFrameHostImpl::OnDidChangeLoadProgress(double load_progress) {
+ frame_tree_node_->DidChangeLoadProgress(load_progress);
+}
+
#if defined(OS_MACOSX) || defined(OS_ANDROID)
void RenderFrameHostImpl::OnShowPopup(
const FrameHostMsg_ShowPopup_Params& params) {
@@ -1573,7 +1616,7 @@ void RenderFrameHostImpl::Navigate(
// Blink doesn't send throb notifications for JavaScript URLs, so we
// don't want to either.
if (!common_params.url.SchemeIs(url::kJavaScriptScheme))
- delegate_->DidStartLoading(this, true);
+ frame_tree_node_->navigator()->DidStartLoading(frame_tree_node_, true);
Fabrice (no longer in Chrome) 2015/04/14 16:54:11 Same as above, we need to go through the Navigator
nasko 2015/04/14 19:54:41 I don't think we need to. FTN is the object which
Fabrice (no longer in Chrome) 2015/04/15 15:15:03 Same as above, trying it in the next patch set.
}
void RenderFrameHostImpl::NavigateToURL(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698