diff options
101 files changed, 159 insertions, 252 deletions
diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc index c863971..555cd83 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.cc +++ b/android_webview/native/aw_contents_io_thread_client_impl.cc @@ -112,7 +112,7 @@ class ClientMapEntryUpdater : public content::WebContentsObserver { virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: JavaObjectWeakGlobalRef jdelegate_; @@ -142,7 +142,7 @@ void ClientMapEntryUpdater::RenderFrameDeleted(RenderFrameHost* rfh) { RfhToIoThreadClientMap::GetInstance()->Erase(GetRenderFrameHostIdPair(rfh)); } -void ClientMapEntryUpdater::WebContentsDestroyed(WebContents* web_contents) { +void ClientMapEntryUpdater::WebContentsDestroyed() { delete this; } diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index 843ebf7..3779cd8 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc @@ -267,7 +267,7 @@ void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { UpdateEverything(); } -void AwSettings::WebContentsDestroyed(content::WebContents* web_contents) { +void AwSettings::WebContentsDestroyed() { delete this; } diff --git a/android_webview/native/aw_settings.h b/android_webview/native/aw_settings.h index 95c0d9c..92bf658 100644 --- a/android_webview/native/aw_settings.h +++ b/android_webview/native/aw_settings.h @@ -46,8 +46,7 @@ class AwSettings : public content::WebContentsObserver { // WebContentsObserver overrides: virtual void RenderViewCreated( content::RenderViewHost* render_view_host) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; bool accelerated_2d_canvas_disabled_by_switch_; diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc index 4539402..7a010b1 100644 --- a/chrome/browser/android/shortcut_helper.cc +++ b/chrome/browser/android/shortcut_helper.cc @@ -114,7 +114,7 @@ bool ShortcutBuilder::OnMessageReceived(const IPC::Message& message) { return handled; } -void ShortcutBuilder::WebContentsDestroyed(content::WebContents* web_contents) { +void ShortcutBuilder::WebContentsDestroyed() { Destroy(); } diff --git a/chrome/browser/android/shortcut_helper.h b/chrome/browser/android/shortcut_helper.h index 4be5c30..9e4e13c 100644 --- a/chrome/browser/android/shortcut_helper.h +++ b/chrome/browser/android/shortcut_helper.h @@ -57,8 +57,7 @@ class ShortcutBuilder : public content::WebContentsObserver { // WebContentsObserver virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: void Destroy(); diff --git a/chrome/browser/apps/ephemeral_app_launcher.cc b/chrome/browser/apps/ephemeral_app_launcher.cc index 82111ef..d0f4c70 100644 --- a/chrome/browser/apps/ephemeral_app_launcher.cc +++ b/chrome/browser/apps/ephemeral_app_launcher.cc @@ -252,8 +252,7 @@ void EphemeralAppLauncher::CompleteInstall(const std::string& error) { // WebstoreStandaloneInstaller to support this cleanly. } -void EphemeralAppLauncher::WebContentsDestroyed( - content::WebContents* web_contents) { +void EphemeralAppLauncher::WebContentsDestroyed() { AbortInstall(); } diff --git a/chrome/browser/apps/ephemeral_app_launcher.h b/chrome/browser/apps/ephemeral_app_launcher.h index baefed5..a68d611 100644 --- a/chrome/browser/apps/ephemeral_app_launcher.h +++ b/chrome/browser/apps/ephemeral_app_launcher.h @@ -90,8 +90,7 @@ class EphemeralAppLauncher : public extensions::WebstoreStandaloneInstaller, virtual void CompleteInstall(const std::string& error) OVERRIDE; // content::WebContentsObserver implementation. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // ExtensionRegistryObserver implementation. virtual void OnExtensionLoaded( diff --git a/chrome/browser/autofill/content_autofill_driver_browsertest.cc b/chrome/browser/autofill/content_autofill_driver_browsertest.cc index d452e1e..1df9234 100644 --- a/chrome/browser/autofill/content_autofill_driver_browsertest.cc +++ b/chrome/browser/autofill/content_autofill_driver_browsertest.cc @@ -81,20 +81,19 @@ class ContentAutofillDriverBrowserTest : public InProcessBrowserTest, virtual ~ContentAutofillDriverBrowserTest() {} virtual void SetUpOnMainThread() OVERRIDE { - web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(web_contents_ != NULL); - Observe(web_contents_); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents != NULL); + Observe(web_contents); AutofillManager::RegisterProfilePrefs(manager_delegate_.GetPrefRegistry()); autofill_driver_.reset( - new TestContentAutofillDriver(web_contents_, &manager_delegate_)); + new TestContentAutofillDriver(web_contents, &manager_delegate_)); } // Normally the WebContents will automatically delete the driver, but here // the driver is owned by this test, so we have to manually destroy. - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE { - DCHECK_EQ(web_contents_, web_contents); + virtual void WebContentsDestroyed() OVERRIDE { autofill_driver_.reset(); } diff --git a/chrome/browser/chromeos/file_manager/app_installer.cc b/chrome/browser/chromeos/file_manager/app_installer.cc index 40c90cd..637bc2f 100644 --- a/chrome/browser/chromeos/file_manager/app_installer.cc +++ b/chrome/browser/chromeos/file_manager/app_installer.cc @@ -27,9 +27,8 @@ class AppInstaller::WebContentsObserver protected: // content::WebContentsObserver implementation. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE { - parent_->OnWebContentsDestroyed(web_contents); + virtual void WebContentsDestroyed() OVERRIDE { + parent_->OnWebContentsDestroyed(web_contents()); } private: diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc index 9431b79..504af77 100644 --- a/chrome/browser/download/download_request_limiter.cc +++ b/chrome/browser/download/download_request_limiter.cc @@ -110,14 +110,12 @@ void DownloadRequestLimiter::TabDownloadState::DidGetUserGesture() { } } -void DownloadRequestLimiter::TabDownloadState::WebContentsDestroyed( - content::WebContents* web_contents) { +void DownloadRequestLimiter::TabDownloadState::WebContentsDestroyed() { // Tab closed, no need to handle closing the dialog as it's owned by the // WebContents. NotifyCallbacks(false); - // Note that web_contents() is NULL at this point. - host_->Remove(this, web_contents); + host_->Remove(this, web_contents()); // WARNING: We've been deleted. } diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h index 4ecf370..83552ed 100644 --- a/chrome/browser/download/download_request_limiter.h +++ b/chrome/browser/download/download_request_limiter.h @@ -112,8 +112,7 @@ class DownloadRequestLimiter // Invoked when a user gesture occurs (mouse click, enter or space). This // may result in invoking Remove on DownloadRequestLimiter. virtual void DidGetUserGesture() OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Asks the user if they really want to allow the download. // See description above CanDownloadOnIOThread for details on lifetime of diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc index ef87525..1a67167 100644 --- a/chrome/browser/extensions/active_tab_permission_granter.cc +++ b/chrome/browser/extensions/active_tab_permission_granter.cc @@ -83,8 +83,7 @@ void ActiveTabPermissionGranter::DidNavigateMainFrame( ClearActiveExtensionsAndNotify(); } -void ActiveTabPermissionGranter::WebContentsDestroyed( - content::WebContents* web_contents) { +void ActiveTabPermissionGranter::WebContentsDestroyed() { ClearActiveExtensionsAndNotify(); } diff --git a/chrome/browser/extensions/active_tab_permission_granter.h b/chrome/browser/extensions/active_tab_permission_granter.h index bf51ed0..4945915 100644 --- a/chrome/browser/extensions/active_tab_permission_granter.h +++ b/chrome/browser/extensions/active_tab_permission_granter.h @@ -45,8 +45,7 @@ class ActiveTabPermissionGranter virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // extensions::ExtensionRegistryObserver implementation. virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc index 8398736..57d1133 100644 --- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc +++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc @@ -215,8 +215,7 @@ bool DesktopCaptureChooseDesktopMediaFunction::RunAsync() { return true; } -void DesktopCaptureChooseDesktopMediaFunction::WebContentsDestroyed( - content::WebContents* web_contents) { +void DesktopCaptureChooseDesktopMediaFunction::WebContentsDestroyed() { Cancel(); } diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h index 6a8d19b..7c3af4b 100644 --- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h +++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h @@ -52,8 +52,7 @@ class DesktopCaptureChooseDesktopMediaFunction virtual bool RunAsync() OVERRIDE; // content::WebContentsObserver overrides. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; void OnPickerDialogResults(content::DesktopMediaID source); 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 26e86ad..392d749 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -646,10 +646,10 @@ void WebNavigationTabObserver::FrameDetached( navigation_state_.FrameDetached(frame_id); } -void WebNavigationTabObserver::WebContentsDestroyed(content::WebContents* tab) { - g_tab_observer.Get().erase(tab); +void WebNavigationTabObserver::WebContentsDestroyed() { + g_tab_observer.Get().erase(web_contents()); registrar_.RemoveAll(); - SendErrorEvents(tab, NULL, FrameNavigationState::FrameID()); + SendErrorEvents(web_contents(), NULL, FrameNavigationState::FrameID()); } void WebNavigationTabObserver::SendErrorEvents( 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 d3aaf76..f0e144d 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h @@ -105,7 +105,7 @@ class WebNavigationTabObserver int64 source_frame_num) OVERRIDE; virtual void FrameDetached(content::RenderViewHost* render_view_host, int64 frame_num) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: explicit WebNavigationTabObserver(content::WebContents* web_contents); diff --git a/chrome/browser/extensions/extension_view_host.cc b/chrome/browser/extensions/extension_view_host.cc index b5ace6b..12afacc 100644 --- a/chrome/browser/extensions/extension_view_host.cc +++ b/chrome/browser/extensions/extension_view_host.cc @@ -42,7 +42,7 @@ class ExtensionViewHost::AssociatedWebContentsObserver virtual ~AssociatedWebContentsObserver() {} // content::WebContentsObserver: - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { // Deleting |this| from here is safe. host_->SetAssociatedWebContents(NULL); } diff --git a/chrome/browser/extensions/script_executor.cc b/chrome/browser/extensions/script_executor.cc index 45f6fc5..6ff22d8 100644 --- a/chrome/browser/extensions/script_executor.cc +++ b/chrome/browser/extensions/script_executor.cc @@ -64,7 +64,7 @@ class Handler : public content::WebContentsObserver { return true; } - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { base::ListValue val; callback_.Run(kRendererDestroyed, -1, GURL(std::string()), val); delete this; diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 0d0b897..f857f94 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -158,8 +158,7 @@ bool WebstoreInlineInstaller::CheckRequestorPermitted( // Private implementation. // -void WebstoreInlineInstaller::WebContentsDestroyed( - content::WebContents* web_contents) { +void WebstoreInlineInstaller::WebContentsDestroyed() { AbortInstall(); } diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h index 59fcb40a..33b278d 100644 --- a/chrome/browser/extensions/webstore_inline_installer.h +++ b/chrome/browser/extensions/webstore_inline_installer.h @@ -58,8 +58,7 @@ class WebstoreInlineInstaller private: // content::WebContentsObserver interface implementation. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Checks whether the install is initiated by a page in a verified site // (which is at least a domain, but can also have a port or a path). diff --git a/chrome/browser/guest_view/guest_view_manager.cc b/chrome/browser/guest_view/guest_view_manager.cc index a1aaf5f..2db79a2 100644 --- a/chrome/browser/guest_view/guest_view_manager.cc +++ b/chrome/browser/guest_view/guest_view_manager.cc @@ -48,7 +48,7 @@ class GuestWebContentsObserver delete this; } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { delete this; } 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 d18130f..b29d103 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.cc +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc @@ -791,14 +791,14 @@ void WebViewGuest::DidStopLoading(content::RenderViewHost* render_view_host) { DispatchEvent(new GuestViewBase::Event(webview::kEventLoadStop, args.Pass())); } -void WebViewGuest::WebContentsDestroyed(WebContents* web_contents) { +void WebViewGuest::WebContentsDestroyed() { // Clean up custom context menu items for this guest. extensions::MenuManager* menu_manager = extensions::MenuManager::Get( Profile::FromBrowserContext(browser_context())); menu_manager->RemoveAllContextItems(extensions::MenuItem::ExtensionKey( embedder_extension_id(), view_instance_id())); - RemoveWebViewFromExtensionRendererState(web_contents); + RemoveWebViewFromExtensionRendererState(web_contents()); } void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { 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 8898aa3..37557bf 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.h +++ b/chrome/browser/guest_view/web_view/web_view_guest.h @@ -264,8 +264,7 @@ class WebViewGuest : public GuestView<WebViewGuest>, content::RenderViewHost* render_view_host) OVERRIDE; virtual void DidStopLoading( content::RenderViewHost* render_view_host) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; // Called after the load handler is called in the guest's main frame. diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index 03ccc81..948811b 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -153,10 +153,9 @@ HistoryService* HistoryTabHelper::GetHistoryService() { Profile::IMPLICIT_ACCESS); } -void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { +void HistoryTabHelper::WebContentsDestroyed() { // We update the history for this URL. - // The content returned from web_contents() has been destroyed by now. - // We need to use tab value directly. + WebContents* tab = web_contents(); Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); if (profile->IsOffTheRecord()) return; diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h index 65c21ad..c6372b4 100644 --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h @@ -51,7 +51,7 @@ class HistoryTabHelper : public content::WebContentsObserver, const content::FrameNavigateParams& params) OVERRIDE; virtual void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Helper function to return the history service. May return NULL. HistoryService* GetHistoryService(); diff --git a/chrome/browser/infobars/infobar_service.cc b/chrome/browser/infobars/infobar_service.cc index 3d03544..030035b 100644 --- a/chrome/browser/infobars/infobar_service.cc +++ b/chrome/browser/infobars/infobar_service.cc @@ -107,11 +107,11 @@ void InfoBarService::NavigationEntryCommitted( OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details)); } -void InfoBarService::WebContentsDestroyed(content::WebContents* web_contents) { +void InfoBarService::WebContentsDestroyed() { // The WebContents is going away; be aggressively paranoid and delete // ourselves lest other parts of the system attempt to add infobars or use // us otherwise during the destruction. - web_contents->RemoveUserData(UserDataKey()); + web_contents()->RemoveUserData(UserDataKey()); // That was the equivalent of "delete this". This object is now destroyed; // returning from this function is the only safe thing to do. } diff --git a/chrome/browser/infobars/infobar_service.h b/chrome/browser/infobars/infobar_service.h index 39cca9a..a90305b 100644 --- a/chrome/browser/infobars/infobar_service.h +++ b/chrome/browser/infobars/infobar_service.h @@ -62,8 +62,7 @@ class InfoBarService : public infobars::InfoBarManager, virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Message handlers. diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc index 24d9292..244a645 100644 --- a/chrome/browser/media/media_stream_capture_indicator.cc +++ b/chrome/browser/media/media_stream_capture_indicator.cc @@ -161,8 +161,8 @@ class MediaStreamCaptureIndicator::WebContentsDeviceUsage private: // content::WebContentsObserver overrides. - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { - indicator_->UnregisterWebContents(web_contents); + virtual void WebContentsDestroyed() OVERRIDE { + indicator_->UnregisterWebContents(web_contents()); delete this; } diff --git a/chrome/browser/media_galleries/media_file_system_registry.cc b/chrome/browser/media_galleries/media_file_system_registry.cc index 08cecd1..a53ed2b 100644 --- a/chrome/browser/media_galleries/media_file_system_registry.cc +++ b/chrome/browser/media_galleries/media_file_system_registry.cc @@ -85,7 +85,7 @@ class RPHReferenceManager { private: // content::WebContentsObserver - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) OVERRIDE; @@ -155,9 +155,8 @@ RPHReferenceManager::RPHWebContentsObserver::RPHWebContentsObserver( manager_(manager) { } -void RPHReferenceManager::RPHWebContentsObserver::WebContentsDestroyed( - WebContents* web_contents) { - manager_->OnWebContentsDestroyedOrNavigated(web_contents); +void RPHReferenceManager::RPHWebContentsObserver::WebContentsDestroyed() { + manager_->OnWebContentsDestroyedOrNavigated(web_contents()); } void RPHReferenceManager::RPHWebContentsObserver::NavigationEntryCommitted( diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 08e397f..fca167e 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -497,8 +497,7 @@ class WebContentsLoadedOrDestroyedWatcher void Wait(); // Overridden WebContentsObserver methods. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void DidStopLoading( content::RenderViewHost* render_view_host) OVERRIDE; @@ -520,8 +519,7 @@ void WebContentsLoadedOrDestroyedWatcher::Wait() { message_loop_runner_->Run(); } -void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed( - content::WebContents* web_contents) { +void WebContentsLoadedOrDestroyedWatcher::WebContentsDestroyed() { message_loop_runner_->Quit(); } diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index aa615b1..d36a502 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -1118,8 +1118,7 @@ void PrerenderManager::PendingSwap::DidFailProvisionalLoad( prerender_data_->ClearPendingSwap(); } -void PrerenderManager::PendingSwap::WebContentsDestroyed( - content::WebContents* web_contents) { +void PrerenderManager::PendingSwap::WebContentsDestroyed() { prerender_data_->ClearPendingSwap(); } diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h index 87d8b11..6861b7b 100644 --- a/chrome/browser/prerender/prerender_manager.h +++ b/chrome/browser/prerender/prerender_manager.h @@ -477,8 +477,7 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, int error_code, const base::string16& error_description, content::RenderViewHost* render_view_host) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: void RecordEvent(PrerenderEvent event) const; diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 4a29c65..1e5c58d 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -28,7 +28,7 @@ class BackgroundPrintingManager::Observer private: virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; BackgroundPrintingManager* manager_; }; @@ -43,9 +43,8 @@ void BackgroundPrintingManager::Observer::RenderProcessGone( base::TerminationStatus status) { manager_->DeletePreviewContents(web_contents()); } -void BackgroundPrintingManager::Observer::WebContentsDestroyed( - WebContents* web_contents) { - manager_->DeletePreviewContents(web_contents); +void BackgroundPrintingManager::Observer::WebContentsDestroyed() { + manager_->DeletePreviewContents(web_contents()); } BackgroundPrintingManager::BackgroundPrintingManager() { diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 2a44102..5dbc2b55 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -150,7 +150,7 @@ class SignInObserver : public content::WebContentsObserver { } } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { delete this; } diff --git a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc index 1c769f4..c18b999 100644 --- a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc +++ b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc @@ -91,7 +91,7 @@ class PrintPreviewDialogDestroyedObserver : public WebContentsObserver { private: // content::WebContentsObserver implementation. - virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { dialog_destroyed_ = true; } diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index c07a773..ad77670 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -479,8 +479,7 @@ bool ClientSideDetectionHost::DidPageReceiveSafeBrowsingMatch() const { return entry->GetExtraData(kSafeBrowsingMatchKey, &value); } -void ClientSideDetectionHost::WebContentsDestroyed(WebContents* tab) { - DCHECK(tab); +void ClientSideDetectionHost::WebContentsDestroyed() { // Tell any pending classification request that it is being canceled. if (classification_request_.get()) { classification_request_->Cancel(); diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h index 1db9f29..24ca81c 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.h +++ b/chrome/browser/safe_browsing/client_side_detection_host.h @@ -67,7 +67,7 @@ class ClientSideDetectionHost : public content::WebContentsObserver, explicit ClientSideDetectionHost(content::WebContents* tab); // From content::WebContentsObserver. - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Used for testing. void set_safe_browsing_managers( diff --git a/chrome/browser/task_manager/web_contents_resource_provider.cc b/chrome/browser/task_manager/web_contents_resource_provider.cc index b29dd88..2fb79f1 100644 --- a/chrome/browser/task_manager/web_contents_resource_provider.cc +++ b/chrome/browser/task_manager/web_contents_resource_provider.cc @@ -51,8 +51,8 @@ class TaskManagerWebContentsObserver : public content::WebContentsObserver { provider_->RemoveFromTaskManager(web_contents()); } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { - provider_->RemoveFromTaskManager(web_contents); + virtual void WebContentsDestroyed() OVERRIDE { + provider_->RemoveFromTaskManager(web_contents()); provider_->DeleteObserver(this); // Deletes |this|. } diff --git a/chrome/browser/translate/translate_tab_helper.cc b/chrome/browser/translate/translate_tab_helper.cc index 9af958f7..5ecd089f 100644 --- a/chrome/browser/translate/translate_tab_helper.cc +++ b/chrome/browser/translate/translate_tab_helper.cc @@ -301,8 +301,7 @@ void TranslateTabHelper::DidNavigateAnyFrame( translate_driver_.DidNavigate(details); } -void TranslateTabHelper::WebContentsDestroyed( - content::WebContents* web_contents) { +void TranslateTabHelper::WebContentsDestroyed() { // Translation process can be interrupted. // Destroying the TranslateManager now guarantees that it never has to deal // with NULL WebContents. diff --git a/chrome/browser/translate/translate_tab_helper.h b/chrome/browser/translate/translate_tab_helper.h index d4195f4..10fb138 100644 --- a/chrome/browser/translate/translate_tab_helper.h +++ b/chrome/browser/translate/translate_tab_helper.h @@ -108,8 +108,7 @@ class TranslateTabHelper virtual void DidNavigateAnyFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Initiates translation once the page is finished loading. void InitiateTranslation(const std::string& page_lang, int attempt); diff --git a/chrome/browser/ui/android/infobars/auto_login_prompter.cc b/chrome/browser/ui/android/infobars/auto_login_prompter.cc index 2cc1f24..7d50998 100644 --- a/chrome/browser/ui/android/infobars/auto_login_prompter.cc +++ b/chrome/browser/ui/android/infobars/auto_login_prompter.cc @@ -97,7 +97,7 @@ void AutoLoginPrompter::DidStopLoading( delete this; } -void AutoLoginPrompter::WebContentsDestroyed(WebContents* web_contents) { +void AutoLoginPrompter::WebContentsDestroyed() { // The WebContents was destroyed before the navigation completed. delete this; } diff --git a/chrome/browser/ui/android/infobars/auto_login_prompter.h b/chrome/browser/ui/android/infobars/auto_login_prompter.h index d55eb67..bfeb290 100644 --- a/chrome/browser/ui/android/infobars/auto_login_prompter.h +++ b/chrome/browser/ui/android/infobars/auto_login_prompter.h @@ -53,8 +53,7 @@ class AutoLoginPrompter : public content::WebContentsObserver { virtual void DidStopLoading( content::RenderViewHost* render_view_host) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Add the infobar to the WebContents, if it's still needed. void AddInfoBarToWebContents(); diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index f10792c..36b1935 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc @@ -60,14 +60,11 @@ class BrowserStatusMonitor::LocalWebContentsObserver monitor_->SetShelfIDForBrowserWindowContents(browser, web_contents()); } - virtual void WebContentsDestroyed( - content::WebContents* web_content) OVERRIDE { - if (web_content == web_contents()) { - // We can only come here when there was a non standard termination like - // an app got un-installed while running, etc. - monitor_->WebContentsDestroyed(web_content); - // |this| is gone now. - } + virtual void WebContentsDestroyed() OVERRIDE { + // We can only come here when there was a non standard termination like + // an app got un-installed while running, etc. + monitor_->WebContentsDestroyed(web_contents()); + // |this| is gone now. } private: diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index b0b4a01..887cf81 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc @@ -683,8 +683,7 @@ class WebContentsDestroyedWatcher : public content::WebContentsObserver { private: // Overridden WebContentsObserver methods. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { message_loop_runner_->Quit(); } diff --git a/chrome/browser/ui/auto_login_infobar_delegate.cc b/chrome/browser/ui/auto_login_infobar_delegate.cc index 1149029..62dffb6 100644 --- a/chrome/browser/ui/auto_login_infobar_delegate.cc +++ b/chrome/browser/ui/auto_login_infobar_delegate.cc @@ -63,8 +63,7 @@ class AutoLoginRedirector : public UbertokenConsumer, virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; // Implementation of content::WebContentsObserver - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Redirect tab to MergeSession URL, logging the user in and navigating // to the desired page. @@ -97,8 +96,7 @@ AutoLoginRedirector::AutoLoginRedirector( AutoLoginRedirector::~AutoLoginRedirector() { } -void AutoLoginRedirector::WebContentsDestroyed( - content::WebContents* web_contents) { +void AutoLoginRedirector::WebContentsDestroyed() { // The WebContents that started this has been destroyed. The request must be // cancelled and this object must be deleted. ubertoken_fetcher_.reset(); diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc index fd4573f..9b8f81b 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc @@ -72,31 +72,27 @@ class AutofillPopupControllerBrowserTest virtual ~AutofillPopupControllerBrowserTest() {} virtual void SetUpOnMainThread() OVERRIDE { - web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(web_contents_ != NULL); - Observe(web_contents_); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents != NULL); + Observe(web_contents); ContentAutofillDriver* driver = - ContentAutofillDriver::FromWebContents(web_contents_); + ContentAutofillDriver::FromWebContents(web_contents); autofill_external_delegate_.reset( new TestAutofillExternalDelegate( - web_contents_, + web_contents, driver->autofill_manager(), driver)); } // Normally the WebContents will automatically delete the delegate, but here // the delegate is owned by this test, so we have to manually destroy. - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE { - DCHECK_EQ(web_contents_, web_contents); - + virtual void WebContentsDestroyed() OVERRIDE { autofill_external_delegate_.reset(); } protected: - content::WebContents* web_contents_; - scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; }; diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc index 2b9fccc..0e1c45d 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc @@ -167,8 +167,7 @@ void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { dialog_controller_->Hide(); } -void TabAutofillManagerDelegate::WebContentsDestroyed( - content::WebContents* web_contents) { +void TabAutofillManagerDelegate::WebContentsDestroyed() { HideAutofillPopup(); } diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h index 3b3a3f0..6c48706 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h @@ -70,8 +70,7 @@ class TabAutofillManagerDelegate const base::string16& profile_full_name) OVERRIDE; // content::WebContentsObserver implementation. - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Exposed for testing. AutofillDialogController* GetDialogControllerForTesting() { diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc index 5b275b1..bc21ac4 100644 --- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc +++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc @@ -81,7 +81,7 @@ class CloseObserver : public content::WebContentsObserver { close_loop_.Run(); } - virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { close_loop_.Quit(); } diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 89015cb..96cf626 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -631,7 +631,7 @@ class RedirectObserver : public content::WebContentsObserver { params_ = params; } - virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { // Make sure we don't close the tab while the observer is in scope. // See http://crbug.com/314036. FAIL() << "WebContents closed during navigation (http://crbug.com/314036)."; diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 524e5b4..5035873 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -51,7 +51,7 @@ class WebContentsObserverBridge : public content::WebContentsObserver { virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE { [controller_ renderProcessGone]; } - virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { [controller_ renderProcessGone]; } diff --git a/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc b/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc index 9e5a44a..51a19b7 100644 --- a/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc +++ b/chrome/browser/ui/omnibox/omnibox_navigation_observer.cc @@ -108,8 +108,7 @@ void OmniboxNavigationObserver::NavigationEntryCommitted( OnAllLoadingFinished(); // deletes |this|! } -void OmniboxNavigationObserver::WebContentsDestroyed( - content::WebContents* web_contents) { +void OmniboxNavigationObserver::WebContentsDestroyed() { delete this; } diff --git a/chrome/browser/ui/omnibox/omnibox_navigation_observer.h b/chrome/browser/ui/omnibox/omnibox_navigation_observer.h index 8253173..0b80411 100644 --- a/chrome/browser/ui/omnibox/omnibox_navigation_observer.h +++ b/chrome/browser/ui/omnibox/omnibox_navigation_observer.h @@ -82,8 +82,7 @@ class OmniboxNavigationObserver : public content::NotificationObserver, content::NavigationController::ReloadType reload_type) OVERRIDE; virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // net::URLFetcherDelegate: virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_host.cc b/chrome/browser/ui/panels/panel_host.cc index 9d8bbd3..670ae73 100644 --- a/chrome/browser/ui/panels/panel_host.cc +++ b/chrome/browser/ui/panels/panel_host.cc @@ -208,7 +208,7 @@ void PanelHost::RenderProcessGone(base::TerminationStatus status) { CloseContents(web_contents_.get()); } -void PanelHost::WebContentsDestroyed(content::WebContents* web_contents) { +void PanelHost::WebContentsDestroyed() { // Web contents should only be destroyed by us. CHECK(!web_contents_.get()); diff --git a/chrome/browser/ui/panels/panel_host.h b/chrome/browser/ui/panels/panel_host.h index 217d228..3277c3b 100644 --- a/chrome/browser/ui/panels/panel_host.h +++ b/chrome/browser/ui/panels/panel_host.h @@ -80,8 +80,7 @@ class PanelHost : public content::WebContentsDelegate, virtual void RenderViewCreated( content::RenderViewHost* render_view_host) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // extensions::ExtensionFunctionDispatcher::Delegate overrides. diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc index 96e9e62..6eca416 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc @@ -19,12 +19,11 @@ using content::WebContents; ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( content::WebContents* web_contents) : content::WebContentsObserver(web_contents), - web_contents_(web_contents), display_disposition_( password_manager::metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING), dismissal_reason_(password_manager::metrics_util::NOT_DISPLAYED) { ManagePasswordsUIController* controller = - ManagePasswordsUIController::FromWebContents(web_contents_); + ManagePasswordsUIController::FromWebContents(web_contents); // TODO(mkwst): Reverse this logic. The controller should populate the model // directly rather than the model pulling from the controller. Perhaps like @@ -83,7 +82,7 @@ void ManagePasswordsBubbleModel::OnNopeClicked() { void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() { dismissal_reason_ = password_manager::metrics_util::CLICKED_NEVER; ManagePasswordsUIController* manage_passwords_ui_controller = - ManagePasswordsUIController::FromWebContents(web_contents_); + ManagePasswordsUIController::FromWebContents(web_contents()); manage_passwords_ui_controller->NeverSavePassword(); state_ = password_manager::ui::BLACKLIST_STATE; } @@ -91,7 +90,7 @@ void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() { void ManagePasswordsBubbleModel::OnUnblacklistClicked() { dismissal_reason_ = password_manager::metrics_util::CLICKED_UNBLACKLIST; ManagePasswordsUIController* manage_passwords_ui_controller = - ManagePasswordsUIController::FromWebContents(web_contents_); + ManagePasswordsUIController::FromWebContents(web_contents()); manage_passwords_ui_controller->UnblacklistSite(); state_ = password_manager::ui::MANAGE_STATE; } @@ -99,7 +98,7 @@ void ManagePasswordsBubbleModel::OnUnblacklistClicked() { void ManagePasswordsBubbleModel::OnSaveClicked() { dismissal_reason_ = password_manager::metrics_util::CLICKED_SAVE; ManagePasswordsUIController* manage_passwords_ui_controller = - ManagePasswordsUIController::FromWebContents(web_contents_); + ManagePasswordsUIController::FromWebContents(web_contents()); manage_passwords_ui_controller->SavePassword(); state_ = password_manager::ui::MANAGE_STATE; } @@ -110,17 +109,17 @@ void ManagePasswordsBubbleModel::OnDoneClicked() { void ManagePasswordsBubbleModel::OnManageLinkClicked() { dismissal_reason_ = password_manager::metrics_util::CLICKED_MANAGE; - ManagePasswordsUIController::FromWebContents(web_contents_) + ManagePasswordsUIController::FromWebContents(web_contents()) ->NavigateToPasswordManagerSettingsPage(); } void ManagePasswordsBubbleModel::OnPasswordAction( const autofill::PasswordForm& password_form, PasswordAction action) { - if (!web_contents_) + if (!web_contents()) return; Profile* profile = - Profile::FromBrowserContext(web_contents_->GetBrowserContext()); + Profile::FromBrowserContext(web_contents()->GetBrowserContext()); password_manager::PasswordStore* password_store = PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) .get(); @@ -130,9 +129,3 @@ void ManagePasswordsBubbleModel::OnPasswordAction( else password_store->AddLogin(password_form); } - -void ManagePasswordsBubbleModel::WebContentsDestroyed( - content::WebContents* web_contents) { - // The WebContents have been destroyed. - web_contents_ = NULL; -} diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h index 1fc6c68..e6ae6aa 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h @@ -89,11 +89,6 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { #endif private: - // content::WebContentsObserver - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; - - content::WebContents* web_contents_; password_manager::ui::State state_; base::string16 title_; autofill::PasswordForm pending_credentials_; diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index 3b192d9..00378fa 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc @@ -81,10 +81,9 @@ void ManagePasswordsUIController::OnBlacklistBlockedAutofill( UpdateBubbleAndIconVisibility(); } -void ManagePasswordsUIController::WebContentsDestroyed( - content::WebContents* web_contents) { +void ManagePasswordsUIController::WebContentsDestroyed() { password_manager::PasswordStore* password_store = - GetPasswordStore(web_contents); + GetPasswordStore(web_contents()); if (password_store) password_store->RemoveObserver(this); } diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h index 35977d4..eed1a64 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h @@ -115,8 +115,7 @@ class ManagePasswordsUIController virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Set by OnPasswordSubmitted() when the user submits a form containing login // information. If the user responds to a subsequent "Do you want to save diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index fceb3e6..7e4fdfe 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -426,7 +426,7 @@ class CurrentHistoryCleaner : public content::WebContentsObserver { virtual ~CurrentHistoryCleaner(); // content::WebContentsObserver: - virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void DidCommitProvisionalLoadForFrame( int64 frame_id, const base::string16& frame_unique_name, @@ -479,8 +479,7 @@ void CurrentHistoryCleaner::DidCommitProvisionalLoadForFrame( } } -void CurrentHistoryCleaner::WebContentsDestroyed( - content::WebContents* contents) { +void CurrentHistoryCleaner::WebContentsDestroyed() { delete this; // Failure. } diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc index 376baeb..96c45c5 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc @@ -51,9 +51,8 @@ OneClickSigninSyncObserver::OneClickSigninSyncObserver( OneClickSigninSyncObserver::~OneClickSigninSyncObserver() {} -void OneClickSigninSyncObserver::WebContentsDestroyed( - content::WebContents* web_contents) { - ProfileSyncService* sync_service = GetSyncService(web_contents); +void OneClickSigninSyncObserver::WebContentsDestroyed() { + ProfileSyncService* sync_service = GetSyncService(web_contents()); if (sync_service) sync_service->RemoveObserver(this); diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer.h b/chrome/browser/ui/sync/one_click_signin_sync_observer.h index 7d53a77..23dca83 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_observer.h +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer.h @@ -31,7 +31,7 @@ class OneClickSigninSyncObserver : public content::WebContentsObserver, private: // content::WebContentsObserver: - virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // ProfileSyncServiceObserver: virtual void OnStateChanged() OVERRIDE; diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc index 99f93b2..d30bbaf 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.cc +++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc @@ -150,7 +150,7 @@ void CoreTabHelper::WasShown() { web_contents()->GetRenderProcessHost()->GetID()); } -void CoreTabHelper::WebContentsDestroyed(WebContents* web_contents) { +void CoreTabHelper::WebContentsDestroyed() { // OnCloseStarted isn't called in unit tests. if (!close_start_time_.is_null()) { bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h index a5ca820..e01482b 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.h +++ b/chrome/browser/ui/tab_contents/core_tab_helper.h @@ -59,8 +59,7 @@ class CoreTabHelper : public content::WebContentsObserver, virtual void DidStartLoading( content::RenderViewHost* render_view_host) OVERRIDE; virtual void WasShown() OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) OVERRIDE; virtual void BeforeUnloadDialogCancelled() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index 06ac829..098d89d 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc @@ -73,7 +73,7 @@ class CloseTracker { private: // WebContentsObserver: - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { parent_->OnWebContentsDestroyed(this); } @@ -161,7 +161,7 @@ class TabStripModel::WebContentsData : public content::WebContentsObserver { private: // Make sure that if someone deletes this WebContents out from under us, it // is properly removed from the tab strip. - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // The WebContents being tracked by this WebContentsData. The // WebContentsObserver does keep a reference, but when the WebContents is @@ -224,13 +224,12 @@ void TabStripModel::WebContentsData::SetWebContents(WebContents* contents) { Observe(contents); } -void TabStripModel::WebContentsData::WebContentsDestroyed( - WebContents* web_contents) { - DCHECK_EQ(contents_, web_contents); +void TabStripModel::WebContentsData::WebContentsDestroyed() { + DCHECK_EQ(contents_, web_contents()); // Note that we only detach the contents here, not close it - it's // already been closed. We just want to undo our bookkeeping. - int index = tab_strip_model_->GetIndexOfWebContents(web_contents); + int index = tab_strip_model_->GetIndexOfWebContents(web_contents()); DCHECK_NE(TabStripModel::kNoTab, index); tab_strip_model_->DetachWebContentsAt(index); } diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index 4c43196..1bbfaea 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -58,7 +58,7 @@ class DeleteWebContentsOnDestroyedObserver tab_strip_(tab_strip) { } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { WebContents* tab_to_delete = tab_to_delete_; tab_to_delete_ = NULL; TabStripModel* tab_strip_to_delete = tab_strip_; diff --git a/chrome/browser/ui/views/frame/browser_view_browsertest.cc b/chrome/browser/ui/views/frame/browser_view_browsertest.cc index 236e774..e573e1b 100644 --- a/chrome/browser/ui/views/frame/browser_view_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_view_browsertest.cc @@ -26,8 +26,7 @@ class TestWebContentsObserver : public content::WebContentsObserver { other_(other) {} virtual ~TestWebContentsObserver() {} - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { other_->NotifyNavigationStateChanged( content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD); } diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index bb9b873..5f3242a 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -155,8 +155,7 @@ void HungPagesTableModel::WebContentsObserverImpl::RenderProcessGone( model_->TabDestroyed(this); } -void HungPagesTableModel::WebContentsObserverImpl::WebContentsDestroyed( - WebContents* tab) { +void HungPagesTableModel::WebContentsObserverImpl::WebContentsDestroyed() { model_->TabDestroyed(this); } diff --git a/chrome/browser/ui/views/hung_renderer_view.h b/chrome/browser/ui/views/hung_renderer_view.h index 2f4c945..2f661af 100644 --- a/chrome/browser/ui/views/hung_renderer_view.h +++ b/chrome/browser/ui/views/hung_renderer_view.h @@ -75,7 +75,7 @@ class HungPagesTableModel : public ui::TableModel, public views::TableGrouper { // WebContentsObserver overrides: virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: HungPagesTableModel* model_; diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.cc b/chrome/browser/ui/views/translate/translate_bubble_view.cc index ba6c6bd..2608055 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_view.cc @@ -261,8 +261,7 @@ void TranslateBubbleView::LinkClicked(views::Link* source, int event_flags) { HandleLinkClicked(static_cast<LinkID>(source->id())); } -void TranslateBubbleView::WebContentsDestroyed( - content::WebContents* web_contents) { +void TranslateBubbleView::WebContentsDestroyed() { GetWidget()->CloseNow(); } diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.h b/chrome/browser/ui/views/translate/translate_bubble_view.h index 39d066b..91b38a37 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.h +++ b/chrome/browser/ui/views/translate/translate_bubble_view.h @@ -70,8 +70,7 @@ class TranslateBubbleView : public views::BubbleDelegateView, virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; // content::WebContentsObserver method. - virtual void WebContentsDestroyed(content::WebContents* web_contents) - OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // Returns the current view state. TranslateBubbleModel::ViewState GetViewState() const; diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.cc b/chrome/browser/ui/website_settings/permission_bubble_manager.cc index 9eec3bb..8816cee 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.cc +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.cc @@ -234,8 +234,7 @@ void PermissionBubbleManager::NavigationEntryCommitted( } } -void PermissionBubbleManager::WebContentsDestroyed( - content::WebContents* web_contents) { +void PermissionBubbleManager::WebContentsDestroyed() { // If the web contents has been destroyed, treat the bubble as cancelled. CancelPendingQueue(); FinalizeBubble(); @@ -243,7 +242,7 @@ void PermissionBubbleManager::WebContentsDestroyed( // The WebContents is going away; be aggressively paranoid and delete // ourselves lest other parts of the system attempt to add permission bubbles // or use us otherwise during the destruction. - web_contents->RemoveUserData(UserDataKey()); + web_contents()->RemoveUserData(UserDataKey()); // That was the equivalent of "delete this". This object is now destroyed; // returning from this function is the only safe thing to do. } diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h index 767037e..2e0eafc 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.h +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h @@ -74,8 +74,7 @@ class PermissionBubbleManager // they will be finalized as if canceled by the user. virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& details) OVERRIDE; - virtual void WebContentsDestroyed( - content::WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // PermissionBubbleView::Delegate: virtual void ToggleAccept(int request_index, bool new_value) OVERRIDE; diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc index 9890575..ba8e0e5 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc @@ -33,7 +33,7 @@ class ConstrainedWebDialogBrowserTestObserver bool contents_destroyed() { return contents_destroyed_; } private: - virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { contents_destroyed_ = true; } diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index a837bcc..7ae8a2d 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -187,7 +187,7 @@ void WebContentsModalDialogManager::WasHidden() { child_dialogs_.front()->manager->Hide(); } -void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) { +void WebContentsModalDialogManager::WebContentsDestroyed() { // First cleanly close all child dialogs. // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked // some of these to close. CloseAllDialogs is async, so it might get called diff --git a/components/web_modal/web_contents_modal_dialog_manager.h b/components/web_modal/web_contents_modal_dialog_manager.h index fd2d925..326b4c1 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.h +++ b/components/web_modal/web_contents_modal_dialog_manager.h @@ -110,7 +110,7 @@ class WebContentsModalDialogManager virtual void DidGetIgnoredUIEvent() OVERRIDE; virtual void WasShown() OVERRIDE; virtual void WasHidden() OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void DidAttachInterstitialPage() OVERRIDE; // Delegate for notifying our owner about stuff. Not owned by us. diff --git a/content/browser/android/content_settings.cc b/content/browser/android/content_settings.cc index 7c6407f..a83169c 100644 --- a/content/browser/android/content_settings.cc +++ b/content/browser/android/content_settings.cc @@ -42,7 +42,7 @@ bool ContentSettings::GetJavaScriptEnabled(JNIEnv* env, jobject obj) { return render_view_host->GetDelegate()->GetWebkitPrefs().javascript_enabled; } -void ContentSettings::WebContentsDestroyed(WebContents* web_contents) { +void ContentSettings::WebContentsDestroyed() { delete this; } diff --git a/content/browser/android/content_settings.h b/content/browser/android/content_settings.h index df75727..0728a6a 100644 --- a/content/browser/android/content_settings.h +++ b/content/browser/android/content_settings.h @@ -26,7 +26,7 @@ class ContentSettings : public WebContentsObserver { virtual ~ContentSettings(); // WebContentsObserver overrides: - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // The Java counterpart to this class. JavaObjectWeakGlobalRef content_settings_; diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index 49fe629..85cd4fa 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc @@ -1676,9 +1676,9 @@ void ContentViewCoreImpl::OnSmartClipDataExtracted( env, obj.obj(), jresult.obj()); } -void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { +void ContentViewCoreImpl::WebContentsDestroyed() { WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( - static_cast<WebContentsImpl*>(web_contents)->GetView()); + static_cast<WebContentsImpl*>(web_contents())->GetView()); DCHECK(wcva); wcva->SetContentViewCore(NULL); } diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h index 9f23c8e..a00b67f 100644 --- a/content/browser/android/content_view_core_impl.h +++ b/content/browser/android/content_view_core_impl.h @@ -319,7 +319,7 @@ class ContentViewCoreImpl : public ContentViewCore, // WebContentsObserver implementation. virtual void RenderViewReady() OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // -------------------------------------------------------------------------- // Other private methods and data diff --git a/content/browser/android/web_contents_observer_android.cc b/content/browser/android/web_contents_observer_android.cc index db50efc..72b2241 100644 --- a/content/browser/android/web_contents_observer_android.cc +++ b/content/browser/android/web_contents_observer_android.cc @@ -48,8 +48,7 @@ void WebContentsObserverAndroid::Destroy(JNIEnv* env, jobject obj) { delete this; } -void WebContentsObserverAndroid::WebContentsDestroyed( - WebContents* web_contents) { +void WebContentsObserverAndroid::WebContentsDestroyed() { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj(weak_java_observer_.get(env)); if (obj.is_null()) { diff --git a/content/browser/android/web_contents_observer_android.h b/content/browser/android/web_contents_observer_android.h index 0a4f874b..319436c 100644 --- a/content/browser/android/web_contents_observer_android.h +++ b/content/browser/android/web_contents_observer_android.h @@ -76,7 +76,7 @@ class WebContentsObserverAndroid : public WebContentsObserver { RenderViewHost* render_view_host) OVERRIDE; virtual void NavigationEntryCommitted( const LoadCommittedDetails& load_details) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void DidChangeVisibleSSLState() OVERRIDE; virtual void DidAttachInterstitialPage() OVERRIDE; virtual void DidDetachInterstitialPage() OVERRIDE; diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 6f6d975..01060f5 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -177,7 +177,7 @@ class BrowserPluginGuest::EmbedderWebContentsObserver } // WebContentsObserver: - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { browser_plugin_guest_->EmbedderDestroyed(); } diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc index 184a561..975e7d6 100644 --- a/content/browser/frame_host/interstitial_page_impl.cc +++ b/content/browser/frame_host/interstitial_page_impl.cc @@ -356,18 +356,7 @@ void InterstitialPageImpl::NavigationEntryCommitted( OnNavigatingAwayOrTabClosing(); } -void InterstitialPageImpl::WebContentsWillBeDestroyed() { - OnNavigatingAwayOrTabClosing(); -} - -void InterstitialPageImpl::WebContentsDestroyed(WebContents* web_contents) { - // WebContentsImpl will only call WebContentsWillBeDestroyed for interstitial - // pages that it knows about, pages that called - // WebContentsImpl::AttachInterstitialPage. But it's possible to have an - // interstitial page that never progressed that far. In that case, ensure that - // this interstitial page is destroyed. (And if it was attached, and - // OnNavigatingAwayOrTabClosing was called, it's safe to call - // OnNavigatingAwayOrTabClosing twice.) +void InterstitialPageImpl::WebContentsDestroyed() { OnNavigatingAwayOrTabClosing(); } diff --git a/content/browser/frame_host/interstitial_page_impl.h b/content/browser/frame_host/interstitial_page_impl.h index 8cb1419..fe9eee4 100644 --- a/content/browser/frame_host/interstitial_page_impl.h +++ b/content/browser/frame_host/interstitial_page_impl.h @@ -68,10 +68,6 @@ class CONTENT_EXPORT InterstitialPageImpl virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual void Focus() OVERRIDE; - // This is called by a hosting WebContents to notify this interstitial page - // that it is going away. - void WebContentsWillBeDestroyed(); - // Allows the user to navigate away by disabling the interstitial, canceling // the pending request, and unblocking the hidden renderer. The interstitial // will stay visible until the navigation completes. @@ -109,7 +105,7 @@ class CONTENT_EXPORT InterstitialPageImpl // WebContentsObserver implementation: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; virtual void NavigationEntryCommitted( const LoadCommittedDetails& load_details) OVERRIDE; diff --git a/content/browser/media/capture/web_contents_tracker.cc b/content/browser/media/capture/web_contents_tracker.cc index 0251c64..0765331 100644 --- a/content/browser/media/capture/web_contents_tracker.cc +++ b/content/browser/media/capture/web_contents_tracker.cc @@ -95,7 +95,7 @@ void WebContentsTracker::DidNavigateMainFrame( OnWebContentsChangeEvent(); } -void WebContentsTracker::WebContentsDestroyed(WebContents* web_contents) { +void WebContentsTracker::WebContentsDestroyed() { OnWebContentsChangeEvent(); } diff --git a/content/browser/media/capture/web_contents_tracker.h b/content/browser/media/capture/web_contents_tracker.h index 0c77761..f8957f3 100644 --- a/content/browser/media/capture/web_contents_tracker.h +++ b/content/browser/media/capture/web_contents_tracker.h @@ -73,7 +73,7 @@ class CONTENT_EXPORT WebContentsTracker OVERRIDE; virtual void DidNavigateMainFrame(const LoadCommittedDetails& details, const FrameNavigateParams& params) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; scoped_refptr<base::MessageLoopProxy> message_loop_; ChangeCallback callback_; diff --git a/content/browser/media/capture/web_contents_video_capture_device.cc b/content/browser/media/capture/web_contents_video_capture_device.cc index 2e2527a..0e5347c 100644 --- a/content/browser/media/capture/web_contents_video_capture_device.cc +++ b/content/browser/media/capture/web_contents_video_capture_device.cc @@ -269,7 +269,7 @@ class WebContentsCaptureMachine RenewFrameSubscription(); } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: // Starts observing the web contents, returning false if lookup fails. @@ -702,12 +702,11 @@ bool WebContentsCaptureMachine::StartObservingWebContents() { return false; } -void WebContentsCaptureMachine::WebContentsDestroyed( - WebContents* web_contents) { +void WebContentsCaptureMachine::WebContentsDestroyed() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); subscription_.reset(); - web_contents->DecrementCapturerCount(); + web_contents()->DecrementCapturerCount(); oracle_proxy_->ReportError("WebContentsDestroyed()"); } diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index c1b9be8..0f3ea7a 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -289,8 +289,9 @@ class WebContentsImpl::DestructionObserver : public WebContentsObserver { } // WebContentsObserver: - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { - owner_->OnWebContentsDestroyed(static_cast<WebContentsImpl*>(web_contents)); + virtual void WebContentsDestroyed() OVERRIDE { + owner_->OnWebContentsDestroyed( + static_cast<WebContentsImpl*>(web_contents())); } private: @@ -363,14 +364,6 @@ WebContentsImpl::WebContentsImpl( WebContentsImpl::~WebContentsImpl() { is_being_destroyed_ = true; - // If there is an interstitial page being shown, tell it to close down early - // so that this contents will be alive enough to handle all the UI triggered - // by that. <http://crbug.com/363564> - InterstitialPageImpl* interstitial_page = - static_cast<InterstitialPageImpl*>(GetInterstitialPage()); - if (interstitial_page) - interstitial_page->WebContentsWillBeDestroyed(); - // Delete all RFH pending shutdown, which will lead the corresponding RVH to // shutdown and be deleted as well. frame_tree_.ForEach( @@ -419,7 +412,11 @@ WebContentsImpl::~WebContentsImpl() { FOR_EACH_OBSERVER(WebContentsObserver, observers_, - WebContentsImplDestroyed()); + WebContentsDestroyed()); + + FOR_EACH_OBSERVER(WebContentsObserver, + observers_, + ResetWebContents()); SetDelegate(NULL); diff --git a/content/public/browser/web_contents_observer.cc b/content/public/browser/web_contents_observer.cc index fc0fcf2..a5700a7 100644 --- a/content/public/browser/web_contents_observer.cc +++ b/content/public/browser/web_contents_observer.cc @@ -61,12 +61,9 @@ int WebContentsObserver::routing_id() const { return web_contents_->GetRoutingID(); } -void WebContentsObserver::WebContentsImplDestroyed() { - // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. +void WebContentsObserver::ResetWebContents() { web_contents_->RemoveObserver(this); - WebContentsImpl* contents = web_contents_; web_contents_ = NULL; - WebContentsDestroyed(contents); } } // namespace content diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index e0ee3b9..23fe1b9 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -293,9 +293,9 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, WebContents* new_web_contents) {} // Invoked when the WebContents is being destroyed. Gives subclasses a chance - // to cleanup. At the time this is invoked |web_contents()| returns NULL. - // It is safe to delete 'this' from here. - virtual void WebContentsDestroyed(WebContents* web_contents) {} + // to cleanup. After the whole loop over all WebContentsObservers has been + // finished, web_contents() returns NULL. + virtual void WebContentsDestroyed() {} // Called when the user agent override for a WebContents has been changed. virtual void UserAgentOverrideSet(const std::string& user_agent) {} @@ -358,9 +358,7 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, private: friend class WebContentsImpl; - // Invoked from WebContentsImpl. Invokes WebContentsDestroyed and NULL out - // |web_contents_|. - void WebContentsImplDestroyed(); + void ResetWebContents(); WebContentsImpl* web_contents_; diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 21f48a8..60b2b0e 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -598,8 +598,7 @@ void WebContentsDestroyedWatcher::Wait() { message_loop_runner_->Run(); } -void WebContentsDestroyedWatcher::WebContentsDestroyed( - WebContents* web_contents) { +void WebContentsDestroyedWatcher::WebContentsDestroyed() { message_loop_runner_->Quit(); } diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index 63d68bd..85a81e3 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h @@ -223,7 +223,7 @@ class WebContentsDestroyedWatcher : public WebContentsObserver { private: // Overridden WebContentsObserver methods. - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; scoped_refptr<MessageLoopRunner> message_loop_runner_; diff --git a/content/public/test/test_navigation_observer.cc b/content/public/test/test_navigation_observer.cc index cad43a8..bfe74f6 100644 --- a/content/public/test/test_navigation_observer.cc +++ b/content/public/test/test_navigation_observer.cc @@ -34,8 +34,8 @@ class TestNavigationObserver::TestWebContentsObserver parent_->OnDidAttachInterstitialPage(web_contents()); } - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { - parent_->OnWebContentsDestroyed(this, web_contents); + virtual void WebContentsDestroyed() OVERRIDE { + parent_->OnWebContentsDestroyed(this, web_contents()); } virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE { diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index 9fbd5cf..c63ff15 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc @@ -46,7 +46,7 @@ class Shell::DevToolsWebContentsObserver : public WebContentsObserver { } // WebContentsObserver - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { shell_->OnDevToolsWebContentsDestroyed(); } diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc index 92bdc9a..21973f4 100644 --- a/content/shell/browser/shell_devtools_frontend.cc +++ b/content/shell/browser/shell_devtools_frontend.cc @@ -126,7 +126,7 @@ void ShellDevToolsFrontend::DocumentOnLoadCompletedInMainFrame() { base::ASCIIToUTF16("InspectorFrontendAPI.setUseSoftMenu(true);")); } -void ShellDevToolsFrontend::WebContentsDestroyed(WebContents* web_contents) { +void ShellDevToolsFrontend::WebContentsDestroyed() { DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_.get()); delete this; } diff --git a/content/shell/browser/shell_devtools_frontend.h b/content/shell/browser/shell_devtools_frontend.h index 8aac26a..d9591c7 100644 --- a/content/shell/browser/shell_devtools_frontend.h +++ b/content/shell/browser/shell_devtools_frontend.h @@ -44,7 +44,7 @@ class ShellDevToolsFrontend : public WebContentsObserver, // WebContentsObserver overrides virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // DevToolsFrontendHostDelegate implementation virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE {} diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc index 3256b20..fa56d01 100644 --- a/content/shell/browser/webkit_test_controller.cc +++ b/content/shell/browser/webkit_test_controller.cc @@ -421,7 +421,7 @@ void WebKitTestController::RenderProcessGone(base::TerminationStatus status) { DiscardMainWindow(); } -void WebKitTestController::WebContentsDestroyed(WebContents* web_contents) { +void WebKitTestController::WebContentsDestroyed() { DCHECK(CalledOnValidThread()); printer_->AddErrorMessage("FAIL: main window was destroyed"); DiscardMainWindow(); diff --git a/content/shell/browser/webkit_test_controller.h b/content/shell/browser/webkit_test_controller.h index f9a7dbd..2e5cf58 100644 --- a/content/shell/browser/webkit_test_controller.h +++ b/content/shell/browser/webkit_test_controller.h @@ -135,7 +135,7 @@ class WebKitTestController : public base::NonThreadSafe, base::ProcessId plugin_pid) OVERRIDE; virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; // NotificationObserver implementation. virtual void Observe(int type, diff --git a/ui/keyboard/keyboard_controller_proxy.cc b/ui/keyboard/keyboard_controller_proxy.cc index 4a0dd4f..2ade09d 100644 --- a/ui/keyboard/keyboard_controller_proxy.cc +++ b/ui/keyboard/keyboard_controller_proxy.cc @@ -68,7 +68,7 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate, } // Overridden from content::WebContentsObserver: - virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { + virtual void WebContentsDestroyed() OVERRIDE { delete this; } |