From 3619ca8852a449d41118c6e984811ae7b75a7aa1 Mon Sep 17 00:00:00 2001 From: "dcheng@chromium.org" Date: Wed, 9 Jul 2014 15:45:14 +0000 Subject: [PATCH] Convert remaining WebContentsObservers loading callbacks to use RFH. Fix several WebContentsObserver implementations that are incorrectly caching only frame routing IDs in order to act only on that frame in later callbacks. Frame routing IDs by themselves are not suitable for identity comparisons, since they are only unique within a given RenderProcessHost. Also clean up WebContentsObservers with a redundant WebContents field. By definition, a WebContentsObserver must know which WebContents it's observing, so there's no need for derived classes to maintain their own WebContents field. BUG=none Review URL: https://codereview.chromium.org/373623002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282043 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/android/meta_tag_observer.cc | 12 ++--- chrome/browser/android/meta_tag_observer.h | 7 +-- .../first_run/drive_first_run_controller.cc | 14 ++--- .../browser/dom_distiller/tab_utils_browsertest.cc | 10 ++-- .../api/web_navigation/web_navigation_api.cc | 60 ++++++++++++---------- .../api/web_navigation/web_navigation_api.h | 21 +++----- .../browser/guest_view/web_view/web_view_guest.cc | 12 ++--- .../browser/guest_view/web_view/web_view_guest.h | 6 +-- .../password_manager_browsertest.cc | 10 ++-- chrome/browser/prerender/prerender_contents.cc | 22 ++------ chrome/browser/prerender/prerender_contents.h | 16 ++---- .../launcher_favicon_loader_browsertest.cc | 7 +-- .../search/instant_search_prerenderer_unittest.cc | 2 +- chrome/browser/ui/search/search_tab_helper.cc | 9 ++-- chrome/browser/ui/search/search_tab_helper.h | 7 +-- .../ui/views/session_crashed_bubble_view.cc | 6 +-- .../browser/ui/views/session_crashed_bubble_view.h | 7 +-- .../website_settings/permission_bubble_manager.cc | 3 +- .../website_settings/permission_bubble_manager.h | 3 +- .../permission_bubble_manager_unittest.cc | 3 +- .../content/distiller_page_web_contents.cc | 13 ++--- .../content/distiller_page_web_contents.h | 16 ++---- .../distiller_page_web_contents_browsertest.cc | 14 ++--- .../content/dom_distiller_viewer_source.cc | 37 ++++--------- .../content/web_contents_main_frame_observer.cc | 15 ++---- .../content/web_contents_main_frame_observer.h | 7 +-- .../android/web_contents_observer_android.cc | 39 ++++++++------ .../android/web_contents_observer_android.h | 16 +++--- content/browser/web_contents/web_contents_impl.cc | 26 +++------- .../web_contents/web_contents_impl_unittest.cc | 12 ++--- content/public/browser/web_contents_observer.h | 15 ++---- 31 files changed, 160 insertions(+), 287 deletions(-) diff --git a/chrome/browser/android/meta_tag_observer.cc b/chrome/browser/android/meta_tag_observer.cc index 77425b851bb1..c5db909ccf99 100644 --- a/chrome/browser/android/meta_tag_observer.cc +++ b/chrome/browser/android/meta_tag_observer.cc @@ -6,7 +6,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" -#include "content/public/browser/render_view_host.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" @@ -21,12 +21,10 @@ MetaTagObserver::MetaTagObserver(const std::string& meta_tag) MetaTagObserver::~MetaTagObserver() { } -void MetaTagObserver::DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) { - if (!is_main_frame) return; +void MetaTagObserver::DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + if (render_frame_host->GetParent()) + return; validated_url_ = validated_url; Send(new ChromeViewMsg_RetrieveMetaTagContent(routing_id(), validated_url, diff --git a/chrome/browser/android/meta_tag_observer.h b/chrome/browser/android/meta_tag_observer.h index 419fa5723f2b..0c0ccb05fd7a 100644 --- a/chrome/browser/android/meta_tag_observer.h +++ b/chrome/browser/android/meta_tag_observer.h @@ -18,11 +18,8 @@ class MetaTagObserver : public content::WebContentsObserver { virtual ~MetaTagObserver(); // content::WebContentsObserver overrides: - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc index ba5d12b64327..e1a657438cf3 100644 --- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc +++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc @@ -158,12 +158,10 @@ class DriveWebContentsManager : public content::WebContentsObserver, int error_code, const base::string16& error_description) OVERRIDE; - virtual void DidFailLoad(int64 frame_id, + virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - content::RenderViewHost* render_view_host) OVERRIDE; + const base::string16& error_description) OVERRIDE; // content::WebContentsDelegate overrides: virtual bool ShouldCreateWebContents( @@ -268,13 +266,11 @@ void DriveWebContentsManager::DidFailProvisionalLoad( } void DriveWebContentsManager::DidFailLoad( - int64 frame_id, + content::RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - content::RenderViewHost* render_view_host) { - if (is_main_frame) { + const base::string16& error_description) { + if (!render_frame_host->GetParent()) { LOG(WARNING) << "Failed to load WebContents to enable offline mode."; OnOfflineInit(false, DriveFirstRunController::OUTCOME_WEB_CONTENTS_LOAD_FAILED); diff --git a/chrome/browser/dom_distiller/tab_utils_browsertest.cc b/chrome/browser/dom_distiller/tab_utils_browsertest.cc index 37bd4f293b60..c3c0c910f31f 100644 --- a/chrome/browser/dom_distiller/tab_utils_browsertest.cc +++ b/chrome/browser/dom_distiller/tab_utils_browsertest.cc @@ -45,12 +45,10 @@ class WebContentsMainFrameHelper : public content::WebContentsObserver { content::WebContentsObserver::Observe(web_contents); } - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE { - if (is_main_frame && validated_url.scheme() == chrome::kDomDistillerScheme) + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE { + if (!render_frame_host->GetParent() && + validated_url.scheme() == chrome::kDomDistillerScheme) callback_.Run(); } diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index 0ac6ef8fcb7c..35d271bf122c 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -495,21 +495,23 @@ void WebNavigationTabObserver::DidFailProvisionalLoad( } void WebNavigationTabObserver::DocumentLoadedInFrame( - int64 frame_num, - content::RenderViewHost* render_view_host) { + content::RenderFrameHost* render_frame_host) { + content::RenderViewHost* render_view_host = + render_frame_host->GetRenderViewHost(); DVLOG(2) << "DocumentLoadedInFrame(" << "render_view_host=" << render_view_host - << ", frame_num=" << frame_num << ")"; + << ", frame_num=" << render_frame_host->GetRoutingID() << ")"; if (render_view_host != render_view_host_) return; - FrameNavigationState::FrameID frame_id(frame_num, render_view_host); + FrameNavigationState::FrameID frame_id(render_frame_host->GetRoutingID(), + render_view_host); if (!navigation_state_.CanSendEvents(frame_id)) return; navigation_state_.SetParsingFinished(frame_id); helpers::DispatchOnDOMContentLoaded(web_contents(), navigation_state_.GetUrl(frame_id), navigation_state_.IsMainFrame(frame_id), - frame_num); + frame_id.frame_num); if (!navigation_state_.GetNavigationCompleted(frame_id)) return; @@ -520,21 +522,22 @@ void WebNavigationTabObserver::DocumentLoadedInFrame( helpers::DispatchOnCompleted(web_contents(), navigation_state_.GetUrl(frame_id), navigation_state_.IsMainFrame(frame_id), - frame_num); + frame_id.frame_num); } void WebNavigationTabObserver::DidFinishLoad( - int64 frame_num, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) { + content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + content::RenderViewHost* render_view_host = + render_frame_host->GetRenderViewHost(); DVLOG(2) << "DidFinishLoad(" << "render_view_host=" << render_view_host - << ", frame_num=" << frame_num + << ", frame_num=" << render_frame_host->GetRoutingID() << ", url=" << validated_url << ")"; if (render_view_host != render_view_host_) return; - FrameNavigationState::FrameID frame_id(frame_num, render_view_host); + FrameNavigationState::FrameID frame_id(render_frame_host->GetRoutingID(), + render_view_host); // When showing replacement content, we might get load signals for frames // that weren't reguarly loaded. if (!navigation_state_.IsValidFrame(frame_id)) @@ -548,7 +551,8 @@ void WebNavigationTabObserver::DidFinishLoad( validated_url == GURL(url::kAboutBlankURL))) << "validated URL is " << validated_url << " but we expected " << navigation_state_.GetUrl(frame_id); - DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); + DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), + !render_frame_host->GetParent()); // The load might already have finished by the time we finished parsing. For // compatibility reasons, we artifically delay the load completed signal until @@ -557,36 +561,36 @@ void WebNavigationTabObserver::DidFinishLoad( return; helpers::DispatchOnCompleted(web_contents(), navigation_state_.GetUrl(frame_id), - is_main_frame, - frame_num); + !render_frame_host->GetParent(), + frame_id.frame_num); } void WebNavigationTabObserver::DidFailLoad( - int64 frame_num, + content::RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - content::RenderViewHost* render_view_host) { + const base::string16& error_description) { + content::RenderViewHost* render_view_host = + render_frame_host->GetRenderViewHost(); DVLOG(2) << "DidFailLoad(" << "render_view_host=" << render_view_host - << ", frame_num=" << frame_num + << ", frame_num=" << render_frame_host->GetRoutingID() << ", url=" << validated_url << ")"; if (render_view_host != render_view_host_) return; - FrameNavigationState::FrameID frame_id(frame_num, render_view_host); + FrameNavigationState::FrameID frame_id(render_frame_host->GetRoutingID(), + render_view_host); // When showing replacement content, we might get load signals for frames // that weren't reguarly loaded. if (!navigation_state_.IsValidFrame(frame_id)) return; if (navigation_state_.CanSendEvents(frame_id)) { - helpers::DispatchOnErrorOccurred( - web_contents(), - render_view_host->GetProcess()->GetID(), - navigation_state_.GetUrl(frame_id), - frame_num, - is_main_frame, - error_code); + helpers::DispatchOnErrorOccurred(web_contents(), + render_view_host->GetProcess()->GetID(), + navigation_state_.GetUrl(frame_id), + frame_id.frame_num, + !render_frame_host->GetParent(), + error_code); } navigation_state_.SetErrorOccurredInFrame(frame_id); } diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h index 3b81bcade129..35a2956b8d79 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h @@ -71,20 +71,13 @@ class WebNavigationTabObserver int error_code, const base::string16& error_description) OVERRIDE; virtual void DocumentLoadedInFrame( - int64 frame_num, - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidFinishLoad( - int64 frame_num, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidFailLoad( - int64 frame_num, - const GURL& validated_url, - bool is_main_frame, - int error_code, - const base::string16& error_description, - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; + virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url, + int error_code, + const base::string16& error_description) OVERRIDE; virtual void DidGetRedirectForResourceRequest( content::RenderViewHost* render_view_host, const content::ResourceRedirectDetails& details) OVERRIDE; diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc index 914b3a83e982..6b21413d2df6 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.cc +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc @@ -227,7 +227,6 @@ WebViewGuest::WebViewGuest(content::BrowserContext* browser_context, pending_context_menu_request_id_(0), next_permission_request_id_(0), is_overriding_user_agent_(false), - main_frame_id_(0), chromevox_injected_(false), current_zoom_factor_(1.0), find_helper_(this), @@ -1043,10 +1042,8 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame( DCHECK(zoom_controller); current_zoom_factor_ = zoom_controller->GetZoomLevel(); - if (!render_frame_host->GetParent()) { + if (!render_frame_host->GetParent()) chromevox_injected_ = false; - main_frame_id_ = render_frame_host->GetRoutingID(); - } } void WebViewGuest::DidFailProvisionalLoad( @@ -1074,10 +1071,9 @@ void WebViewGuest::DidStartProvisionalLoadForFrame( } void WebViewGuest::DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) { - if (frame_id == main_frame_id_) - InjectChromeVoxIfNeeded(render_view_host); + content::RenderFrameHost* render_frame_host) { + if (!render_frame_host->GetParent()) + InjectChromeVoxIfNeeded(render_frame_host->GetRenderViewHost()); } bool WebViewGuest::OnMessageReceived(const IPC::Message& message, diff --git a/chrome/browser/guest_view/web_view/web_view_guest.h b/chrome/browser/guest_view/web_view/web_view_guest.h index b79f9ef6f6be..447d06246c38 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.h +++ b/chrome/browser/guest_view/web_view/web_view_guest.h @@ -359,8 +359,7 @@ class WebViewGuest : public GuestView, bool is_error_page, bool is_iframe_srcdoc) OVERRIDE; virtual void DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) OVERRIDE; virtual bool OnMessageReceived( const IPC::Message& message, content::RenderFrameHost* render_frame_host) OVERRIDE; @@ -450,9 +449,6 @@ class WebViewGuest : public GuestView, // True if the user agent is overridden. bool is_overriding_user_agent_; - // Main frame ID of last committed page. - int64 main_frame_id_; - // Set to |true| if ChromeVox was already injected in main frame. bool chromevox_injected_; diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 3f625cf09704..b2b5b52d3366 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc @@ -33,6 +33,7 @@ #include "components/password_manager/core/common/password_manager_switches.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" @@ -80,15 +81,12 @@ class NavigationObserver : public content::WebContentsObserver, } // content::WebContentsObserver: - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE { + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE { if (!wait_for_path_.empty()) { if (validated_url.path() == wait_for_path_) message_loop_runner_->Quit(); - } else if (is_main_frame) { + } else if (!render_frame_host->GetParent()) { message_loop_runner_->Quit(); } } diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 672ec3c8903b..85f2c9e4da2b 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -240,7 +240,6 @@ PrerenderContents::PrerenderContents( origin_(origin), experiment_id_(experiment_id), creator_child_id_(-1), - main_frame_id_(0), cookie_status_(0), cookie_send_type_(COOKIE_SEND_TYPE_NONE), network_bytes_(0) { @@ -620,9 +619,8 @@ void PrerenderContents::DidStopLoading( } void PrerenderContents::DocumentLoadedInFrame( - int64 frame_id, - RenderViewHost* render_view_host) { - if (frame_id == main_frame_id_) + content::RenderFrameHost* render_frame_host) { + if (!render_frame_host->GetParent()) NotifyPrerenderDomContentLoaded(); } @@ -645,20 +643,10 @@ void PrerenderContents::DidStartProvisionalLoadForFrame( } } -void PrerenderContents::DidCommitProvisionalLoadForFrame( +void PrerenderContents::DidFinishLoad( content::RenderFrameHost* render_frame_host, - const GURL& url, - content::PageTransition transition_type) { - if (!render_frame_host->GetParent()) { - main_frame_id_ = render_frame_host->GetRoutingID(); - } -} - -void PrerenderContents::DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) { - if (is_main_frame) + const GURL& validated_url) { + if (!render_frame_host->GetParent()) has_finished_loading_ = true; } diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index d69a0e0a9c58..469dcc6020e5 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h @@ -210,21 +210,14 @@ class PrerenderContents : public content::NotificationObserver, virtual void DidStopLoading( content::RenderViewHost* render_view_host) OVERRIDE; virtual void DocumentLoadedInFrame( - int64 frame_id, content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) OVERRIDE; virtual void DidStartProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, bool is_iframe_srcdoc) OVERRIDE; - virtual void DidCommitProvisionalLoadForFrame( - content::RenderFrameHost* render_frame_host, - const GURL& url, - content::PageTransition transition_type) OVERRIDE; - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; @@ -444,9 +437,6 @@ class PrerenderContents : public content::NotificationObserver, // The process that created the child id. int creator_child_id_; - // Main frame ID of last committed page. - int64 main_frame_id_; - // The size of the WebView from the launching page. gfx::Size size_; diff --git a/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc b/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc index a13cc50353da..ddbe7cf6150b 100644 --- a/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc @@ -39,11 +39,8 @@ class ContentsObserver : public WebContentsObserver { bool got_favicons() const { return got_favicons_; } // WebContentsObserver overrides. - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE { + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE { loaded_ = true; } diff --git a/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc b/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc index dd1c4ff1dfad..dfe81b0e165e 100644 --- a/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc +++ b/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc @@ -133,7 +133,7 @@ void DummyPrerenderContents::StartPrerendering( NotifyPrerenderStart(); if (call_did_finish_load_) - DidFinishLoad(1, url_, true, NULL); + DidFinishLoad(prerender_contents_->GetMainFrame(), url_); } bool DummyPrerenderContents::GetChildId(int* child_id) const { diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc index 015d633335cc..8b0f7b3e2111 100644 --- a/chrome/browser/ui/search/search_tab_helper.cc +++ b/chrome/browser/ui/search/search_tab_helper.cc @@ -339,12 +339,9 @@ void SearchTabHelper::DidFailProvisionalLoad( } } -void SearchTabHelper::DidFinishLoad( - int64 /* frame_id */, - const GURL& /* validated_url */, - bool is_main_frame, - content::RenderViewHost* /* render_view_host */) { - if (is_main_frame) { +void SearchTabHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& /* validated_url */) { + if (!render_frame_host->GetParent()) { if (chrome::IsInstantNTP(web_contents_)) RecordNewTabLoadTime(web_contents_); diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h index e1314e5bc179..030d2a6230cc 100644 --- a/chrome/browser/ui/search/search_tab_helper.h +++ b/chrome/browser/ui/search/search_tab_helper.h @@ -154,11 +154,8 @@ class SearchTabHelper : public content::WebContentsObserver, const GURL& validated_url, int error_code, const base::string16& error_description) OVERRIDE; - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) OVERRIDE; diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc index 0b12796e6690..bb3708a7cd48 100644 --- a/chrome/browser/ui/views/session_crashed_bubble_view.cc +++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc @@ -346,10 +346,8 @@ void SessionCrashedBubbleView::DidStartNavigationToPendingEntry( } void SessionCrashedBubbleView::DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) { + content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { if (started_navigation_) CloseBubble(); } diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.h b/chrome/browser/ui/views/session_crashed_bubble_view.h index a2d75bd18911..f1ffb05f5242 100644 --- a/chrome/browser/ui/views/session_crashed_bubble_view.h +++ b/chrome/browser/ui/views/session_crashed_bubble_view.h @@ -78,11 +78,8 @@ class SessionCrashedBubbleView virtual void DidStartNavigationToPendingEntry( const GURL& url, content::NavigationController::ReloadType reload_type) OVERRIDE; - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; virtual void WasShown() OVERRIDE; virtual void WasHidden() OVERRIDE; diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.cc b/chrome/browser/ui/website_settings/permission_bubble_manager.cc index 15c0acadae96..e54e40a24806 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.cc +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.cc @@ -223,8 +223,7 @@ void PermissionBubbleManager::DocumentOnLoadCompletedInMainFrame() { } void PermissionBubbleManager::DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) { + content::RenderFrameHost* render_frame_host) { if (request_url_has_loaded_) ScheduleShowBubble(); } diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h index 76e4b365be08..68418d8709b6 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.h +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h @@ -67,8 +67,7 @@ class PermissionBubbleManager // WebContentsObserver: virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; virtual void DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) OVERRIDE; // If a page on which permissions requests are pending is navigated, // they will be finalized as if canceled by the user. diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc index 1cb3ac49c7e6..2c0ddf88f969 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc +++ b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc @@ -97,7 +97,8 @@ class PermissionBubbleManagerTest : public ChromeRenderViewHostTestHarness { } void WaitForFrameLoad() { - manager_->DocumentLoadedInFrame(0, NULL); + // PermissionBubbleManager ignores all parameters. Yay? + manager_->DocumentLoadedInFrame(NULL); base::MessageLoop::current()->RunUntilIdle(); } diff --git a/components/dom_distiller/content/distiller_page_web_contents.cc b/components/dom_distiller/content/distiller_page_web_contents.cc index 527c0eb96de7..41187eb2b88c 100644 --- a/components/dom_distiller/content/distiller_page_web_contents.cc +++ b/components/dom_distiller/content/distiller_page_web_contents.cc @@ -108,21 +108,18 @@ void DistillerPageWebContents::CreateNewWebContents(const GURL& url) { } void DistillerPageWebContents::DocumentLoadedInFrame( - int64 frame_id, - RenderViewHost* render_view_host) { - if (frame_id == web_contents_->GetMainFrame()->GetRoutingID()) { + content::RenderFrameHost* render_frame_host) { + if (render_frame_host == web_contents_->GetMainFrame()) { ExecuteJavaScript(); } } void DistillerPageWebContents::DidFailLoad( - int64 frame_id, + content::RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) { - if (is_main_frame) { + const base::string16& error_description) { + if (!render_frame_host->GetParent()) { content::WebContentsObserver::Observe(NULL); DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT); state_ = PAGELOAD_FAILED; diff --git a/components/dom_distiller/content/distiller_page_web_contents.h b/components/dom_distiller/content/distiller_page_web_contents.h index aed9789cf552..d7388544f5d1 100644 --- a/components/dom_distiller/content/distiller_page_web_contents.h +++ b/components/dom_distiller/content/distiller_page_web_contents.h @@ -13,12 +13,6 @@ #include "content/public/browser/web_contents_observer.h" #include "url/gurl.h" -namespace content { -class RenderViewHost; -} - -using content::RenderViewHost; - namespace dom_distiller { class SourcePageHandleWebContents : public SourcePageHandle { @@ -58,15 +52,13 @@ class DistillerPageWebContents : public DistillerPage, virtual ~DistillerPageWebContents(); // content::WebContentsObserver implementation. - virtual void DocumentLoadedInFrame(int64 frame_id, - RenderViewHost* render_view_host) OVERRIDE; + virtual void DocumentLoadedInFrame( + content::RenderFrameHost* render_frame_host) OVERRIDE; - virtual void DidFailLoad(int64 frame_id, + virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) OVERRIDE; + const base::string16& error_description) OVERRIDE; protected: virtual void DistillPageImpl(const GURL& url, diff --git a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc index 884a75142baa..7e7aa0210f7e 100644 --- a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc +++ b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc @@ -131,11 +131,9 @@ class WebContentsMainFrameHelper : public content::WebContentsObserver { WebContentsMainFrameHelper(content::WebContents* web_contents, const base::Closure& callback, bool wait_for_document_loaded) - : web_contents_(web_contents), + : WebContentsObserver(web_contents), callback_(callback), - wait_for_document_loaded_(wait_for_document_loaded) { - content::WebContentsObserver::Observe(web_contents); - } + wait_for_document_loaded_(wait_for_document_loaded) {} virtual void DidCommitProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, @@ -148,18 +146,14 @@ class WebContentsMainFrameHelper : public content::WebContentsObserver { } virtual void DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) OVERRIDE { + content::RenderFrameHost* render_frame_host) OVERRIDE { if (wait_for_document_loaded_) { - if (web_contents_ && - frame_id == web_contents_->GetMainFrame()->GetRoutingID()) { + if (!render_frame_host->GetParent()) callback_.Run(); - } } } private: - content::WebContents* web_contents_; base::Closure callback_; bool wait_for_document_loaded_; }; diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc index 26c650266d3d..8f475cc52a95 100644 --- a/components/dom_distiller/content/dom_distiller_viewer_source.cc +++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc @@ -55,11 +55,8 @@ class DomDistillerViewerSource::RequestViewerHandle const content::FrameNavigateParams& params) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; virtual void WebContentsDestroyed() OVERRIDE; - virtual void DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; private: // Sends JavaScript to the attached Viewer, buffering data if the viewer isn't @@ -75,9 +72,6 @@ class DomDistillerViewerSource::RequestViewerHandle // needs to be kept around to ensure the distillation request finishes. scoped_ptr viewer_handle_; - // WebContents associated with the Viewer's render process. - content::WebContents* web_contents_; - // The scheme hosting the current view request; std::string expected_scheme_; @@ -105,18 +99,15 @@ DomDistillerViewerSource::RequestViewerHandle::RequestViewerHandle( const std::string& expected_scheme, const std::string& expected_request_path, const content::URLDataSource::GotDataCallback& callback) - : web_contents_(web_contents), - expected_scheme_(expected_scheme), + : expected_scheme_(expected_scheme), expected_request_path_(expected_request_path), callback_(callback), page_count_(0), waiting_for_page_ready_(true) { - content::WebContentsObserver::Observe(web_contents_); + content::WebContentsObserver::Observe(web_contents); } DomDistillerViewerSource::RequestViewerHandle::~RequestViewerHandle() { - // Balanced with constructor although can be a no-op if frame navigated away. - content::WebContentsObserver::Observe(NULL); } void DomDistillerViewerSource::RequestViewerHandle::SendJavaScript( @@ -124,8 +115,8 @@ void DomDistillerViewerSource::RequestViewerHandle::SendJavaScript( if (waiting_for_page_ready_) { buffer_ += buffer; } else { - if (web_contents_) { - web_contents_->GetMainFrame()->ExecuteJavaScript( + if (web_contents()) { + web_contents()->GetMainFrame()->ExecuteJavaScript( base::UTF8ToUTF16(buffer)); } } @@ -156,9 +147,6 @@ void DomDistillerViewerSource::RequestViewerHandle::WebContentsDestroyed() { } void DomDistillerViewerSource::RequestViewerHandle::Cancel() { - // Ensure we don't send any incremental updates to the Viewer. - web_contents_ = NULL; - // No need to listen for notifications. content::WebContentsObserver::Observe(NULL); @@ -168,21 +156,16 @@ void DomDistillerViewerSource::RequestViewerHandle::Cancel() { } void DomDistillerViewerSource::RequestViewerHandle::DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost* render_view_host) { - if (!is_main_frame || web_contents_ == NULL) { + content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + if (render_frame_host->GetParent()) { return; } waiting_for_page_ready_ = false; if (buffer_.empty()) { return; } - if (web_contents_) { - web_contents_->GetMainFrame()->ExecuteJavaScript( - base::UTF8ToUTF16(buffer_)); - } + web_contents()->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(buffer_)); buffer_.clear(); } diff --git a/components/dom_distiller/content/web_contents_main_frame_observer.cc b/components/dom_distiller/content/web_contents_main_frame_observer.cc index ed1bbab54913..92ea4b9c8214 100644 --- a/components/dom_distiller/content/web_contents_main_frame_observer.cc +++ b/components/dom_distiller/content/web_contents_main_frame_observer.cc @@ -16,9 +16,7 @@ namespace dom_distiller { WebContentsMainFrameObserver::WebContentsMainFrameObserver( content::WebContents* web_contents) - : is_document_loaded_in_main_frame_(false), - is_initialized_(false), - web_contents_(web_contents) { + : is_document_loaded_in_main_frame_(false), is_initialized_(false) { content::WebContentsObserver::Observe(web_contents); } @@ -27,10 +25,8 @@ WebContentsMainFrameObserver::~WebContentsMainFrameObserver() { } void WebContentsMainFrameObserver::DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) { - if (web_contents_ && - frame_id == web_contents_->GetMainFrame()->GetRoutingID()) { + content::RenderFrameHost* render_frame_host) { + if (!render_frame_host->GetParent()) { is_document_loaded_in_main_frame_ = true; } } @@ -49,13 +45,8 @@ void WebContentsMainFrameObserver::RenderProcessGone( CleanUp(); } -void WebContentsMainFrameObserver::WebContentsDestroyed() { - CleanUp(); -} - void WebContentsMainFrameObserver::CleanUp() { content::WebContentsObserver::Observe(NULL); - web_contents_ = NULL; } } // namespace dom_distiller diff --git a/components/dom_distiller/content/web_contents_main_frame_observer.h b/components/dom_distiller/content/web_contents_main_frame_observer.h index 7343dba79ccd..ff24452024c1 100644 --- a/components/dom_distiller/content/web_contents_main_frame_observer.h +++ b/components/dom_distiller/content/web_contents_main_frame_observer.h @@ -28,13 +28,11 @@ class WebContentsMainFrameObserver // content::WebContentsObserver implementation. virtual void DocumentLoadedInFrame( - int64 frame_id, - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; private: explicit WebContentsMainFrameObserver(content::WebContents* web_contents); @@ -52,9 +50,6 @@ class WebContentsMainFrameObserver // at least one call to DidNavigateMainFrame has happened. bool is_initialized_; - // The WebContents this class is tracking. - content::WebContents* web_contents_; - DISALLOW_COPY_AND_ASSIGN(WebContentsMainFrameObserver); }; diff --git a/content/browser/android/web_contents_observer_android.cc b/content/browser/android/web_contents_observer_android.cc index 7cccf16ae00a..2305b964ec3c 100644 --- a/content/browser/android/web_contents_observer_android.cc +++ b/content/browser/android/web_contents_observer_android.cc @@ -24,6 +24,9 @@ using base::android::ConvertUTF16ToJavaString; namespace content { +// TODO(dcheng): File a bug. This class incorrectly passes just a frame ID, +// which is not sufficient to identify a frame (since frame IDs are scoped per +// render process, and so may collide). WebContentsObserverAndroid::WebContentsObserverAndroid( JNIEnv* env, jobject obj, @@ -36,8 +39,8 @@ WebContentsObserverAndroid::~WebContentsObserverAndroid() { } jlong Init(JNIEnv* env, jobject obj, jobject java_web_contents) { - content::WebContents* web_contents = - content::WebContents::FromJavaWebContents(java_web_contents); + WebContents* web_contents = + WebContents::FromJavaWebContents(java_web_contents); CHECK(web_contents); WebContentsObserverAndroid* native_observer = new WebContentsObserverAndroid( @@ -97,7 +100,7 @@ void WebContentsObserverAndroid::DidStopLoading( } void WebContentsObserverAndroid::DidFailProvisionalLoad( - content::RenderFrameHost* render_frame_host, + RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) { @@ -109,14 +112,15 @@ void WebContentsObserverAndroid::DidFailProvisionalLoad( } void WebContentsObserverAndroid::DidFailLoad( - int64 frame_id, + RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) { - DidFailLoadInternal( - false, is_main_frame, error_code, error_description, validated_url); + const base::string16& error_description) { + DidFailLoadInternal(false, + !render_frame_host->GetParent(), + error_code, + error_description, + validated_url); } void WebContentsObserverAndroid::DidNavigateMainFrame( @@ -214,10 +218,8 @@ void WebContentsObserverAndroid::DidCommitProvisionalLoadForFrame( } void WebContentsObserverAndroid::DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) { + RenderFrameHost* render_frame_host, + const GURL& validated_url) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef obj(weak_java_observer_.get(env)); if (obj.is_null()) @@ -233,18 +235,21 @@ void WebContentsObserverAndroid::DidFinishLoad( ScopedJavaLocalRef jstring_url( ConvertUTF8ToJavaString(env, url_string)); Java_WebContentsObserverAndroid_didFinishLoad( - env, obj.obj(), frame_id, jstring_url.obj(), is_main_frame); + env, + obj.obj(), + render_frame_host->GetRoutingID(), + jstring_url.obj(), + !render_frame_host->GetParent()); } void WebContentsObserverAndroid::DocumentLoadedInFrame( - int64 frame_id, - RenderViewHost* render_view_host) { + RenderFrameHost* render_frame_host) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef obj(weak_java_observer_.get(env)); if (obj.is_null()) return; Java_WebContentsObserverAndroid_documentLoadedInFrame( - env, obj.obj(), frame_id); + env, obj.obj(), render_frame_host->GetRoutingID()); } void WebContentsObserverAndroid::NavigationEntryCommitted( diff --git a/content/browser/android/web_contents_observer_android.h b/content/browser/android/web_contents_observer_android.h index 1f771a6251ec..e7b2afb6e36b 100644 --- a/content/browser/android/web_contents_observer_android.h +++ b/content/browser/android/web_contents_observer_android.h @@ -41,12 +41,10 @@ class WebContentsObserverAndroid : public WebContentsObserver { const GURL& validated_url, int error_code, const base::string16& error_description) OVERRIDE; - virtual void DidFailLoad(int64 frame_id, + virtual void DidFailLoad(RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) OVERRIDE; + const base::string16& error_description) OVERRIDE; virtual void DidNavigateMainFrame(const LoadCommittedDetails& details, const FrameNavigateParams& params) OVERRIDE; virtual void DidNavigateAnyFrame(const LoadCommittedDetails& details, @@ -61,12 +59,10 @@ class WebContentsObserverAndroid : public WebContentsObserver { RenderFrameHost* render_frame_host, const GURL& url, PageTransition transition_type) OVERRIDE; - virtual void DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) OVERRIDE; - virtual void DocumentLoadedInFrame(int64 frame_id, - RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFinishLoad(RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; + virtual void DocumentLoadedInFrame( + RenderFrameHost* render_frame_host) OVERRIDE; virtual void NavigationEntryCommitted( const LoadCommittedDetails& load_details) OVERRIDE; virtual void WebContentsDestroyed() OVERRIDE; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index a2ca1928583a..bd4f19356302 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2356,12 +2356,10 @@ void WebContentsImpl::DidFailLoadWithError( const GURL& url, int error_code, const base::string16& error_description) { - int render_frame_id = render_frame_host->GetRoutingID(); - bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); - RenderViewHost* render_view_host = render_frame_host->render_view_host(); - FOR_EACH_OBSERVER(WebContentsObserver, observers_, - DidFailLoad(render_frame_id, url, is_main_frame, error_code, - error_description, render_view_host)); + FOR_EACH_OBSERVER( + WebContentsObserver, + observers_, + DidFailLoad(render_frame_host, url, error_code, error_description)); } void WebContentsImpl::NotifyChangedNavigationState( @@ -2583,12 +2581,8 @@ void WebContentsImpl::OnDocumentLoadedInFrame() { CHECK(!render_view_message_source_); RenderFrameHostImpl* rfh = static_cast(render_frame_message_source_); - - int render_frame_id = rfh->GetRoutingID(); - RenderViewHost* render_view_host = rfh->render_view_host(); - FOR_EACH_OBSERVER(WebContentsObserver, - observers_, - DocumentLoadedInFrame(render_frame_id, render_view_host)); + FOR_EACH_OBSERVER( + WebContentsObserver, observers_, DocumentLoadedInFrame(rfh)); } void WebContentsImpl::OnDidFinishLoad( @@ -2606,12 +2600,8 @@ void WebContentsImpl::OnDidFinishLoad( RenderFrameHostImpl* rfh = static_cast(render_frame_message_source_); - int render_frame_id = rfh->GetRoutingID(); - RenderViewHost* render_view_host = rfh->render_view_host(); - bool is_main_frame = rfh->frame_tree_node()->IsMainFrame(); - FOR_EACH_OBSERVER(WebContentsObserver, observers_, - DidFinishLoad(render_frame_id, validated_url, - is_main_frame, render_view_host)); + FOR_EACH_OBSERVER( + WebContentsObserver, observers_, DidFinishLoad(rfh, validated_url)); } void WebContentsImpl::OnDidStartLoading(bool to_different_document) { diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 84f3f4ce9fe6..a836b9dc5253 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -272,18 +272,14 @@ class TestWebContentsObserver : public WebContentsObserver { } virtual ~TestWebContentsObserver() {} - virtual void DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) OVERRIDE { + virtual void DidFinishLoad(RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE { last_url_ = validated_url; } - virtual void DidFailLoad(int64 frame_id, + virtual void DidFailLoad(RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) OVERRIDE { + const base::string16& error_description) OVERRIDE { last_url_ = validated_url; } diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index d934e36a268a..8a4a2616e861 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -178,8 +178,7 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, // This method is invoked when the document in the given frame finished // loading. At this point, scripts marked as defer were executed, and // content scripts marked "document_end" get injected into the frame. - virtual void DocumentLoadedInFrame(int64 frame_id, - RenderViewHost* render_view_host) {} + virtual void DocumentLoadedInFrame(RenderFrameHost* render_frame_host) {} // This method is invoked when the navigation is done, i.e. the spinner of // the tab will stop spinning, and the onload event was dispatched. @@ -187,19 +186,15 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, // If the WebContents is displaying replacement content, e.g. network error // pages, DidFinishLoad is invoked for frames that were not sending // navigational events before. It is safe to ignore these events. - virtual void DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - RenderViewHost* render_view_host) {} + virtual void DidFinishLoad(RenderFrameHost* render_frame_host, + const GURL& validated_url) {} // This method is like DidFinishLoad, but when the load failed or was // cancelled, e.g. window.stop() is invoked. - virtual void DidFailLoad(int64 frame_id, + virtual void DidFailLoad(RenderFrameHost* render_frame_host, const GURL& validated_url, - bool is_main_frame, int error_code, - const base::string16& error_description, - RenderViewHost* render_view_host) {} + const base::string16& error_description) {} // This method is invoked when content was loaded from an in-memory cache. virtual void DidLoadResourceFromMemoryCache( -- 2.11.4.GIT