diff options
112 files changed, 447 insertions, 590 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index 964697c..9aaaaba 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -108,7 +108,7 @@ bool IsTextField(const FormField& field) { AutocompleteHistoryManager::AutocompleteHistoryManager( TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), pending_query_handle_(0), query_id_(0), external_delegate_(NULL) { @@ -235,7 +235,7 @@ AutocompleteHistoryManager::AutocompleteHistoryManager( TabContents* tab_contents, Profile* profile, WebDataService* wds) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), profile_(profile), web_data_service_(wds), pending_query_handle_(0), diff --git a/chrome/browser/autocomplete_history_manager.h b/chrome/browser/autocomplete_history_manager.h index dafe49a..8f5eabc 100644 --- a/chrome/browser/autocomplete_history_manager.h +++ b/chrome/browser/autocomplete_history_manager.h @@ -11,7 +11,7 @@ #include "base/gtest_prod_util.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/webdata/web_data_service.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" namespace webkit { namespace forms { @@ -21,17 +21,16 @@ struct FormData; class AutofillExternalDelegate; class Profile; -class TabContents; // Per-tab Autocomplete history manager. Handles receiving form data from the // renderer and the storing and retrieving of form data through WebDataService. -class AutocompleteHistoryManager : public TabContentsObserver, +class AutocompleteHistoryManager : public content::WebContentsObserver, public WebDataServiceConsumer { public: explicit AutocompleteHistoryManager(TabContents* tab_contents); virtual ~AutocompleteHistoryManager(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // WebDataServiceConsumer implementation. diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index a6108a7..f163f10 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -245,7 +245,7 @@ void CheckForPopularForms(const std::vector<FormStructure*>& forms, } // namespace AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) - : TabContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->tab_contents()), tab_contents_wrapper_(tab_contents), personal_data_(NULL), download_manager_(tab_contents->profile(), this), @@ -802,7 +802,7 @@ void AutofillManager::Reset() { AutofillManager::AutofillManager(TabContentsWrapper* tab_contents, PersonalDataManager* personal_data) - : TabContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->tab_contents()), tab_contents_wrapper_(tab_contents), personal_data_(personal_data), download_manager_(tab_contents->profile(), this), diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 7460232..9079d09 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -22,7 +22,7 @@ #include "chrome/browser/autofill/autofill_download.h" #include "chrome/browser/autofill/field_types.h" #include "chrome/browser/autofill/form_structure.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class AutofillExternalDelegate; class AutofillField; @@ -53,7 +53,7 @@ struct FormField; // Manages saving and restoring the user's personal information entered into web // forms. -class AutofillManager : public TabContentsObserver, +class AutofillManager : public content::WebContentsObserver, public AutofillDownloadManager::Observer, public base::RefCounted<AutofillManager> { public: @@ -136,7 +136,7 @@ class AutofillManager : public TabContentsObserver, const base::TimeTicks& timestamp); private: - // TabContentsObserver: + // content::WebContentsObserver: virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/automation/automation_tab_helper.cc b/chrome/browser/automation/automation_tab_helper.cc index 30d203b..f951fde 100644 --- a/chrome/browser/automation/automation_tab_helper.cc +++ b/chrome/browser/automation/automation_tab_helper.cc @@ -37,7 +37,7 @@ void TabEventObserver::StopObserving(AutomationTabHelper* tab_helper) { } AutomationTabHelper::AutomationTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), is_loading_(false) { } diff --git a/chrome/browser/automation/automation_tab_helper.h b/chrome/browser/automation/automation_tab_helper.h index ae764ba..1c80792 100644 --- a/chrome/browser/automation/automation_tab_helper.h +++ b/chrome/browser/automation/automation_tab_helper.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/observer_list.h" #include "base/memory/weak_ptr.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class TabContents; class AutomationTabHelper; @@ -81,7 +81,7 @@ class TabEventObserver { // Per-tab automation support class. Receives automation/testing messages // from the renderer. Broadcasts tab events to |TabEventObserver|s. class AutomationTabHelper - : public TabContentsObserver, + : public content::WebContentsObserver, public base::SupportsWeakPtr<AutomationTabHelper> { public: explicit AutomationTabHelper(TabContents* tab_contents); @@ -105,7 +105,7 @@ class AutomationTabHelper const std::vector<unsigned char>& png_data, const std::string& error_msg); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void DidStartLoading() OVERRIDE; virtual void DidStopLoading() OVERRIDE; virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index b431641..8e0039a 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -49,7 +49,7 @@ bool TabSpecificContentSettings::LocalSharedObjectsContainer::empty() const { } TabSpecificContentSettings::TabSpecificContentSettings(TabContents* tab) - : TabContentsObserver(tab), + : content::WebContentsObserver(tab), profile_(Profile::FromBrowserContext(tab->GetBrowserContext())), allowed_local_shared_objects_(profile_), blocked_local_shared_objects_(profile_), diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h index 6db09b64a..507adbb 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.h +++ b/chrome/browser/content_settings/tab_specific_content_settings.h @@ -15,9 +15,9 @@ #include "chrome/browser/geolocation/geolocation_settings_state.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_types.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class CannedBrowsingDataAppCacheHelper; class CannedBrowsingDataCookieHelper; @@ -34,7 +34,7 @@ class CookieList; class CookieOptions; } -class TabSpecificContentSettings : public TabContentsObserver, +class TabSpecificContentSettings : public content::WebContentsObserver, public content::NotificationObserver { public: explicit TabSpecificContentSettings(TabContents* tab); @@ -157,7 +157,7 @@ class TabSpecificContentSettings : public TabContentsObserver, load_plugins_link_enabled_ = enabled; } - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, diff --git a/chrome/browser/download/download_request_limiter_observer.cc b/chrome/browser/download/download_request_limiter_observer.cc index 94fde71..1242282 100644 --- a/chrome/browser/download/download_request_limiter_observer.cc +++ b/chrome/browser/download/download_request_limiter_observer.cc @@ -9,7 +9,7 @@ DownloadRequestLimiterObserver::DownloadRequestLimiterObserver( TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { } DownloadRequestLimiterObserver::~DownloadRequestLimiterObserver() { diff --git a/chrome/browser/download/download_request_limiter_observer.h b/chrome/browser/download/download_request_limiter_observer.h index d5d6135..004c1c3 100644 --- a/chrome/browser/download/download_request_limiter_observer.h +++ b/chrome/browser/download/download_request_limiter_observer.h @@ -5,17 +5,15 @@ #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_OBSERVER_H_ #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_OBSERVER_H_ -#include "content/browser/tab_contents/tab_contents_observer.h" - -class TabContents; +#include "content/public/browser/web_contents_observer.h" // Watches for user gesture notifications. -class DownloadRequestLimiterObserver : public TabContentsObserver { +class DownloadRequestLimiterObserver : public content::WebContentsObserver { public: explicit DownloadRequestLimiterObserver(TabContents* tab_contents); virtual ~DownloadRequestLimiterObserver(); - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidGetUserGesture() OVERRIDE; private: diff --git a/chrome/browser/extensions/execute_code_in_tab_function.h b/chrome/browser/extensions/execute_code_in_tab_function.h index 5afc85c..fb36fa9 100644 --- a/chrome/browser/extensions/execute_code_in_tab_function.h +++ b/chrome/browser/extensions/execute_code_in_tab_function.h @@ -10,11 +10,11 @@ #include "chrome/browser/extensions/extension_function.h" #include "chrome/common/extensions/extension_resource.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" // Implement API call tabs.executeScript and tabs.insertCSS. class ExecuteCodeInTabFunction : public AsyncExtensionFunction, - public TabContentsObserver { + public content::WebContentsObserver { public: ExecuteCodeInTabFunction(); virtual ~ExecuteCodeInTabFunction(); @@ -22,7 +22,7 @@ class ExecuteCodeInTabFunction : public AsyncExtensionFunction, private: virtual bool RunImpl() OVERRIDE; - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Message handler. diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index a282b6e..84ae278 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -131,7 +131,7 @@ ExtensionHost::ExtensionHost(const Extension* extension, associated_tab_contents_(NULL) { host_contents_.reset(new TabContents( profile_, site_instance, MSG_ROUTING_NONE, NULL, NULL)); - TabContentsObserver::Observe(host_contents_.get()); + content::WebContentsObserver::Observe(host_contents_.get()); host_contents_->SetDelegate(this); host_contents_->SetViewType(host_type); diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 67fda94..b5b45c8 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -13,10 +13,10 @@ #include "base/perftimer.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "content/browser/javascript_dialogs.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/common/view_type.h" #if defined(TOOLKIT_VIEWS) @@ -31,7 +31,6 @@ class Browser; class Extension; class PrefsTabHelper; class RenderWidgetHostView; -class TabContents; struct WebPreferences; namespace content { @@ -43,7 +42,7 @@ class RenderProcessHost; // privileges available to extensions. It may have a view to be shown in the // browser UI, or it may be hidden. class ExtensionHost : public content::WebContentsDelegate, - public TabContentsObserver, + public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate, public content::NotificationObserver { public: @@ -107,7 +106,7 @@ class ExtensionHost : public content::WebContentsDelegate, // |size_limit| in both width and height. void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); - // TabContentsObserver + // content::WebContentsObserver virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; diff --git a/chrome/browser/extensions/extension_page_capture_api.h b/chrome/browser/extensions/extension_page_capture_api.h index 00fde76..ee23d98 100644 --- a/chrome/browser/extensions/extension_page_capture_api.h +++ b/chrome/browser/extensions/extension_page_capture_api.h @@ -9,10 +9,10 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/extensions/extension_function.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "webkit/blob/deletable_file_reference.h" class FilePath; +class TabContents; class PageCaptureSaveAsMHTMLFunction : public AsyncExtensionFunction { public: diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 24632d8..5d9ca1d 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -24,7 +24,7 @@ #include "content/public/browser/notification_service.h" ExtensionTabHelper::ExtensionTabHelper(TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), delegate_(NULL), extension_app_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST( diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h index bacaacd..869034e 100644 --- a/chrome/browser/extensions/extension_tab_helper.h +++ b/chrome/browser/extensions/extension_tab_helper.h @@ -12,7 +12,7 @@ #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/extensions/webstore_inline_installer.h" #include "chrome/common/web_apps.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "third_party/skia/include/core/SkBitmap.h" class Extension; @@ -26,7 +26,7 @@ struct LoadCommittedDetails; // Per-tab extension helper. Also handles non-extension apps. class ExtensionTabHelper - : public TabContentsObserver, + : public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate, public ImageLoadingTracker::Observer, public WebstoreInlineInstaller::Delegate, @@ -84,7 +84,7 @@ class ExtensionTabHelper } TabContents* tab_contents() const { - return TabContentsObserver::tab_contents(); + return content::WebContentsObserver::tab_contents(); } // Sets a non-extension app icon associated with TabContents and fires an @@ -92,7 +92,7 @@ class ExtensionTabHelper void SetAppIcon(const SkBitmap& app_icon); private: - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/extensions/extension_tabs_module.h b/chrome/browser/extensions/extension_tabs_module.h index 6164752..944de1c 100644 --- a/chrome/browser/extensions/extension_tabs_module.h +++ b/chrome/browser/extensions/extension_tabs_module.h @@ -11,9 +11,9 @@ #include "base/compiler_specific.h" #include "chrome/browser/extensions/extension_function.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" class BackingStore; @@ -106,7 +106,7 @@ class HighlightTabsFunction : public SyncExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight") }; class UpdateTabFunction : public AsyncExtensionFunction, - public TabContentsObserver { + public content::WebContentsObserver { public: UpdateTabFunction(); private: diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index f3f8dde..4644376 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -481,7 +481,7 @@ void ExtensionWebNavigationEventRouter::TabDestroyed( ExtensionWebNavigationTabObserver::ExtensionWebNavigationTabObserver( TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { g_tab_observer.Get().insert(TabObserverMap::value_type(tab_contents, this)); } diff --git a/chrome/browser/extensions/extension_webnavigation_api.h b/chrome/browser/extensions/extension_webnavigation_api.h index d3a25be..43953c5 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.h +++ b/chrome/browser/extensions/extension_webnavigation_api.h @@ -15,9 +15,9 @@ #include "base/compiler_specific.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/profiles/profile.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" struct RetargetingDetails; @@ -115,7 +115,7 @@ class FrameNavigationState { }; // Tab contents observer that forwards navigation events to the event router. -class ExtensionWebNavigationTabObserver : public TabContentsObserver { +class ExtensionWebNavigationTabObserver : public content::WebContentsObserver { public: explicit ExtensionWebNavigationTabObserver(TabContents* tab_contents); virtual ~ExtensionWebNavigationTabObserver(); @@ -127,7 +127,7 @@ class ExtensionWebNavigationTabObserver : public TabContentsObserver { return navigation_state_; } - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void DidStartProvisionalLoadForFrame( int64 frame_id, bool is_main_frame, diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 8c5a678..5fdc9ab 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -149,7 +149,7 @@ WebstoreInlineInstaller::WebstoreInlineInstaller(TabContents* tab_contents, std::string webstore_item_id, GURL requestor_url, Delegate* delegate) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), install_id_(install_id), id_(webstore_item_id), requestor_url_(requestor_url), diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h index b369716..c7c0595 100644 --- a/chrome/browser/extensions/webstore_inline_installer.h +++ b/chrome/browser/extensions/webstore_inline_installer.h @@ -14,7 +14,7 @@ #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/browser/extensions/webstore_installer.h" #include "chrome/browser/extensions/webstore_install_helper.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/common/url_fetcher_delegate.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -31,7 +31,7 @@ class SafeWebstoreResponseParser; class WebstoreInlineInstaller : public base::RefCountedThreadSafe<WebstoreInlineInstaller>, public ExtensionInstallUI::Delegate, - public TabContentsObserver, + public content::WebContentsObserver, public content::URLFetcherDelegate, public WebstoreInstaller::Delegate, public WebstoreInstallHelper::Delegate { @@ -90,7 +90,7 @@ class WebstoreInlineInstaller virtual void InstallUIProceed() OVERRIDE; virtual void InstallUIAbort(bool user_initiated) OVERRIDE; - // TabContentsObserver interface implementation. + // content::WebContentsObserver interface implementation. virtual void TabContentsDestroyed(TabContents* tab_contents) OVERRIDE; // WebstoreInstaller::Delegate interface implementation. diff --git a/chrome/browser/external_protocol/external_protocol_observer.cc b/chrome/browser/external_protocol/external_protocol_observer.cc index c1be1ef..d563473 100644 --- a/chrome/browser/external_protocol/external_protocol_observer.cc +++ b/chrome/browser/external_protocol/external_protocol_observer.cc @@ -8,7 +8,7 @@ #include "content/browser/tab_contents/tab_contents.h" ExternalProtocolObserver::ExternalProtocolObserver(TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { } ExternalProtocolObserver::~ExternalProtocolObserver() { diff --git a/chrome/browser/external_protocol/external_protocol_observer.h b/chrome/browser/external_protocol/external_protocol_observer.h index dad04b4..55ac16f 100644 --- a/chrome/browser/external_protocol/external_protocol_observer.h +++ b/chrome/browser/external_protocol/external_protocol_observer.h @@ -5,18 +5,16 @@ #ifndef CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_OBSERVER_H_ #define CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_OBSERVER_H_ -#include "content/browser/tab_contents/tab_contents_observer.h" - -class TabContents; +#include "content/public/browser/web_contents_observer.h" // ExternalProtocolObserver is responsible for handling messages from // TabContents relating to external protocols. -class ExternalProtocolObserver : public TabContentsObserver { +class ExternalProtocolObserver : public content::WebContentsObserver { public: explicit ExternalProtocolObserver(TabContents* tab_contents); virtual ~ExternalProtocolObserver(); - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidGetUserGesture() OVERRIDE; private: diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 9c00811..5939275 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -206,7 +206,7 @@ bool ExternalTabContainer::Init(Profile* profile, registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, content::NotificationService::AllSources()); - TabContentsObserver::Observe(tab_contents_->tab_contents()); + content::WebContentsObserver::Observe(tab_contents_->tab_contents()); // Start loading initial URL if (!initial_url.is_empty()) { diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index d56c252..a07db59 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -19,11 +19,11 @@ #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.h" #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/navigation_type.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" #include "ui/base/accelerators/accelerator.h" #include "ui/views/widget/native_widget_win.h" @@ -48,7 +48,7 @@ class ViewProp; // external process. This class provides the FocusManger needed by the // TabContents as well as an implementation of content::WebContentsDelegate. class ExternalTabContainer : public content::WebContentsDelegate, - public TabContentsObserver, + public content::WebContentsObserver, public content::NotificationObserver, public views::NativeWidgetWin, public base::RefCounted<ExternalTabContainer>, @@ -183,8 +183,7 @@ class ExternalTabContainer : public content::WebContentsDelegate, void RegisterRenderViewHost(RenderViewHost* render_view_host); void UnregisterRenderViewHost(RenderViewHost* render_view_host); - // Overridden from TabContentsObserver: - // IPC::Channel::Listener implementation. + // Overridden from content::WebContentsObserver: virtual bool OnMessageReceived(const IPC::Message& message); // Message handlers diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 08ebf3a..4f80151 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -21,7 +21,7 @@ #include "ui/gfx/image/image.h" FaviconTabHelper::FaviconTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), profile_(Profile::FromBrowserContext(tab_contents->GetBrowserContext())) { favicon_handler_.reset(new FaviconHandler(profile_, this, FaviconHandler::FAVICON)); diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h index 41d454d..6396752 100644 --- a/chrome/browser/favicon/favicon_tab_helper.h +++ b/chrome/browser/favicon/favicon_tab_helper.h @@ -13,13 +13,12 @@ #include "chrome/browser/favicon/favicon_handler_delegate.h" #include "chrome/browser/favicon/favicon_service.h" #include "chrome/common/favicon_url.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" class FaviconHandler; class NavigationEntry; class SkBitmap; -class TabContents; // FaviconTabHelper works with FaviconHandlers to fetch the favicons. // @@ -30,7 +29,7 @@ class TabContents; // DownloadImage downloads the specified icon and returns it through the given // callback. // -class FaviconTabHelper : public TabContentsObserver, +class FaviconTabHelper : public content::WebContentsObserver, public FaviconHandlerDelegate { public: explicit FaviconTabHelper(TabContents* tab_contents); @@ -80,7 +79,7 @@ class FaviconTabHelper : public TabContentsObserver, virtual void NotifyFaviconUpdated() OVERRIDE; private: - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void NavigateToPendingEntry( const GURL& url, NavigationController::ReloadType reload_type) OVERRIDE; diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h index 1793662..714ee7b 100644 --- a/chrome/browser/file_select_helper.h +++ b/chrome/browser/file_select_helper.h @@ -11,7 +11,6 @@ #include "base/compiler_specific.h" #include "chrome/browser/ui/select_file_dialog.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "net/base/directory_lister.h" diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index d5317dc..08cc2d9 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -19,7 +19,7 @@ #include "content/public/common/frame_navigate_params.h" HistoryTabHelper::HistoryTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), received_page_title_(false) { registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED, content::Source<TabContents>(tab_contents)); diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h index 63db2b0..ae5b052 100644 --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_HISTORY_HISTORY_TAB_HELPER_H_ #pragma once -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class HistoryService; class SkBitmap; @@ -18,7 +18,7 @@ namespace history { class HistoryAddPageArgs; } -class HistoryTabHelper : public TabContentsObserver, +class HistoryTabHelper : public content::WebContentsObserver, public content::NotificationObserver { public: explicit HistoryTabHelper(TabContents* tab_contents); @@ -41,7 +41,7 @@ class HistoryTabHelper : public TabContentsObserver, const content::FrameNavigateParams& params); private: - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, diff --git a/chrome/browser/infobars/infobar_tab_helper.cc b/chrome/browser/infobars/infobar_tab_helper.cc index d3baf4a..12fa355 100644 --- a/chrome/browser/infobars/infobar_tab_helper.cc +++ b/chrome/browser/infobars/infobar_tab_helper.cc @@ -13,7 +13,7 @@ #include "content/browser/tab_contents/tab_contents.h" InfoBarTabHelper::InfoBarTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), infobars_enabled_(true) { DCHECK(tab_contents); } diff --git a/chrome/browser/infobars/infobar_tab_helper.h b/chrome/browser/infobars/infobar_tab_helper.h index f614a8b..133a341 100644 --- a/chrome/browser/infobars/infobar_tab_helper.h +++ b/chrome/browser/infobars/infobar_tab_helper.h @@ -7,14 +7,13 @@ #pragma once #include "base/basictypes.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class InfoBarDelegate; -class TabContents; // Per-tab info bar manager. -class InfoBarTabHelper : public TabContentsObserver, +class InfoBarTabHelper : public content::WebContentsObserver, public content::NotificationObserver { public: explicit InfoBarTabHelper(TabContents* tab_contents); @@ -49,7 +48,7 @@ class InfoBarTabHelper : public TabContentsObserver, InfoBarDelegate* GetInfoBarDelegateAt(size_t index); void set_infobars_enabled(bool value) { infobars_enabled_ = value; } - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -60,7 +59,7 @@ class InfoBarTabHelper : public TabContentsObserver, // Helper functions for infobars: TabContents* tab_contents() { - return TabContentsObserver::tab_contents(); + return content::WebContentsObserver::tab_contents(); } private: diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 8752f02..e6b676b 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -168,7 +168,7 @@ class InstantLoader::TabContentsDelegateImpl public CoreTabHelperDelegate, public ConstrainedWindowTabHelperDelegate, public content::NotificationObserver, - public TabContentsObserver { + public content::WebContentsObserver { public: explicit TabContentsDelegateImpl(InstantLoader* loader); @@ -232,7 +232,7 @@ class InstantLoader::TabContentsDelegateImpl virtual void WillShowConstrainedWindow(TabContentsWrapper* source) OVERRIDE; virtual bool ShouldFocusConstrainedWindow() OVERRIDE; - // TabContentsObserver: + // content::WebContentsObserver: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; private: @@ -280,7 +280,7 @@ class InstantLoader::TabContentsDelegateImpl InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl( InstantLoader* loader) - : TabContentsObserver(loader->preview_contents()->tab_contents()), + : content::WebContentsObserver(loader->preview_contents()->tab_contents()), loader_(loader), registered_render_widget_host_(NULL), waiting_for_new_page_(true), diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index 6afbfd7..8a51a68 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -13,20 +13,16 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" class Balloon; class Browser; class SiteInstance; -namespace IPC { -class Message; -} - class BalloonHost : public content::WebContentsDelegate, - public TabContentsObserver, + public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate { public: explicit BalloonHost(Balloon* balloon); @@ -64,7 +60,7 @@ class BalloonHost : public content::WebContentsDelegate, virtual void UpdatePreferredSize(TabContents* source, const gfx::Size& pref_size) OVERRIDE; - // TabContentsObserver implementation: + // content::WebContentsObserver implementation: virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewReady() OVERRIDE; virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index daf6706..8eaf155 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -57,7 +57,7 @@ static void ReportMetrics(bool password_manager_enabled) { PasswordManager::PasswordManager(TabContents* tab_contents, PasswordManagerDelegate* delegate) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), login_managers_deleter_(&pending_login_managers_), delegate_(delegate), observer_(NULL) { diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index 882066b..aac2129 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -11,7 +11,7 @@ #include "chrome/browser/password_manager/password_form_manager.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/ui/login/login_model.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "webkit/forms/password_form.h" #include "webkit/forms/password_form_dom_manager.h" @@ -25,7 +25,7 @@ class PrefService; // database through the WebDataService. The PasswordManager is a LoginModel // for purposes of supporting HTTP authentication dialogs. class PasswordManager : public LoginModel, - public TabContentsObserver { + public content::WebContentsObserver { public: static void RegisterUserPrefs(PrefService* prefs); @@ -49,7 +49,7 @@ class PasswordManager : public LoginModel, // of 2 (see SavePassword). void ProvisionallySavePassword(webkit::forms::PasswordForm form); - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidStopLoading() OVERRIDE; virtual void DidNavigateAnyFrame( const content::LoadCommittedDetails& details, diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 7c488ba..0ddab66 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -289,7 +289,7 @@ bool OutdatedPluginInfoBarDelegate::LinkClicked( // PluginObserver ------------------------------------------------------------- PluginObserver::PluginObserver(TabContentsWrapper* tab_contents) - : TabContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->tab_contents()), ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), tab_contents_(tab_contents) { } diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h index 2612e52..917df14 100644 --- a/chrome/browser/plugin_observer.h +++ b/chrome/browser/plugin_observer.h @@ -7,19 +7,19 @@ #pragma once #include "base/memory/weak_ptr.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class GURL; class InfoBarDelegate; class PluginInstaller; class TabContentsWrapper; -class PluginObserver : public TabContentsObserver { +class PluginObserver : public content::WebContentsObserver { public: explicit PluginObserver(TabContentsWrapper* tab_contents); virtual ~PluginObserver(); - // IPC::Channel::Listener implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; private: diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 1c493e3..243d3ab 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -237,7 +237,7 @@ void PrerenderContents::StartPrerendering( TabContents* new_contents = new TabContents(profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace); prerender_contents_.reset(new TabContentsWrapper(new_contents)); - TabContentsObserver::Observe(new_contents); + content::WebContentsObserver::Observe(new_contents); gfx::Rect tab_bounds; if (source_render_view_host) { @@ -655,7 +655,7 @@ void PrerenderContents::DestroyWhenUsingTooManyResources() { TabContentsWrapper* PrerenderContents::ReleasePrerenderContents() { prerender_contents_->tab_contents()->SetDelegate(NULL); render_view_host_observer_.reset(); - TabContentsObserver::Observe(NULL); + content::WebContentsObserver::Observe(NULL); return prerender_contents_.release(); } diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index e22a154..d2b887e 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h @@ -14,15 +14,14 @@ #include "base/time.h" #include "base/values.h" #include "chrome/browser/prerender/prerender_final_status.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/common/referrer.h" class Profile; class RenderViewHost; class RenderViewHostDelegate; class SessionStorageNamespace; -class TabContents; class TabContentsWrapper; struct FaviconURL; @@ -42,7 +41,7 @@ class PrerenderTracker; // programatically view window.location.href) or RenderViewHostManager because // it is never allowed to navigate across a SiteInstance boundary. class PrerenderContents : public content::NotificationObserver, - public TabContentsObserver { + public content::WebContentsObserver { public: // PrerenderContents::Create uses the currently registered Factory to create // the PrerenderContents. Factory is intended for testing. @@ -131,7 +130,7 @@ class PrerenderContents : public content::NotificationObserver, void OnJSOutOfMemory(); bool ShouldSuppressDialogs(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void DidStopLoading() OVERRIDE; virtual void DidStartProvisionalLoadForFrame( int64 frame_id, diff --git a/chrome/browser/prerender/prerender_tab_helper.cc b/chrome/browser/prerender/prerender_tab_helper.cc index abf6ef5..9e3107d 100644 --- a/chrome/browser/prerender/prerender_tab_helper.cc +++ b/chrome/browser/prerender/prerender_tab_helper.cc @@ -166,7 +166,7 @@ class PrerenderTabHelper::HoverData { }; PrerenderTabHelper::PrerenderTabHelper(TabContentsWrapper* tab) - : TabContentsObserver(tab->tab_contents()), + : content::WebContentsObserver(tab->tab_contents()), tab_(tab), pplt_load_start_(), last_hovers_(new HoverData[kNumHoverThresholds]) { diff --git a/chrome/browser/prerender/prerender_tab_helper.h b/chrome/browser/prerender/prerender_tab_helper.h index e70d182..8f22d2a 100644 --- a/chrome/browser/prerender/prerender_tab_helper.h +++ b/chrome/browser/prerender/prerender_tab_helper.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "base/time.h" @@ -18,12 +18,12 @@ class PrerenderManager; // PrerenderTabHelper is responsible for recording perceived pageload times // to compare PLT's with prerendering enabled and disabled. -class PrerenderTabHelper : public TabContentsObserver { +class PrerenderTabHelper : public content::WebContentsObserver { public: explicit PrerenderTabHelper(TabContentsWrapper* tab); virtual ~PrerenderTabHelper(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void ProvisionalChangeToMainFrameUrl( const GURL& url, const GURL& opener_url) OVERRIDE; diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc index b59c78b..f3c316a 100644 --- a/chrome/browser/printing/print_preview_message_handler.cc +++ b/chrome/browser/printing/print_preview_message_handler.cc @@ -64,7 +64,7 @@ namespace printing { PrintPreviewMessageHandler::PrintPreviewMessageHandler( TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { DCHECK(tab_contents); } diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h index f5de599..8f6b649 100644 --- a/chrome/browser/printing/print_preview_message_handler.h +++ b/chrome/browser/printing/print_preview_message_handler.h @@ -7,7 +7,7 @@ #pragma once #include "base/compiler_specific.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class PrintPreviewUI; class TabContentsWrapper; @@ -22,12 +22,12 @@ struct PageSizeMargins; // TabContents offloads print preview message handling to // PrintPreviewMessageHandler. This object has the same life time as the // TabContents that owns it. -class PrintPreviewMessageHandler : public TabContentsObserver { +class PrintPreviewMessageHandler : public content::WebContentsObserver { public: explicit PrintPreviewMessageHandler(TabContents* tab_contents); virtual ~PrintPreviewMessageHandler(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void NavigateToPendingEntry(const GURL& url, NavigationController::ReloadType reload_type) OVERRIDE; diff --git a/chrome/browser/printing/print_preview_tab_controller_browsertest.cc b/chrome/browser/printing/print_preview_tab_controller_browsertest.cc index 4dcf532..6dd22cbe 100644 --- a/chrome/browser/printing/print_preview_tab_controller_browsertest.cc +++ b/chrome/browser/printing/print_preview_tab_controller_browsertest.cc @@ -13,9 +13,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" namespace { @@ -30,10 +30,10 @@ class PrintPreviewTabControllerBrowserTest : public InProcessBrowserTest { } }; -class TabDestroyedObserver : public TabContentsObserver { +class TabDestroyedObserver : public content::WebContentsObserver { public: explicit TabDestroyedObserver(TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), tab_destroyed_(false) { } virtual ~TabDestroyedObserver() {} diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 21a963f..5dbd665 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -65,7 +65,7 @@ static base::LazyInstance<ScriptedPrintPreviewClosureMap> namespace printing { PrintViewManager::PrintViewManager(TabContentsWrapper* tab) - : TabContentsObserver(tab->tab_contents()), + : content::WebContentsObserver(tab->tab_contents()), tab_(tab), number_pages_(0), printing_succeeded_(false), diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index 1e6627b..16f0fe2 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h @@ -8,9 +8,9 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "printing/printed_pages_source.h" class TabContentsWrapper; @@ -31,7 +31,7 @@ class PrintViewManagerObserver; // delegates a few printing related commands to this instance. class PrintViewManager : public content::NotificationObserver, public PrintedPagesSource, - public TabContentsObserver { + public content::WebContentsObserver { public: explicit PrintViewManager(TabContentsWrapper* tab); virtual ~PrintViewManager(); @@ -76,7 +76,7 @@ class PrintViewManager : public content::NotificationObserver, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Terminates or cancels the print job if one was pending. diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 07dfe94..d4a7721 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -256,7 +256,7 @@ ClientSideDetectionHost* ClientSideDetectionHost::Create( } ClientSideDetectionHost::ClientSideDetectionHost(TabContents* tab) - : TabContentsObserver(tab), + : content::WebContentsObserver(tab), csd_service_(NULL), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), unsafe_unique_page_id_(-1) { diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h index 727852f..ad769b7 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.h +++ b/chrome/browser/safe_browsing/client_side_detection_host.h @@ -16,12 +16,10 @@ #include "chrome/browser/safe_browsing/browser_feature_extractor.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" -class TabContents; - namespace safe_browsing { class ClientPhishingRequest; class ClientSideDetectionService; @@ -31,7 +29,7 @@ class ClientSideDetectionService; // class relays this information to the client-side detection service // class which sends a ping to a server to validate the verdict. // TODO(noelutz): move all client-side detection IPCs to this class. -class ClientSideDetectionHost : public TabContentsObserver, +class ClientSideDetectionHost : public content::WebContentsObserver, public content::NotificationObserver, public SafeBrowsingService::Observer { public: @@ -40,11 +38,11 @@ class ClientSideDetectionHost : public TabContentsObserver, static ClientSideDetectionHost* Create(TabContents* tab); virtual ~ClientSideDetectionHost(); - // From TabContentsObserver. + // From content::WebContentsObserver. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - // From TabContentsObserver. If we navigate away we cancel all pending - // callbacks that could show an interstitial, and check to see whether + // From content::WebContentsObserver. If we navigate away we cancel all + // pending callbacks that could show an interstitial, and check to see whether // we should classify the new URL. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, @@ -56,7 +54,7 @@ class ClientSideDetectionHost : public TabContentsObserver, const SafeBrowsingService::UnsafeResource& resource) OVERRIDE; protected: - // From TabContentsObserver. Called when the TabContents is being destroyed. + // From content::WebContentsObserver. virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; private: diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index 95f7de5..d1dc772 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -74,7 +74,7 @@ MalwareDetails::MalwareDetails( SafeBrowsingService* sb_service, TabContents* tab_contents, const SafeBrowsingService::UnsafeResource& resource) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), profile_(Profile::FromBrowserContext(tab_contents->GetBrowserContext())), request_context_getter_(profile_->GetRequestContext()), sb_service_(sb_service), diff --git a/chrome/browser/safe_browsing/malware_details.h b/chrome/browser/safe_browsing/malware_details.h index b122443..8a40109 100644 --- a/chrome/browser/safe_browsing/malware_details.h +++ b/chrome/browser/safe_browsing/malware_details.h @@ -21,17 +21,15 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/safe_browsing/report.pb.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents_observer.h" #include "net/base/completion_callback.h" -class TabContents; -struct SafeBrowsingHostMsg_MalwareDOMDetails_Node; - class MalwareDetailsCacheCollector; class MalwareDetailsRedirectsCollector; class MalwareDetailsFactory; class Profile; +struct SafeBrowsingHostMsg_MalwareDOMDetails_Node; namespace safe_browsing { // Maps a URL to its Resource. @@ -41,7 +39,7 @@ typedef base::hash_map< } class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, - public TabContentsObserver { + public content::WebContentsObserver { public: // Constructs a new MalwareDetails instance, using the factory. static MalwareDetails* NewMalwareDetails( @@ -66,7 +64,7 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, void OnRedirectionCollectionReady(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; protected: diff --git a/chrome/browser/sessions/restore_tab_helper.cc b/chrome/browser/sessions/restore_tab_helper.cc index d7b4d46..a2a3d67 100644 --- a/chrome/browser/sessions/restore_tab_helper.cc +++ b/chrome/browser/sessions/restore_tab_helper.cc @@ -12,7 +12,7 @@ #include "content/public/browser/notification_types.h" RestoreTabHelper::RestoreTabHelper(TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), contents_(contents) { } diff --git a/chrome/browser/sessions/restore_tab_helper.h b/chrome/browser/sessions/restore_tab_helper.h index 90fa69c..d656685 100644 --- a/chrome/browser/sessions/restore_tab_helper.h +++ b/chrome/browser/sessions/restore_tab_helper.h @@ -8,13 +8,11 @@ #include "base/basictypes.h" #include "chrome/browser/sessions/session_id.h" -#include "content/browser/tab_contents/tab_contents_observer.h" - -class TabContents; +#include "content/public/browser/web_contents_observer.h" // This class keeps the extension API's windowID up-to-date with the current // window of the tab. -class RestoreTabHelper : public TabContentsObserver { +class RestoreTabHelper : public content::WebContentsObserver { public: explicit RestoreTabHelper(TabContents* contents); virtual ~RestoreTabHelper(); @@ -26,7 +24,7 @@ class RestoreTabHelper : public TabContentsObserver { void SetWindowID(const SessionID& id); const SessionID& window_id() const { return window_id_; } - // TabContentsObserver: + // content::WebContentsObserver: virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; private: diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 134bfd5..191a81d 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -35,7 +35,7 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance, profile_, site_instance, routing_id, NULL, NULL)); tab_contents_->SetViewType(chrome::VIEW_TYPE_BACKGROUND_CONTENTS); tab_contents_->SetDelegate(this); - TabContentsObserver::Observe(tab_contents_.get()); + content::WebContentsObserver::Observe(tab_contents_.get()); // Close ourselves when the application is shutting down. registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index d494254..d572602 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -9,10 +9,10 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" #include "webkit/glue/window_open_disposition.h" class Profile; @@ -20,7 +20,7 @@ class Profile; // This class consumes TabContents. It can host a renderer, but does not // have any visible display. class BackgroundContents : public content::WebContentsDelegate, - public TabContentsObserver, + public content::WebContentsObserver, public content::NotificationObserver { public: class Delegate { @@ -55,7 +55,7 @@ class BackgroundContents : public content::WebContentsDelegate, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; - // TabContentsObserver implementation: + // content::WebContentsObserver implementation: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; // content::NotificationObserver diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 61d2cef..b9c6eea 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -145,7 +145,7 @@ ThumbnailGenerator::~ThumbnailGenerator() { } void ThumbnailGenerator::StartThumbnailing(TabContents* tab_contents) { - TabContentsObserver::Observe(tab_contents); + content::WebContentsObserver::Observe(tab_contents); if (registrar_.IsEmpty()) { // Even though we deal in RenderWidgetHosts, we only care about its diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h index dc41c3f..79cb19c 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.h +++ b/chrome/browser/tab_contents/thumbnail_generator.h @@ -15,22 +15,21 @@ #include "base/memory/linked_ptr.h" #include "base/timer.h" #include "content/browser/renderer_host/backing_store.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class GURL; class Profile; class RenderWidgetHost; class SkBitmap; -class TabContents; namespace history { class TopSites; } class ThumbnailGenerator : public content::NotificationObserver, - public TabContentsObserver { + public content::WebContentsObserver { public: typedef base::Callback<void(const SkBitmap&)> ThumbnailReadyCallback; // The result of clipping. This can be used to determine if the @@ -123,7 +122,7 @@ class ThumbnailGenerator : public content::NotificationObserver, history::TopSites* top_sites, const GURL& url); - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidStartLoading() OVERRIDE; virtual void StopNavigation() OVERRIDE; diff --git a/chrome/browser/tabs/tab_finder.cc b/chrome/browser/tabs/tab_finder.cc index 655de82..f923178 100644 --- a/chrome/browser/tabs/tab_finder.cc +++ b/chrome/browser/tabs/tab_finder.cc @@ -16,22 +16,24 @@ #include "chrome/common/chrome_switches.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/common/frame_navigate_params.h" #include "content/public/common/page_transition_types.h" -class TabFinder::TabContentsObserverImpl : public TabContentsObserver { +class TabFinder::WebContentsObserverImpl : public content::WebContentsObserver { public: - TabContentsObserverImpl(TabContents* tab, TabFinder* finder); - virtual ~TabContentsObserverImpl(); + WebContentsObserverImpl(TabContents* tab, TabFinder* finder); + virtual ~WebContentsObserverImpl(); - TabContents* tab_contents() { return TabContentsObserver::tab_contents(); } + TabContents* tab_contents() { + return content::WebContentsObserver::tab_contents(); + } - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void DidNavigateAnyFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; @@ -40,26 +42,26 @@ class TabFinder::TabContentsObserverImpl : public TabContentsObserver { private: TabFinder* finder_; - DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); }; -TabFinder::TabContentsObserverImpl::TabContentsObserverImpl( +TabFinder::WebContentsObserverImpl::WebContentsObserverImpl( TabContents* tab, TabFinder* finder) - : TabContentsObserver(tab), + : content::WebContentsObserver(tab), finder_(finder) { } -TabFinder::TabContentsObserverImpl::~TabContentsObserverImpl() { +TabFinder::WebContentsObserverImpl::~WebContentsObserverImpl() { } -void TabFinder::TabContentsObserverImpl::DidNavigateAnyFrame( +void TabFinder::WebContentsObserverImpl::DidNavigateAnyFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) { finder_->DidNavigateAnyFrame(tab_contents(), details, params); } -void TabFinder::TabContentsObserverImpl::TabContentsDestroyed( +void TabFinder::WebContentsObserverImpl::TabContentsDestroyed( TabContents* tab) { finder_->TabDestroyed(this); delete this; @@ -166,19 +168,19 @@ TabContents* TabFinder::FindTabInBrowser(Browser* browser, const GURL& url) { } void TabFinder::TrackTab(TabContents* tab) { - for (TabContentsObservers::const_iterator i = tab_contents_observers_.begin(); + for (WebContentsObservers::const_iterator i = tab_contents_observers_.begin(); i != tab_contents_observers_.end(); ++i) { if ((*i)->tab_contents() == tab) { // Already tracking the tab. return; } } - TabContentsObserverImpl* observer = new TabContentsObserverImpl(tab, this); + WebContentsObserverImpl* observer = new WebContentsObserverImpl(tab, this); tab_contents_observers_.insert(observer); FetchRedirectStart(tab); } -void TabFinder::TabDestroyed(TabContentsObserverImpl* observer) { +void TabFinder::TabDestroyed(WebContentsObserverImpl* observer) { DCHECK_GT(tab_contents_observers_.count(observer), 0u); tab_contents_observers_.erase(observer); } diff --git a/chrome/browser/tabs/tab_finder.h b/chrome/browser/tabs/tab_finder.h index 32b0f50..b89ceb3 100644 --- a/chrome/browser/tabs/tab_finder.h +++ b/chrome/browser/tabs/tab_finder.h @@ -53,15 +53,15 @@ class TabFinder : public content::NotificationObserver { private: friend struct DefaultSingletonTraits<TabFinder>; - class TabContentsObserverImpl; + class WebContentsObserverImpl; typedef std::map<TabContents*, GURL> TabContentsToURLMap; - typedef std::set<TabContentsObserverImpl*> TabContentsObservers; + typedef std::set<WebContentsObserverImpl*> WebContentsObservers; TabFinder(); virtual ~TabFinder(); - // Forwarded from TabContentsObserverImpl. + // Forwarded from WebContentsObserverImpl. void DidNavigateAnyFrame( TabContents* source, const content::LoadCommittedDetails& details, @@ -76,11 +76,11 @@ class TabFinder : public content::NotificationObserver { TabContents* FindTabInBrowser(Browser* browser, const GURL& url); // If we're not currently tracking |tab| this creates a - // TabContentsObserverImpl to listen for navigations. + // WebContentsObserverImpl to listen for navigations. void TrackTab(TabContents* tab); // Invoked when a TabContents is being destroyed. - void TabDestroyed(TabContentsObserverImpl* observer); + void TabDestroyed(WebContentsObserverImpl* observer); // Cancels any pending requests for the specified tabs redirect chain. void CancelRequestsFor(TabContents* tab_contents); @@ -102,7 +102,7 @@ class TabFinder : public content::NotificationObserver { content::NotificationRegistrar registrar_; - TabContentsObservers tab_contents_observers_; + WebContentsObservers tab_contents_observers_; DISALLOW_COPY_AND_ASSIGN(TabFinder); }; diff --git a/chrome/browser/translate/translate_tab_helper.cc b/chrome/browser/translate/translate_tab_helper.cc index dc00597..956f811 100644 --- a/chrome/browser/translate/translate_tab_helper.cc +++ b/chrome/browser/translate/translate_tab_helper.cc @@ -11,7 +11,7 @@ #include "content/public/browser/notification_service.h" TranslateTabHelper::TranslateTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), language_state_(&tab_contents->GetController()) { } diff --git a/chrome/browser/translate/translate_tab_helper.h b/chrome/browser/translate/translate_tab_helper.h index 86e6d7a..c6abd4b 100644 --- a/chrome/browser/translate/translate_tab_helper.h +++ b/chrome/browser/translate/translate_tab_helper.h @@ -8,9 +8,9 @@ #include "chrome/browser/tab_contents/language_state.h" #include "chrome/common/translate_errors.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" -class TranslateTabHelper : public TabContentsObserver { +class TranslateTabHelper : public content::WebContentsObserver { public: explicit TranslateTabHelper(TabContents* tab_contents); virtual ~TranslateTabHelper(); @@ -18,7 +18,7 @@ class TranslateTabHelper : public TabContentsObserver { LanguageState& language_state() { return language_state_; } private: - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void DidNavigateAnyFrame( const content::LoadCommittedDetails& details, diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc index dbd8603..efd7d12 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.cc +++ b/chrome/browser/ui/alternate_error_tab_observer.cc @@ -16,7 +16,7 @@ AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), wrapper_(wrapper) { PrefService* prefs = wrapper_->profile()->GetPrefs(); if (prefs) { @@ -39,7 +39,7 @@ void AlternateErrorPageTabObserver::RegisterUserPrefs(PrefService* prefs) { } //////////////////////////////////////////////////////////////////////////////// -// TabContentsObserver overrides +// WebContentsObserver overrides void AlternateErrorPageTabObserver::RenderViewCreated( RenderViewHost* render_view_host) { diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h index 4431a28..fe5ecad 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.h +++ b/chrome/browser/ui/alternate_error_tab_observer.h @@ -7,13 +7,13 @@ #pragma once #include "chrome/browser/prefs/pref_change_registrar.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class TabContentsWrapper; // Per-tab class to implement alternate error page functionality. -class AlternateErrorPageTabObserver : public TabContentsObserver, +class AlternateErrorPageTabObserver : public content::WebContentsObserver, public content::NotificationObserver { public: explicit AlternateErrorPageTabObserver(TabContentsWrapper* wrapper); @@ -22,7 +22,7 @@ class AlternateErrorPageTabObserver : public TabContentsObserver, static void RegisterUserPrefs(PrefService* prefs); private: - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; // content::NotificationObserver overrides: diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index aed0954..208f8f9 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -16,7 +16,7 @@ BlockedContentTabHelper::BlockedContentTabHelper( TabContentsWrapper* tab_contents) - : TabContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->tab_contents()), blocked_contents_(new BlockedContentContainer(tab_contents)), all_contents_blocked_(false), tab_contents_wrapper_(tab_contents), diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h index 1b447e8e..dd7ae57 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h @@ -8,8 +8,8 @@ #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "webkit/glue/window_open_disposition.h" class BlockedContentContainer; @@ -17,7 +17,7 @@ class BlockedContentTabHelperDelegate; class TabContentsWrapper; // Per-tab class to manage blocked popups. -class BlockedContentTabHelper : public TabContentsObserver { +class BlockedContentTabHelper : public content::WebContentsObserver { public: explicit BlockedContentTabHelper(TabContentsWrapper* tab_contents); virtual ~BlockedContentTabHelper(); @@ -55,7 +55,7 @@ class BlockedContentTabHelper : public TabContentsObserver { void GetBlockedContents( std::vector<TabContentsWrapper*>* blocked_contents) const; - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc index 2754c49..1ced986 100644 --- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc +++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc @@ -24,7 +24,7 @@ bool CanShowBookmarkBar(WebUI* ui) { } // namespace BookmarkTabHelper::BookmarkTabHelper(TabContentsWrapper* tab_contents) - : TabContentsObserver(tab_contents->tab_contents()), + : content::WebContentsObserver(tab_contents->tab_contents()), is_starred_(false), tab_contents_wrapper_(tab_contents), delegate_(NULL), diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h index 800ae4c..c165cc7 100644 --- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h +++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ #pragma once -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class BookmarkTabHelperDelegate; class TabContentsWrapper; @@ -16,7 +16,7 @@ struct BookmarkNodeData; // Per-tab class to manage bookmarks. class BookmarkTabHelper : public content::NotificationObserver, - public TabContentsObserver { + public content::WebContentsObserver { public: // BookmarkDrag -------------------------------------------------------------- // Interface for forwarding bookmark drag and drop to extenstions. @@ -42,7 +42,7 @@ class BookmarkTabHelper : public content::NotificationObserver, // Returns true if the bookmark bar should be shown detached. bool ShouldShowBookmarkBar(); - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.h b/chrome/browser/ui/cocoa/hung_renderer_controller.h index 7d4fd1c..250099a 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.h +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.h @@ -26,7 +26,7 @@ @class MultiKeyEquivalentButton; class TabContents; -class TabContentsObserverBridge; +class WebContentsObserverBridge; @interface HungRendererController : NSWindowController<NSTableViewDataSource> { @private @@ -41,7 +41,7 @@ class TabContentsObserverBridge; TabContents* hungContents_; // Observes |hungContents_| in case it closes while the panel is up. - scoped_ptr<TabContentsObserverBridge> hungContentsObserver_; + scoped_ptr<WebContentsObserverBridge> hungContentsObserver_; // Backing data for |tableView_|. Titles of each TabContents that // shares a renderer process with |hungContents_|. diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 5a2147e..681cf09c 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -37,16 +37,16 @@ namespace { HungRendererController* g_instance = NULL; } // namespace -class TabContentsObserverBridge : public TabContentsObserver { +class WebContentsObserverBridge : public content::WebContentsObserver { public: - TabContentsObserverBridge(TabContents* tab_contents, + WebContentsObserverBridge(TabContents* tab_contents, HungRendererController* controller) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), controller_(controller) { } protected: - // TabContentsObserver overrides: + // WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE { [controller_ renderViewGone]; } @@ -57,7 +57,7 @@ class TabContentsObserverBridge : public TabContentsObserver { private: HungRendererController* controller_; // weak - DISALLOW_COPY_AND_ASSIGN(TabContentsObserverBridge); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserverBridge); }; @implementation HungRendererController @@ -166,7 +166,7 @@ class TabContentsObserverBridge : public TabContentsObserver { - (void)showForTabContents:(TabContents*)contents { DCHECK(contents); hungContents_ = contents; - hungContentsObserver_.reset(new TabContentsObserverBridge(contents, self)); + hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); scoped_nsobject<NSMutableArray> titles([[NSMutableArray alloc] init]); scoped_nsobject<NSMutableArray> favicons([[NSMutableArray alloc] init]); for (TabContentsIterator it; !it.done(); ++it) { diff --git a/chrome/browser/ui/constrained_window_tab_helper.cc b/chrome/browser/ui/constrained_window_tab_helper.cc index 49a438d..bab46d5 100644 --- a/chrome/browser/ui/constrained_window_tab_helper.cc +++ b/chrome/browser/ui/constrained_window_tab_helper.cc @@ -16,7 +16,7 @@ ConstrainedWindowTabHelper::ConstrainedWindowTabHelper( TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), wrapper_(wrapper), delegate_(NULL) { } diff --git a/chrome/browser/ui/constrained_window_tab_helper.h b/chrome/browser/ui/constrained_window_tab_helper.h index c65cd94..d5682fd 100644 --- a/chrome/browser/ui/constrained_window_tab_helper.h +++ b/chrome/browser/ui/constrained_window_tab_helper.h @@ -8,14 +8,14 @@ #include <deque> -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class ConstrainedWindow; class ConstrainedWindowTabHelperDelegate; class TabContentsWrapper; // Per-tab class to manage constrained windows. -class ConstrainedWindowTabHelper : public TabContentsObserver { +class ConstrainedWindowTabHelper : public content::WebContentsObserver { public: explicit ConstrainedWindowTabHelper(TabContentsWrapper* tab_contents); virtual ~ConstrainedWindowTabHelper(); @@ -52,7 +52,7 @@ class ConstrainedWindowTabHelper : public TabContentsObserver { } private: - // Overridden from TabContentsObserver: + // Overridden from content::WebContentsObserver: virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/ui/find_bar/find_tab_helper.cc b/chrome/browser/ui/find_bar/find_tab_helper.cc index a401f3f..39ba133 100644 --- a/chrome/browser/ui/find_bar/find_tab_helper.cc +++ b/chrome/browser/ui/find_bar/find_tab_helper.cc @@ -21,7 +21,7 @@ using WebKit::WebFindOptions; int FindTabHelper::find_request_id_counter_ = -1; FindTabHelper::FindTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), find_ui_active_(false), find_op_aborted_(false), current_find_request_id_(find_request_id_counter_++), diff --git a/chrome/browser/ui/find_bar/find_tab_helper.h b/chrome/browser/ui/find_bar/find_tab_helper.h index 5e26c31..f8bf5b3 100644 --- a/chrome/browser/ui/find_bar/find_tab_helper.h +++ b/chrome/browser/ui/find_bar/find_tab_helper.h @@ -8,10 +8,10 @@ #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" // Per-tab find manager. Handles dealing with the life cycle of find sessions. -class FindTabHelper : public TabContentsObserver { +class FindTabHelper : public content::WebContentsObserver { public: explicit FindTabHelper(TabContents* tab_contents); virtual ~FindTabHelper(); diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc index 306edcd..1a09a7a 100644 --- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc @@ -41,15 +41,15 @@ class HungRendererDialogGtk { private: // Dismiss the panel if |contents_| is closed or its renderer exits. - class TabContentsObserverImpl : public TabContentsObserver { + class WebContentsObserverImpl : public content::WebContentsObserver { public: - TabContentsObserverImpl(HungRendererDialogGtk* dialog, + WebContentsObserverImpl(HungRendererDialogGtk* dialog, TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), dialog_(dialog) { } - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE { dialog_->Hide(); } @@ -60,7 +60,7 @@ class HungRendererDialogGtk { private: HungRendererDialogGtk* dialog_; // weak - DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); }; // The GtkTreeView column ids. @@ -78,7 +78,7 @@ class HungRendererDialogGtk { GtkDialog* dialog_; GtkListStore* model_; TabContents* contents_; - scoped_ptr<TabContentsObserverImpl> contents_observer_; + scoped_ptr<WebContentsObserverImpl> contents_observer_; DISALLOW_COPY_AND_ASSIGN(HungRendererDialogGtk); }; @@ -176,7 +176,7 @@ void HungRendererDialogGtk::Init() { void HungRendererDialogGtk::ShowForTabContents(TabContents* hung_contents) { DCHECK(hung_contents && dialog_); contents_ = hung_contents; - contents_observer_.reset(new TabContentsObserverImpl(this, contents_)); + contents_observer_.reset(new WebContentsObserverImpl(this, contents_)); gtk_list_store_clear(model_); GtkTreeIter tree_iter; diff --git a/chrome/browser/ui/pdf/pdf_tab_observer.cc b/chrome/browser/ui/pdf/pdf_tab_observer.cc index 276d783..60ff1b4 100644 --- a/chrome/browser/ui/pdf/pdf_tab_observer.cc +++ b/chrome/browser/ui/pdf/pdf_tab_observer.cc @@ -9,7 +9,7 @@ #include "chrome/common/render_messages.h" PDFTabObserver::PDFTabObserver(TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), wrapper_(wrapper) { } @@ -17,7 +17,7 @@ PDFTabObserver::~PDFTabObserver() { } //////////////////////////////////////////////////////////////////////////////// -// TabContentsObserver overrides +// WebContentsObserver overrides bool PDFTabObserver::OnMessageReceived(const IPC::Message& message) { bool handled = true; diff --git a/chrome/browser/ui/pdf/pdf_tab_observer.h b/chrome/browser/ui/pdf/pdf_tab_observer.h index 0ee2012..bde820c 100644 --- a/chrome/browser/ui/pdf/pdf_tab_observer.h +++ b/chrome/browser/ui/pdf/pdf_tab_observer.h @@ -6,18 +6,18 @@ #define CHROME_BROWSER_UI_PDF_PDF_TAB_OBSERVER_H_ #pragma once -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class TabContentsWrapper; // Per-tab class to handle PDF messages. -class PDFTabObserver : public TabContentsObserver { +class PDFTabObserver : public content::WebContentsObserver { public: explicit PDFTabObserver(TabContentsWrapper* wrapper); virtual ~PDFTabObserver(); private: - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Internal helpers ---------------------------------------------------------- diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 010ead9..e4020b9 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -211,7 +211,7 @@ const size_t kPerScriptFontDefaultsLength = arraysize(kPerScriptFontDefaults); } // namespace PrefsTabHelper::PrefsTabHelper(TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), contents_(contents) { PrefService* prefs = GetProfile()->GetPrefs(); pref_change_registrar_.Init(prefs); diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h index b2f8f71..7888149 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.h +++ b/chrome/browser/ui/prefs/prefs_tab_helper.h @@ -7,16 +7,15 @@ #pragma once #include "chrome/browser/prefs/pref_change_registrar.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" class PrefService; class Profile; -class TabContents; struct WebPreferences; // Per-tab class to handle user preferences. -class PrefsTabHelper : public TabContentsObserver, +class PrefsTabHelper : public content::WebContentsObserver, public content::NotificationObserver { public: explicit PrefsTabHelper(TabContents* contents); @@ -30,11 +29,11 @@ class PrefsTabHelper : public TabContentsObserver, // Update the RenderView's WebPreferences. Exposed as protected for testing. virtual void UpdateWebPreferences(); - // TabContentsObserver overrides, exposed as protected for testing. + // content::WebContentsObserver overrides, exposed as protected for testing. virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; private: - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; // content::NotificationObserver overrides: diff --git a/chrome/browser/ui/sad_tab_observer.cc b/chrome/browser/ui/sad_tab_observer.cc index 3e32108..9052eb3 100644 --- a/chrome/browser/ui/sad_tab_observer.cc +++ b/chrome/browser/ui/sad_tab_observer.cc @@ -20,7 +20,7 @@ #endif SadTabObserver::SadTabObserver(TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, content::Source<TabContents>(tab_contents)); } diff --git a/chrome/browser/ui/sad_tab_observer.h b/chrome/browser/ui/sad_tab_observer.h index ace1044..64fec0b 100644 --- a/chrome/browser/ui/sad_tab_observer.h +++ b/chrome/browser/ui/sad_tab_observer.h @@ -7,9 +7,9 @@ #pragma once #include "base/memory/scoped_ptr.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "ui/gfx/native_widget_types.h" #if defined(OS_MACOSX) @@ -27,7 +27,7 @@ class SadTabGtk; #endif // Per-tab class to manage sad tab views. -class SadTabObserver : public TabContentsObserver, +class SadTabObserver : public content::WebContentsObserver, public content::NotificationObserver { public: explicit SadTabObserver(TabContents* tab_contents); @@ -43,7 +43,7 @@ class SadTabObserver : public TabContentsObserver, // Platform specific function to determine if there is a current sad tab page. bool HasSadTab(); - // Overridden from TabContentsObserver: + // Overridden from content::WebContentsObserver: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; // Overridden from content::NotificationObserver: diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc index 07e61e9..68911ae 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc @@ -25,7 +25,7 @@ bool IsFormSubmit(const NavigationEntry* entry) { } // namespace SearchEngineTabHelper::SearchEngineTabHelper(TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { DCHECK(tab_contents); } diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.h b/chrome/browser/ui/search_engines/search_engine_tab_helper.h index a2ffb49..0cdbc3b 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.h +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.h @@ -9,13 +9,13 @@ #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/common/search_provider.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class SearchEngineTabHelperDelegate; // Per-tab search engine manager. Handles dealing search engine processing // functionality. -class SearchEngineTabHelper : public TabContentsObserver { +class SearchEngineTabHelper : public content::WebContentsObserver { public: explicit SearchEngineTabHelper(TabContents* tab_contents); virtual ~SearchEngineTabHelper(); @@ -23,7 +23,7 @@ class SearchEngineTabHelper : public TabContentsObserver { SearchEngineTabHelperDelegate* delegate() const { return delegate_; } void set_delegate(SearchEngineTabHelperDelegate* d) { delegate_ = d; } - // TabContentsObserver overrides. + // content::WebContentsObserver overrides. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; diff --git a/chrome/browser/ui/snapshot_tab_helper.cc b/chrome/browser/ui/snapshot_tab_helper.cc index 0078d57..7f9e1b0 100644 --- a/chrome/browser/ui/snapshot_tab_helper.cc +++ b/chrome/browser/ui/snapshot_tab_helper.cc @@ -10,7 +10,7 @@ #include "content/public/browser/notification_service.h" SnapshotTabHelper::SnapshotTabHelper(TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), wrapper_(wrapper) { } @@ -22,7 +22,7 @@ void SnapshotTabHelper::CaptureSnapshot() { } //////////////////////////////////////////////////////////////////////////////// -// TabContentsObserver overrides +// WebContentsObserver overrides bool SnapshotTabHelper::OnMessageReceived(const IPC::Message& message) { bool handled = true; diff --git a/chrome/browser/ui/snapshot_tab_helper.h b/chrome/browser/ui/snapshot_tab_helper.h index 2e343e5..dca4ebb 100644 --- a/chrome/browser/ui/snapshot_tab_helper.h +++ b/chrome/browser/ui/snapshot_tab_helper.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ #pragma once -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class SkBitmap; class TabContentsWrapper; // Per-tab class to handle snapshot functionality. -class SnapshotTabHelper : public TabContentsObserver { +class SnapshotTabHelper : public content::WebContentsObserver { public: explicit SnapshotTabHelper(TabContentsWrapper* wrapper); virtual ~SnapshotTabHelper(); @@ -21,7 +21,7 @@ class SnapshotTabHelper : public TabContentsObserver { void CaptureSnapshot(); private: - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Internal helpers ---------------------------------------------------------- diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc index 10ecac5..000df30 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.cc +++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc @@ -12,7 +12,7 @@ #include "ui/base/l10n/l10n_util.h" CoreTabHelper::CoreTabHelper(TabContentsWrapper* wrapper) - : TabContentsObserver(wrapper->tab_contents()), + : content::WebContentsObserver(wrapper->tab_contents()), delegate_(NULL), wrapper_(wrapper) { } @@ -74,7 +74,7 @@ string16 CoreTabHelper::GetStatusText() const { } //////////////////////////////////////////////////////////////////////////////// -// TabContentsObserver overrides +// WebContentsObserver overrides void CoreTabHelper::DidBecomeSelected() { WebCacheManager::GetInstance()->ObserveActivity( diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h index 23e25d0..cd37ccd 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.h +++ b/chrome/browser/ui/tab_contents/core_tab_helper.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ #pragma once -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class CoreTabHelperDelegate; class TabContentsWrapper; // Per-tab class to handle functionality that is core to the operation of tabs. -class CoreTabHelper : public TabContentsObserver { +class CoreTabHelper : public content::WebContentsObserver { public: explicit CoreTabHelper(TabContentsWrapper* wrapper); virtual ~CoreTabHelper(); @@ -27,7 +27,7 @@ class CoreTabHelper : public TabContentsObserver { string16 GetStatusText() const; private: - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void DidBecomeSelected() OVERRIDE; // Delegate for notifying our owner about stuff. Not owned by us. diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index 7705c3f..0135aa4 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -58,7 +58,7 @@ static base::LazyInstance<base::PropertyAccessor<TabContentsWrapper*> > // TabContentsWrapper, public: TabContentsWrapper::TabContentsWrapper(TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), in_destructor_(false), tab_contents_(contents) { DCHECK(contents); @@ -176,7 +176,7 @@ Profile* TabContentsWrapper::profile() const { } //////////////////////////////////////////////////////////////////////////////// -// TabContentsObserver overrides +// WebContentsObserver overrides void TabContentsWrapper::TabContentsDestroyed(TabContents* tab) { // Destruction of the TabContents should only be done by us from our diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h index 08345c5..0f9813c 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h @@ -14,7 +14,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/property_bag.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class AlternateErrorPageTabObserver; class AutocompleteHistoryManager; @@ -52,10 +52,6 @@ class ThumbnailGenerator; class TranslateTabHelper; class WebIntentPickerController; -namespace IPC { -class Message; -} - namespace prerender { class PrerenderTabHelper; } @@ -76,7 +72,7 @@ class SafeBrowsingTabObserver; // TODO(avi): Eventually, this class will become TabContents as far as // the browser front-end is concerned, and the current TabContents will be // renamed to something like WebContents; <http://crbug.com/105875>. -class TabContentsWrapper : public TabContentsObserver { +class TabContentsWrapper : public content::WebContentsObserver { public: // Takes ownership of |contents|, which must be heap-allocated (as it lives // in a scoped_ptr) and can not be NULL. @@ -190,7 +186,7 @@ class TabContentsWrapper : public TabContentsObserver { // Overrides ----------------------------------------------------------------- - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; private: diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index 9c89b2e..bc78c3d 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -77,20 +77,20 @@ class HungPagesTableModel : public views::GroupTableModel { private: // Used to track a single TabContents. If the TabContents is destroyed // TabDestroyed() is invoked on the model. - class TabContentsObserverImpl : public TabContentsObserver { + class WebContentsObserverImpl : public content::WebContentsObserver { public: - TabContentsObserverImpl(HungPagesTableModel* model, + WebContentsObserverImpl(HungPagesTableModel* model, TabContentsWrapper* tab); TabContents* tab_contents() const { - return TabContentsObserver::tab_contents(); + return content::WebContentsObserver::tab_contents(); } FaviconTabHelper* favicon_tab_helper() { return tab_->favicon_tab_helper(); } - // TabContentsObserver overrides: + // WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; @@ -98,14 +98,14 @@ class HungPagesTableModel : public views::GroupTableModel { HungPagesTableModel* model_; TabContentsWrapper* tab_; - DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); }; // Invoked when a TabContents is destroyed. Cleans up |tab_observers_| and // notifies the observer and delegate. - void TabDestroyed(TabContentsObserverImpl* tab); + void TabDestroyed(WebContentsObserverImpl* tab); - typedef ScopedVector<TabContentsObserverImpl> TabObservers; + typedef ScopedVector<WebContentsObserverImpl> TabObservers; TabObservers tab_observers_; ui::TableModelObserver* observer_; @@ -142,12 +142,12 @@ void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { TabContentsWrapper* hung_wrapper = TabContentsWrapper::GetCurrentWrapperForContents(hung_contents); if (hung_wrapper) - tab_observers_.push_back(new TabContentsObserverImpl(this, hung_wrapper)); + tab_observers_.push_back(new WebContentsObserverImpl(this, hung_wrapper)); for (TabContentsIterator it; !it.done(); ++it) { if (*it != hung_wrapper && it->tab_contents()->GetRenderProcessHost() == hung_contents->GetRenderProcessHost()) - tab_observers_.push_back(new TabContentsObserverImpl(this, *it)); + tab_observers_.push_back(new WebContentsObserverImpl(this, *it)); } } // The world is different. @@ -190,7 +190,7 @@ void HungPagesTableModel::GetGroupRangeForItem(int item, range->length = RowCount(); } -void HungPagesTableModel::TabDestroyed(TabContentsObserverImpl* tab) { +void HungPagesTableModel::TabDestroyed(WebContentsObserverImpl* tab) { // Clean up tab_observers_ and notify our observer. TabObservers::iterator i = std::find( tab_observers_.begin(), tab_observers_.end(), tab); @@ -205,20 +205,20 @@ void HungPagesTableModel::TabDestroyed(TabContentsObserverImpl* tab) { // WARNING: we've likely been deleted. } -HungPagesTableModel::TabContentsObserverImpl::TabContentsObserverImpl( +HungPagesTableModel::WebContentsObserverImpl::WebContentsObserverImpl( HungPagesTableModel* model, TabContentsWrapper* tab) - : TabContentsObserver(tab->tab_contents()), + : content::WebContentsObserver(tab->tab_contents()), model_(model), tab_(tab) { } -void HungPagesTableModel::TabContentsObserverImpl::RenderViewGone( +void HungPagesTableModel::WebContentsObserverImpl::RenderViewGone( base::TerminationStatus status) { model_->TabDestroyed(this); } -void HungPagesTableModel::TabContentsObserverImpl::TabContentsDestroyed( +void HungPagesTableModel::WebContentsObserverImpl::TabContentsDestroyed( TabContents* tab) { model_->TabDestroyed(this); } diff --git a/chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.cc b/chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.cc index 6da4b32..b6ad7ad 100644 --- a/chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.cc +++ b/chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.cc @@ -20,8 +20,8 @@ #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents_observer.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/ime/text_input_type.h" @@ -65,7 +65,7 @@ gfx::Rect GetKeyboardPosition(int height) { class KeyboardWidget : public views::Widget, public ui::AnimationDelegate, - public TabContentsObserver, + public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate, #if defined(OS_CHROMEOS) public chromeos::input_method::InputMethodManager::VirtualKeyboardObserver, @@ -108,7 +108,7 @@ class KeyboardWidget virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; - // Overridden from TabContentsObserver. + // Overridden from content::WebContentsObserver. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; void OnRequest(const ExtensionHostMsg_Request_Params& params); @@ -199,7 +199,8 @@ KeyboardWidget::KeyboardWidget() SetContentsView(dom_view_); // Setup observer so the events from the keyboard can be handled. - TabContentsObserver::Observe(dom_view_->dom_contents()->tab_contents()); + content::WebContentsObserver::Observe( + dom_view_->dom_contents()->tab_contents()); // Initialize the animation. animation_.reset(new ui::SlideAnimation(this)); diff --git a/chrome/browser/ui/webui/constrained_html_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_html_ui_browsertest.cc index e70534a..20f1dad 100644 --- a/chrome/browser/ui/webui/constrained_html_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_html_ui_browsertest.cc @@ -14,14 +14,15 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" namespace { -class ConstrainedHtmlDialogBrowserTestObserver : public TabContentsObserver { +class ConstrainedHtmlDialogBrowserTestObserver + : public content::WebContentsObserver { public: explicit ConstrainedHtmlDialogBrowserTestObserver(TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), tab_destroyed_(false) { } virtual ~ConstrainedHtmlDialogBrowserTestObserver() {} diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.cc b/chrome/browser/ui/webui/hung_renderer_dialog.cc index 228c464..cfcbe1d 100644 --- a/chrome/browser/ui/webui/hung_renderer_dialog.cc +++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc @@ -74,22 +74,22 @@ void HungRendererDialog::HideHungRendererDialog(TabContents* contents) { } //////////////////////////////////////////////////////////////////////////////// -// HungRendererDialog::TabContentsObserverImpl +// HungRendererDialog::WebContentsObserverImpl -HungRendererDialog::TabContentsObserverImpl::TabContentsObserverImpl( +HungRendererDialog::WebContentsObserverImpl::WebContentsObserverImpl( HungRendererDialog* dialog, TabContents* contents) - : TabContentsObserver(contents), + : content::WebContentsObserver(contents), contents_(contents), dialog_(dialog) { } -void HungRendererDialog::TabContentsObserverImpl::RenderViewGone( +void HungRendererDialog::WebContentsObserverImpl::RenderViewGone( base::TerminationStatus status) { dialog_->HideDialog(contents_); } -void HungRendererDialog::TabContentsObserverImpl::TabContentsDestroyed( +void HungRendererDialog::WebContentsObserverImpl::TabContentsDestroyed( TabContents* tab) { dialog_->HideDialog(contents_); } @@ -124,7 +124,7 @@ void HungRendererDialog::ShowDialog(TabContents* contents) { DCHECK(browser); handler_ = new HungRendererDialogHandler(contents_); window_ = browser->BrowserShowHtmlDialog(this, NULL, STYLE_GENERIC); - contents_observer_.reset(new TabContentsObserverImpl(this, contents_)); + contents_observer_.reset(new WebContentsObserverImpl(this, contents_)); } void HungRendererDialog::HideDialog(TabContents* contents) { diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.h b/chrome/browser/ui/webui/hung_renderer_dialog.h index 9c042d2..f42b31c 100644 --- a/chrome/browser/ui/webui/hung_renderer_dialog.h +++ b/chrome/browser/ui/webui/hung_renderer_dialog.h @@ -13,10 +13,9 @@ #include "base/string16.h" #include "base/values.h" #include "chrome/browser/ui/webui/html_dialog_ui.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "ui/gfx/native_widget_types.h" -class TabContents; class HungRendererDialogHandler; class HungRendererDialog : private HtmlDialogUIDelegate { @@ -28,12 +27,12 @@ class HungRendererDialog : private HtmlDialogUIDelegate { static void HideHungRendererDialog(TabContents* contents); private: - class TabContentsObserverImpl : public TabContentsObserver { + class WebContentsObserverImpl : public content::WebContentsObserver { public: - TabContentsObserverImpl(HungRendererDialog* dialog, + WebContentsObserverImpl(HungRendererDialog* dialog, TabContents* contents); - // TabContentsObserver overrides: + // content::WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; @@ -41,7 +40,7 @@ class HungRendererDialog : private HtmlDialogUIDelegate { TabContents* contents_; // weak HungRendererDialog* dialog_; // weak - DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); }; friend class HungRendererDialogUITest; @@ -88,7 +87,7 @@ class HungRendererDialog : private HtmlDialogUIDelegate { // The dialog window. gfx::NativeWindow window_; - scoped_ptr<TabContentsObserverImpl> contents_observer_; + scoped_ptr<WebContentsObserverImpl> contents_observer_; DISALLOW_COPY_AND_ASSIGN(HungRendererDialog); }; diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 9459bd1..f091434 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -47,11 +47,11 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents_observer.h" #include "content/test/test_navigation_observer.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" @@ -75,10 +75,11 @@ namespace ui_test_utils { namespace { class DOMOperationObserver : public content::NotificationObserver, - public TabContentsObserver { + public content::WebContentsObserver { public: explicit DOMOperationObserver(RenderViewHost* render_view_host) - : TabContentsObserver(render_view_host->delegate()->GetAsTabContents()), + : content::WebContentsObserver( + render_view_host->delegate()->GetAsTabContents()), did_respond_(false) { registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, content::Source<RenderViewHost>(render_view_host)); @@ -95,7 +96,7 @@ class DOMOperationObserver : public content::NotificationObserver, MessageLoopForUI::current()->Quit(); } - // Overridden from content::TabContentsObserver: + // Overridden from content::WebContentsObserver: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE { MessageLoopForUI::current()->Quit(); } diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc index 859ca0d..2d1d81e 100644 --- a/content/browser/debugger/devtools_http_handler_impl.cc +++ b/content/browser/debugger/devtools_http_handler_impl.cc @@ -18,13 +18,13 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/devtools_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/devtools_client_host.h" #include "content/public/browser/devtools_http_handler_delegate.h" #include "content/public/browser/devtools_manager.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" @@ -78,7 +78,7 @@ class DevToolsClientHostImpl : public DevToolsClientHost { static int next_id = 1; -class TabContentsIDHelper : public TabContentsObserver { +class TabContentsIDHelper : public content::WebContentsObserver { public: static int GetID(TabContents* tab) { @@ -98,7 +98,7 @@ class TabContentsIDHelper : public TabContentsObserver { private: explicit TabContentsIDHelper(TabContents* tab) - : TabContentsObserver(tab), + : content::WebContentsObserver(tab), id_(next_id++) { id_to_tabcontents_.Get()[id_] = tab; tabcontents_to_id_.Get()[tab] = id_; diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index e84ef66..dc0ba5d 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -116,7 +116,7 @@ SavePackage::SavePackage(TabContents* tab_contents, SavePackageType save_type, const FilePath& file_full_path, const FilePath& directory_full_path) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), file_manager_(NULL), download_manager_(NULL), download_(NULL), @@ -145,7 +145,7 @@ SavePackage::SavePackage(TabContents* tab_contents, } SavePackage::SavePackage(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), file_manager_(NULL), download_manager_(NULL), download_(NULL), @@ -171,7 +171,7 @@ SavePackage::SavePackage(TabContents* tab_contents) SavePackage::SavePackage(TabContents* tab_contents, const FilePath& file_full_path, const FilePath& directory_full_path) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), file_manager_(NULL), download_manager_(NULL), download_(NULL), diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index a584adc..5e36b70 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h @@ -18,16 +18,15 @@ #include "base/memory/weak_ptr.h" #include "base/task.h" #include "base/time.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/content_export.h" #include "content/public/browser/download_item.h" +#include "content/public/browser/web_contents_observer.h" #include "googleurl/src/gurl.h" class GURL; class SaveFileManager; class SaveItem; class SavePackage; -class TabContents; struct SaveFileCreateInfo; namespace content { @@ -48,7 +47,7 @@ class DownloadManager; // saving job, and exist for the duration of one tab's life time. class CONTENT_EXPORT SavePackage : public base::RefCountedThreadSafe<SavePackage>, - public TabContentsObserver, + public content::WebContentsObserver, public content::DownloadItem::Observer, public base::SupportsWeakPtr<SavePackage> { public: @@ -124,7 +123,7 @@ class CONTENT_EXPORT SavePackage int tab_id() const { return tab_id_; } int id() const { return unique_id_; } TabContents* tab_contents() const { - return TabContentsObserver::tab_contents(); + return content::WebContentsObserver::tab_contents(); } void GetSaveInfo(); @@ -156,7 +155,7 @@ class CONTENT_EXPORT SavePackage void SaveNextFile(bool process_all_remainder_items); void DoSavingProcess(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // DownloadItem::Observer implementation. diff --git a/content/browser/intents/intent_injector.cc b/content/browser/intents/intent_injector.cc index 20e67aa..96a201a 100644 --- a/content/browser/intents/intent_injector.cc +++ b/content/browser/intents/intent_injector.cc @@ -16,7 +16,7 @@ #include "webkit/glue/web_intent_reply_data.h" IntentInjector::IntentInjector(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + : content::WebContentsObserver(tab_contents), intents_dispatcher_(NULL) { DCHECK(tab_contents); } @@ -60,7 +60,7 @@ void IntentInjector::DidNavigateMainFrame( // RenderViewHostObserver, and do this on RenderViewHostInitialized. There's no // good hooks for attaching the intent to such an object, though. All RVHOs get // made deep inside tab contents initialization. Idea: propagate out -// RenderViewHostInitialized to a TabContentsObserver latch? That still looks +// RenderViewHostInitialized to a WebContentsObserver latch? That still looks // like it might be racy, though. void IntentInjector::SendIntent() { if (source_intent_.get() == NULL || diff --git a/content/browser/intents/intent_injector.h b/content/browser/intents/intent_injector.h index 2481ecf..6add88a 100644 --- a/content/browser/intents/intent_injector.h +++ b/content/browser/intents/intent_injector.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/string16.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "content/common/content_export.h" #include "webkit/glue/web_intent_reply_data.h" @@ -25,13 +25,13 @@ struct WebIntentData; // the context of the service, which will be running in the TabContents on which // this class is an observer. Attaches to the service tab and deletes itself // when that TabContents is closed. -class CONTENT_EXPORT IntentInjector : public TabContentsObserver { +class CONTENT_EXPORT IntentInjector : public content::WebContentsObserver { public: // |tab_contents| must not be NULL. explicit IntentInjector(TabContents* tab_contents); virtual ~IntentInjector(); - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, diff --git a/content/browser/intents/web_intents_dispatcher_impl.cc b/content/browser/intents/web_intents_dispatcher_impl.cc index a7e1402..10a32b7 100644 --- a/content/browser/intents/web_intents_dispatcher_impl.cc +++ b/content/browser/intents/web_intents_dispatcher_impl.cc @@ -13,7 +13,7 @@ WebIntentsDispatcherImpl::WebIntentsDispatcherImpl( TabContents* source_tab, const webkit_glue::WebIntentData& intent, int intent_id) - : TabContentsObserver(source_tab), + : content::WebContentsObserver(source_tab), intent_(intent), intent_id_(intent_id), intent_injector_(NULL) {} diff --git a/content/browser/intents/web_intents_dispatcher_impl.h b/content/browser/intents/web_intents_dispatcher_impl.h index 79c0b8d..6336b90 100644 --- a/content/browser/intents/web_intents_dispatcher_impl.h +++ b/content/browser/intents/web_intents_dispatcher_impl.h @@ -7,7 +7,7 @@ #include "base/callback.h" #include "base/compiler_specific.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_intents_dispatcher.h" #include "webkit/glue/web_intent_data.h" @@ -19,7 +19,7 @@ class IntentInjector; // be delivered to the service and serves as a forwarder for sending reply // messages back to the client page. class WebIntentsDispatcherImpl : public content::WebIntentsDispatcher, - public TabContentsObserver { + public content::WebContentsObserver { public: // |source_tab| is the page which triggered the web intent. // |intent| is the intent payload created by that page. @@ -37,7 +37,7 @@ class WebIntentsDispatcherImpl : public content::WebIntentsDispatcher, const string16& data) OVERRIDE; virtual void RegisterReplyNotification(const base::Closure& closure) OVERRIDE; - // TabContentsObserver implementation. + // content::WebContentsObserver implementation. virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; private: diff --git a/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc b/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc index 886146f..f2921c0 100644 --- a/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc +++ b/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc @@ -11,7 +11,7 @@ JavaBridgeDispatcherHostManager::JavaBridgeDispatcherHostManager( TabContents* tab_contents) - : TabContentsObserver(tab_contents) { + : content::WebContentsObserver(tab_contents) { } JavaBridgeDispatcherHostManager::~JavaBridgeDispatcherHostManager() { diff --git a/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h b/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h index f3b3e83..84830b7 100644 --- a/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h +++ b/content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h @@ -11,7 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/string16.h" -#include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/public/browser/web_contents_observer.h" class JavaBridgeDispatcherHost; class RenderViewHost; @@ -20,7 +20,7 @@ struct NPObject; // This class handles injecting Java objects into all of the RenderViews // associated with a TabContents. It manages a set of JavaBridgeDispatcherHost // objects, one per RenderViewHost. -class JavaBridgeDispatcherHostManager : public TabContentsObserver { +class JavaBridgeDispatcherHostManager : public content::WebContentsObserver { public: JavaBridgeDispatcherHostManager(TabContents* tab_contents); virtual ~JavaBridgeDispatcherHostManager(); @@ -31,7 +31,7 @@ class JavaBridgeDispatcherHostManager : public TabContentsObserver { void AddNamedObject(const string16& name, NPObject* object); void RemoveNamedObject(const string16& name); - // TabContentsObserver overrides + // content::WebContentsObserver overrides virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; virtual void TabContentsDestroyed(TabContents* tab_contents) OVERRIDE; diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc index d7c5cf8..22204ce 100644 --- a/content/browser/renderer_host/render_view_host_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_browsertest.cc @@ -10,9 +10,9 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/view_messages.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents_observer.h" #include "net/base/host_port_pair.h" #include "net/base/net_util.h" #include "net/test/test_server.h" @@ -161,12 +161,13 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, } } -class RenderViewHostTestTabContentsObserver : public TabContentsObserver { +class RenderViewHostTestWebContentsObserver + : public content::WebContentsObserver { public: - explicit RenderViewHostTestTabContentsObserver(TabContents* tab_contents) - : TabContentsObserver(tab_contents), + explicit RenderViewHostTestWebContentsObserver(TabContents* tab_contents) + : content::WebContentsObserver(tab_contents), navigation_count_(0) {} - virtual ~RenderViewHostTestTabContentsObserver() {} + virtual ~RenderViewHostTestWebContentsObserver() {} virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, @@ -191,12 +192,12 @@ class RenderViewHostTestTabContentsObserver : public TabContentsObserver { GURL base_url_; int navigation_count_; - DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestTabContentsObserver); + DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestWebContentsObserver); }; IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { ASSERT_TRUE(test_server()->Start()); - RenderViewHostTestTabContentsObserver observer( + RenderViewHostTestWebContentsObserver observer( browser()->GetSelectedTabContents()); GURL test_url = test_server()->GetURL("files/simple.html"); @@ -209,7 +210,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) { ASSERT_TRUE(test_server()->Start()); - RenderViewHostTestTabContentsObserver observer( + RenderViewHostTestWebContentsObserver observer( browser()->GetSelectedTabContents()); // Base URL is not set if it is the same as the URL. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 3997aac..0cb1762 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -30,7 +30,6 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/provisional_load_details.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/tab_contents/title_updated_details.h" #include "content/browser/webui/web_ui_factory.h" @@ -44,6 +43,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_restriction.h" @@ -112,6 +112,7 @@ using content::DevToolsManagerImpl; using content::DownloadItem; using content::DownloadManager; using content::UserMetricsAction; +using content::WebContentsObserver; namespace { @@ -264,7 +265,7 @@ TabContents::~TabContents() { base::TimeTicks::Now() - tab_close_start_time_); } - FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, TabContentsDestroyed()); SetDelegate(NULL); } @@ -273,8 +274,8 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { if (GetWebUI() && GetWebUI()->OnMessageReceived(message)) return true; - ObserverListBase<TabContentsObserver>::Iterator it(observers_); - TabContentsObserver* observer; + ObserverListBase<WebContentsObserver>::Iterator it(observers_); + WebContentsObserver* observer; while ((observer = it.GetNext()) != NULL) if (observer->OnMessageReceived(message)) return true; @@ -549,7 +550,7 @@ void TabContents::DidBecomeSelected() { last_selected_time_ = base::TimeTicks::Now(); - FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidBecomeSelected()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidBecomeSelected()); } @@ -605,7 +606,7 @@ RenderViewHostManager* TabContents::GetRenderManagerForTesting() { void TabContents::Stop() { render_manager_.Stop(); - FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, StopNavigation()); } TabContents* TabContents::Clone() { @@ -656,11 +657,11 @@ void TabContents::Focus() { view_->Focus(); } -void TabContents::AddObserver(TabContentsObserver* observer) { +void TabContents::AddObserver(WebContentsObserver* observer) { observers_.AddObserver(observer); } -void TabContents::RemoveObserver(TabContentsObserver* observer) { +void TabContents::RemoveObserver(WebContentsObserver* observer) { observers_.RemoveObserver(observer); } @@ -755,7 +756,7 @@ TabContents* TabContents::OpenURL(const OpenURLParams& params) { if (delegate_) { TabContents* new_contents = delegate_->OpenURLFromTab(this, params); // Notify observers. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidOpenURL(params.url, params.referrer, params.disposition, params.transition)); return new_contents; @@ -818,7 +819,7 @@ bool TabContents::NavigateToEntry( } // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigateToPendingEntry(entry.url(), reload_type)); @@ -1129,13 +1130,13 @@ void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, render_manager_.pending_render_view_host() ? render_manager_.pending_render_view_host() : GetRenderViewHost(); // Notify observers about the start of the provisional load. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartProvisionalLoadForFrame(frame_id, is_main_frame, validated_url, is_error_page, rvh)); if (is_main_frame) { // Notify observers about the provisional change in the main frame URL. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, ProvisionalChangeToMainFrameUrl(url, opener_url)); } } @@ -1156,7 +1157,7 @@ void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, return; // Notify observers about the provisional change in the main frame URL. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, ProvisionalChangeToMainFrameUrl(target_url, opener_url)); } @@ -1228,7 +1229,7 @@ void TabContents::OnDidFailProvisionalLoadWithError( content::Source<NavigationController>(&controller_), content::Details<ProvisionalLoadDetails>(&details)); - FOR_EACH_OBSERVER(TabContentsObserver, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidFailProvisionalLoad(params.frame_id, params.is_main_frame, @@ -1285,7 +1286,7 @@ void TabContents::OnDidRunInsecureContent( void TabContents::OnDocumentLoadedInFrame(int64 frame_id) { controller_.DocumentLoadedInFrame(); - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DocumentLoadedInFrame(frame_id)); } @@ -1293,7 +1294,7 @@ void TabContents::OnDidFinishLoad( int64 frame_id, const GURL& validated_url, bool is_main_frame) { - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidFinishLoad(frame_id, validated_url, is_main_frame)); } @@ -1302,7 +1303,7 @@ void TabContents::OnDidFailLoadWithError(int64 frame_id, bool is_main_frame, int error_code, const string16& error_description) { - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidFailLoad(frame_id, validated_url, is_main_frame, error_code, error_description)); } @@ -1387,7 +1388,7 @@ void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { void TabContents::OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy) { // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, AppCacheAccessed(manifest_url, blocked_by_policy)); } @@ -1460,7 +1461,7 @@ void TabContents::DidNavigateMainFramePostCommit( } // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidNavigateMainFrame(details, params)); } @@ -1477,7 +1478,7 @@ void TabContents::DidNavigateAnyFramePostCommit( } // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidNavigateAnyFrame(details, params)); } @@ -1611,7 +1612,7 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { GetView()->RenderViewCreated(render_view_host); FOR_EACH_OBSERVER( - TabContentsObserver, observers_, RenderViewCreated(render_view_host)); + WebContentsObserver, observers_, RenderViewCreated(render_view_host)); } void TabContents::RenderViewReady(RenderViewHost* rvh) { @@ -1632,7 +1633,7 @@ void TabContents::RenderViewReady(RenderViewHost* rvh) { Focus(); } - FOR_EACH_OBSERVER(TabContentsObserver, observers_, RenderViewReady()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady()); } void TabContents::RenderViewGone(RenderViewHost* rvh, @@ -1648,14 +1649,14 @@ void TabContents::RenderViewGone(RenderViewHost* rvh, SetIsCrashed(status, error_code); GetView()->OnTabCrashed(GetCrashedStatus(), crashed_error_code_); - FOR_EACH_OBSERVER(TabContentsObserver, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewGone(GetCrashedStatus())); } void TabContents::RenderViewDeleted(RenderViewHost* rvh) { render_manager_.RenderViewDeleted(rvh); - FOR_EACH_OBSERVER(TabContentsObserver, observers_, RenderViewDeleted(rvh)); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); } void TabContents::DidNavigate(RenderViewHost* rvh, @@ -1701,7 +1702,7 @@ void TabContents::DidNavigate(RenderViewHost* rvh, params.transition | content::PAGE_TRANSITION_FORWARD_BACK); } // Notify observers about the commit of the provisional load. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidCommitProvisionalLoadForFrame(params.frame_id, is_main_frame, params.url, transition_type)); } @@ -1827,7 +1828,7 @@ void TabContents::DidStartLoading() { } // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidStartLoading()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartLoading()); } void TabContents::DidStopLoading() { @@ -1850,7 +1851,7 @@ void TabContents::DidStopLoading() { SetIsLoading(false, details.get()); // Notify observers about navigation. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidStopLoading()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStopLoading()); } void TabContents::DidCancelLoading() { @@ -1867,7 +1868,7 @@ void TabContents::DidChangeLoadProgress(double progress) { void TabContents::DocumentAvailableInMainFrame( RenderViewHost* render_view_host) { - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DocumentAvailableInMainFrame()); } @@ -1920,7 +1921,7 @@ void TabContents::RequestTransferURL(const GURL& url, } if (new_contents) { // Notify observers. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidOpenRequestedURL(new_contents, url, referrer, @@ -2025,7 +2026,7 @@ WebPreferences TabContents::GetWebkitPrefs() { void TabContents::OnUserGesture() { // Notify observers. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidGetUserGesture()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); ResourceDispatcherHost* rdh = content::GetContentClient()->browser()->GetResourceDispatcherHost(); @@ -2035,7 +2036,7 @@ void TabContents::OnUserGesture() { void TabContents::OnIgnoredUIEvent() { // Notify observers. - FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidGetIgnoredUIEvent()); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); } void TabContents::RendererUnresponsive(RenderViewHost* rvh, diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 46f5a056..8d5f61a 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -21,7 +21,6 @@ #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/page_navigator.h" #include "content/browser/tab_contents/render_view_host_manager.h" -#include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/content_export.h" #include "content/public/browser/web_contents.h" #include "content/public/common/renderer_preferences.h" @@ -36,12 +35,12 @@ class LoadNotificationDetails; class RenderViewHost; class SessionStorageNamespace; class SiteInstance; -class TabContentsObserver; class TabContentsView; struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; namespace content { class DownloadItem; +class WebContentsObserver; class WebContentsDelegate; } @@ -352,14 +351,14 @@ class CONTENT_EXPORT TabContents : public content::WebContents, virtual void OnDialogShown() OVERRIDE; protected: - friend class TabContentsObserver; + friend class content::WebContentsObserver; // Add and remove observers for page navigation notifications. Adding or // removing multiple times has no effect. The order in which notifications // are sent to observers is undefined. Clients must be sure to remove the // observer before they go away. - void AddObserver(TabContentsObserver* observer); - void RemoveObserver(TabContentsObserver* observer); + void AddObserver(content::WebContentsObserver* observer); + void RemoveObserver(content::WebContentsObserver* observer); private: friend class NavigationController; @@ -523,7 +522,7 @@ class CONTENT_EXPORT TabContents : public content::WebContents, // This MUST be listed above render_manager_ since at destruction time the // latter might cause RenderViewHost's destructor to call us and we might use // the observer list then. - ObserverList<TabContentsObserver> observers_; + ObserverList<content::WebContentsObserver> observers_; // Helper classes ------------------------------------------------------------ diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc deleted file mode 100644 index ac7477b..0000000 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/tab_contents/tab_contents_observer.h" - -#include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" -#include "content/public/browser/navigation_details.h" - -void TabContentsObserver::RenderViewCreated(RenderViewHost* render_view_host) { -} - -void TabContentsObserver::RenderViewDeleted(RenderViewHost* render_view_host) { -} - -void TabContentsObserver::RenderViewReady() { -} - -void TabContentsObserver::RenderViewGone(base::TerminationStatus status) { -} - -void TabContentsObserver::NavigateToPendingEntry( - const GURL& url, - NavigationController::ReloadType reload_type) { -} - -void TabContentsObserver::DidNavigateMainFrame( - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) { -} - -void TabContentsObserver::DidNavigateAnyFrame( - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) { -} - -void TabContentsObserver::DidStartProvisionalLoadForFrame( - int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - bool is_error_page, - RenderViewHost* render_view_host) { -} - -void TabContentsObserver::ProvisionalChangeToMainFrameUrl( - const GURL& url, - const GURL& opener_url) { -} - -void TabContentsObserver::DidCommitProvisionalLoadForFrame( - int64 frame_id, - bool is_main_frame, - const GURL& url, - content::PageTransition transition_type) { -} - -void TabContentsObserver::DidFailProvisionalLoad( - int64 frame_id, - bool is_main_frame, - const GURL& validated_url, - int error_code, - const string16& error_description) { -} - -void TabContentsObserver::DocumentAvailableInMainFrame() { -} - -void TabContentsObserver::DocumentLoadedInFrame(int64 frame_id) { -} - -void TabContentsObserver::DidFinishLoad( - int64 frame_id, - const GURL& validated_url, - bool is_main_frame) { -} - -void TabContentsObserver::DidFailLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - int error_code, - const string16& error_description) { -} - -void TabContentsObserver::DidGetUserGesture() { -} - -void TabContentsObserver::DidGetIgnoredUIEvent() { -} - -void TabContentsObserver::DidBecomeSelected() { -} - -void TabContentsObserver::DidStartLoading() { -} - -void TabContentsObserver::DidStopLoading() { -} - -void TabContentsObserver::StopNavigation() { -} - -void TabContentsObserver::DidOpenURL(const GURL& url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - content::PageTransition transition) { -} - -void TabContentsObserver::DidOpenRequestedURL( - TabContents* new_contents, - const GURL& url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - content::PageTransition transition, - int64 source_frame_id) { -} - -void TabContentsObserver::AppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy) { -} - -TabContentsObserver::TabContentsObserver(TabContents* tab_contents) - : tab_contents_(NULL) { - Observe(tab_contents); -} - -TabContentsObserver::TabContentsObserver() - : tab_contents_(NULL) { -} - -TabContentsObserver::~TabContentsObserver() { - if (tab_contents_) - tab_contents_->RemoveObserver(this); -} - -void TabContentsObserver::Observe(TabContents* tab_contents) { - if (tab_contents_) - tab_contents_->RemoveObserver(this); - tab_contents_ = tab_contents; - if (tab_contents_) { - tab_contents_->AddObserver(this); - } -} - -void TabContentsObserver::TabContentsDestroyed(TabContents* tab) { -} - -bool TabContentsObserver::OnMessageReceived(const IPC::Message& message) { - return false; -} - -bool TabContentsObserver::Send(IPC::Message* message) { - if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) { - delete message; - return false; - } - - return tab_contents_->GetRenderViewHost()->Send(message); -} - -int TabContentsObserver::routing_id() const { - if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) - return MSG_ROUTING_NONE; - - return tab_contents_->GetRenderViewHost()->routing_id(); -} - -void TabContentsObserver::TabContentsDestroyed() { - // Do cleanup so that 'this' can safely be deleted from - // TabContentsDestroyed. - tab_contents_->RemoveObserver(this); - TabContents* tab = tab_contents_; - tab_contents_ = NULL; - TabContentsDestroyed(tab); -} diff --git a/content/content_browser.gypi b/content/content_browser.gypi index d2b33b2..8d85b62 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -73,6 +73,8 @@ 'public/browser/web_contents.h', 'public/browser/web_contents_delegate.cc', 'public/browser/web_contents_delegate.h', + 'public/browser/web_contents_observer.cc', + 'public/browser/web_contents_observer.h', 'public/browser/web_intents_dispatcher.h', 'browser/accessibility/browser_accessibility.cc', 'browser/accessibility/browser_accessibility.h', @@ -595,8 +597,6 @@ 'browser/tab_contents/render_view_host_manager.h', 'browser/tab_contents/tab_contents.cc', 'browser/tab_contents/tab_contents.h', - 'browser/tab_contents/tab_contents_observer.cc', - 'browser/tab_contents/tab_contents_observer.h', 'browser/tab_contents/tab_contents_view.cc', 'browser/tab_contents/tab_contents_view.h', 'browser/tab_contents/title_updated_details.h', diff --git a/content/public/browser/DEPS b/content/public/browser/DEPS index 2f3c1e2..9e39647 100644 --- a/content/public/browser/DEPS +++ b/content/public/browser/DEPS @@ -7,6 +7,7 @@ include_rules = [ "+content/browser/download/save_package.h", "+content/browser/download/interrupt_reasons.h", "+content/browser/javascript_dialogs.h", + "+content/browser/tab_contents/navigation_controller.h", "+content/browser/tab_contents/navigation_entry.h", "+content/browser/tab_contents/tab_contents.h", "+content/browser/webui/web_ui.h", diff --git a/content/public/browser/web_contents_observer.cc b/content/public/browser/web_contents_observer.cc new file mode 100644 index 0000000..2ec882b --- /dev/null +++ b/content/public/browser/web_contents_observer.cc @@ -0,0 +1,65 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/browser/web_contents_observer.h" + +#include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_details.h" + +namespace content { + +WebContentsObserver::WebContentsObserver(TabContents* tab_contents) + : tab_contents_(NULL) { + Observe(tab_contents); +} + +WebContentsObserver::WebContentsObserver() + : tab_contents_(NULL) { +} + +WebContentsObserver::~WebContentsObserver() { + if (tab_contents_) + tab_contents_->RemoveObserver(this); +} + +void WebContentsObserver::Observe(TabContents* tab_contents) { + if (tab_contents_) + tab_contents_->RemoveObserver(this); + tab_contents_ = tab_contents; + if (tab_contents_) { + tab_contents_->AddObserver(this); + } +} + +bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { + return false; +} + +bool WebContentsObserver::Send(IPC::Message* message) { + if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) { + delete message; + return false; + } + + return tab_contents_->GetRenderViewHost()->Send(message); +} + +int WebContentsObserver::routing_id() const { + if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) + return MSG_ROUTING_NONE; + + return tab_contents_->GetRenderViewHost()->routing_id(); +} + +void WebContentsObserver::TabContentsDestroyed() { + // Do cleanup so that 'this' can safely be deleted from + // TabContentsDestroyed. + tab_contents_->RemoveObserver(this); + TabContents* tab = tab_contents_; + tab_contents_ = NULL; + TabContentsDestroyed(tab); +} + +} // namespace content diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/public/browser/web_contents_observer.h index b774b6a..a3d713f 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ -#define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ +#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ +#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ #include "base/process_util.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -13,30 +13,31 @@ #include "webkit/glue/window_open_disposition.h" class RenderViewHost; +class TabContents; namespace content { + struct FrameNavigateParams; struct Referrer; -} // An observer API implemented by classes which are interested in various page // load events from TabContents. They also get a chance to filter IPC messages. -class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener, +class CONTENT_EXPORT WebContentsObserver : public IPC::Channel::Listener, public IPC::Message::Sender { public: - virtual void RenderViewCreated(RenderViewHost* render_view_host); - virtual void RenderViewDeleted(RenderViewHost* render_view_host); - virtual void RenderViewReady(); - virtual void RenderViewGone(base::TerminationStatus status); + virtual void RenderViewCreated(RenderViewHost* render_view_host) {} + virtual void RenderViewDeleted(RenderViewHost* render_view_host) {} + virtual void RenderViewReady() {} + virtual void RenderViewGone(base::TerminationStatus status) {} virtual void NavigateToPendingEntry( const GURL& url, - NavigationController::ReloadType reload_type); + NavigationController::ReloadType reload_type) {} virtual void DidNavigateMainFrame( - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params); + const LoadCommittedDetails& details, + const FrameNavigateParams& params) {} virtual void DidNavigateAnyFrame( - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params); + const LoadCommittedDetails& details, + const FrameNavigateParams& params) {} // |render_view_host| is the RenderViewHost for which the provisional load is // happening. virtual void DidStartProvisionalLoadForFrame( @@ -44,65 +45,59 @@ class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener, bool is_main_frame, const GURL& validated_url, bool is_error_page, - RenderViewHost* render_view_host); + RenderViewHost* render_view_host) {} virtual void ProvisionalChangeToMainFrameUrl(const GURL& url, - const GURL& opener_url); + const GURL& opener_url) {} virtual void DidCommitProvisionalLoadForFrame( int64 frame_id, bool is_main_frame, const GURL& url, - content::PageTransition transition_type); + PageTransition transition_type) {} virtual void DidFailProvisionalLoad(int64 frame_id, bool is_main_frame, const GURL& validated_url, int error_code, - const string16& error_description); - virtual void DocumentAvailableInMainFrame(); - virtual void DocumentLoadedInFrame(int64 frame_id); + const string16& error_description) {} + virtual void DocumentAvailableInMainFrame() {} + virtual void DocumentLoadedInFrame(int64 frame_id) {} virtual void DidFinishLoad(int64 frame_id, const GURL& validated_url, - bool is_main_frame); + bool is_main_frame) {} virtual void DidFailLoad(int64 frame_id, const GURL& validated_url, bool is_main_frame, int error_code, - const string16& error_description); - virtual void DidGetUserGesture(); - virtual void DidGetIgnoredUIEvent(); - virtual void DidBecomeSelected(); + const string16& error_description) {} + virtual void DidGetUserGesture() {} + virtual void DidGetIgnoredUIEvent() {} + virtual void DidBecomeSelected() {} - virtual void DidStartLoading(); - virtual void DidStopLoading(); - virtual void StopNavigation(); + virtual void DidStartLoading() {} + virtual void DidStopLoading() {} + virtual void StopNavigation() {} virtual void DidOpenURL(const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, - content::PageTransition transition); + PageTransition transition) {} virtual void DidOpenRequestedURL(TabContents* new_contents, const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, - content::PageTransition transition, - int64 source_frame_id); + PageTransition transition, + int64 source_frame_id) {} virtual void AppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy); -#if 0 - // For unifying with delegate... - - // Notifies the delegate that this contents is starting or is done loading - // some resource. The delegate should use this notification to represent - // loading feedback. See TabContents::IsLoading() - virtual void LoadingStateChanged(TabContents* contents) { } - // Called to inform the delegate that the tab content's navigation state - // changed. The |changed_flags| indicates the parts of the navigation state - // that have been updated, and is any combination of the - // |TabContents::InvalidateTypes| bits. - virtual void NavigationStateChanged(const TabContents* source, - unsigned changed_flags) { } -#endif + bool blocked_by_policy) {} + + // Invoked when the TabContents is being destroyed. Gives subclasses a chance + // to cleanup. At the time this is invoked |tab_contents()| returns NULL. + // It is safe to delete 'this' from here. + virtual void TabContentsDestroyed(TabContents* tab) {} + + // IPC::Channel::Listener implementation. + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // IPC::Message::Sender implementation. virtual bool Send(IPC::Message* message) OVERRIDE; @@ -111,30 +106,22 @@ class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener, protected: // Use this constructor when the object is tied to a single TabContents for // its entire lifetime. - explicit TabContentsObserver(TabContents* tab_contents); + explicit WebContentsObserver(TabContents* tab_contents); // Use this constructor when the object wants to observe a TabContents for // part of its lifetime. It can then call Observe() to start and stop // observing. - TabContentsObserver(); + WebContentsObserver(); - virtual ~TabContentsObserver(); + virtual ~WebContentsObserver(); // Start observing a different TabContents; used with the default constructor. void Observe(TabContents* tab_contents); - // Invoked when the TabContents is being destroyed. Gives subclasses a chance - // to cleanup. At the time this is invoked |tab_contents()| returns NULL. - // It is safe to delete 'this' from here. - virtual void TabContentsDestroyed(TabContents* tab); - - // IPC::Channel::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - TabContents* tab_contents() const { return tab_contents_; } private: - friend class TabContents; + friend class ::TabContents; // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out // |tab_contents_|. @@ -142,7 +129,9 @@ class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener, TabContents* tab_contents_; - DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); + DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); }; -#endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ diff --git a/content/public/common/frame_navigate_params.h b/content/public/common/frame_navigate_params.h index 56de737..6ae99eb 100644 --- a/content/public/common/frame_navigate_params.h +++ b/content/public/common/frame_navigate_params.h @@ -18,7 +18,7 @@ namespace content { -// Struct used by TabContentsObserver. +// Struct used by WebContentsObserver. struct CONTENT_EXPORT FrameNavigateParams { FrameNavigateParams(); ~FrameNavigateParams(); |