diff options
147 files changed, 1017 insertions, 907 deletions
diff --git a/apps/app_lifetime_monitor.cc b/apps/app_lifetime_monitor.cc index 0d258c6..84b6c82 100644 --- a/apps/app_lifetime_monitor.cc +++ b/apps/app_lifetime_monitor.cc @@ -10,6 +10,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_host.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" namespace apps { @@ -19,12 +20,12 @@ using extensions::ExtensionHost; AppLifetimeMonitor::AppLifetimeMonitor(Profile* profile) : profile_(profile) { - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, - content::NotificationService::AllSources()); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, - content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, + content::NotificationService::AllSources()); registrar_.Add( this, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); @@ -50,7 +51,7 @@ void AppLifetimeMonitor::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); const Extension* extension = host->extension(); if (!extension || !extension->is_platform_app()) @@ -60,7 +61,7 @@ void AppLifetimeMonitor::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); const Extension* extension = host->extension(); if (!extension || !extension->is_platform_app()) diff --git a/apps/app_load_service.cc b/apps/app_load_service.cc index 8378c41..9560851 100644 --- a/apps/app_load_service.cc +++ b/apps/app_load_service.cc @@ -8,7 +8,6 @@ #include "apps/app_restore_service.h" #include "apps/app_window_registry.h" #include "apps/launcher.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/profiles/profile.h" @@ -18,6 +17,7 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" using extensions::Extension; @@ -33,12 +33,12 @@ AppLoadService::PostReloadAction::PostReloadAction() AppLoadService::AppLoadService(Profile* profile) : profile_(profile) { - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, - content::NotificationService::AllSources()); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + content::NotificationService::AllSources()); } AppLoadService::~AppLoadService() {} @@ -85,7 +85,7 @@ void AppLoadService::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { extensions::ExtensionHost* host = content::Details<extensions::ExtensionHost>(details).ptr(); const Extension* extension = host->extension(); @@ -116,7 +116,7 @@ void AppLoadService::Observe(int type, post_reload_actions_.erase(it); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const extensions::UnloadedExtensionInfo* unload_info = content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); if (!unload_info->extension->is_platform_app()) diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc index f66b1be..d1d8790 100644 --- a/apps/app_restore_service_browsertest.cc +++ b/apps/app_restore_service_browsertest.cc @@ -6,13 +6,13 @@ #include "apps/app_restore_service_factory.h" #include "apps/saved_files_service.h" #include "chrome/browser/apps/app_browsertest_util.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/file_system/file_system_api.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" using extensions::Extension; @@ -29,7 +29,7 @@ namespace apps { // Tests that a running app is recorded in the preferences as such. IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, RunningAppsAreRecorded) { content::WindowedNotificationObserver extension_suspended( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); const Extension* extension = LoadExtension( @@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ActiveAppsAreRecorded) { IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { content::WindowedNotificationObserver extension_suspended( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); base::ScopedTempDir temp_directory; @@ -151,7 +151,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { content::WindowedNotificationObserver extension_suspended( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); base::ScopedTempDir temp_directory; diff --git a/apps/app_window.cc b/apps/app_window.cc index d3a752b..3f0ec2f 100644 --- a/apps/app_window.cc +++ b/apps/app_window.cc @@ -39,6 +39,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/extension.h" @@ -326,7 +327,7 @@ void AppWindow::Init(const GURL& url, extensions::ExtensionsBrowserClient* client = extensions::ExtensionsBrowserClient::Get(); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<content::BrowserContext>( client->GetOriginalContext(browser_context_))); // Close when the browser process is exiting. @@ -334,10 +335,11 @@ void AppWindow::Init(const GURL& url, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); // Update the app menu if an ephemeral app becomes installed. - registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, - content::Source<content::BrowserContext>( - client->GetOriginalContext(browser_context_))); + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::Source<content::BrowserContext>( + client->GetOriginalContext(browser_context_))); app_window_contents_->LoadContents(new_params.creator_process_id); @@ -996,7 +998,7 @@ void AppWindow::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const extensions::Extension* unloaded_extension = content::Details<extensions::UnloadedExtensionInfo>(details) ->extension; @@ -1004,7 +1006,7 @@ void AppWindow::Observe(int type, native_app_window_->Close(); break; } - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { const extensions::Extension* installed_extension = content::Details<const extensions::InstalledExtensionInfo>(details) ->extension; diff --git a/apps/saved_files_service.cc b/apps/saved_files_service.cc index f8053c0..36a7571 100644 --- a/apps/saved_files_service.cc +++ b/apps/saved_files_service.cc @@ -17,6 +17,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extension_util.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/permissions/api_permission.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/permissions_data.h" @@ -197,7 +198,7 @@ SavedFilesService::SavedFilesService(Profile* profile) : extension_id_to_saved_files_deleter_(&extension_id_to_saved_files_), profile_(profile) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, @@ -210,7 +211,7 @@ void SavedFilesService::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); const Extension* extension = host->extension(); if (extension) { diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index 65b54f1..7b73921 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -41,6 +41,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/pref_names.h" #include "extensions/common/api/app_runtime.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -938,9 +939,10 @@ namespace { class CheckExtensionInstalledObserver : public content::NotificationObserver { public: CheckExtensionInstalledObserver() : seen_(false) { - registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, - content::NotificationService::AllSources()); + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::NotificationService::AllSources()); } bool seen() const { diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc index bc122c6..5e04b36 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_browsertest.cc @@ -30,6 +30,7 @@ #include "extensions/browser/extension_registry_observer.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extension_util.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/uninstall_reason.h" #include "extensions/common/extension.h" @@ -202,7 +203,7 @@ const Extension* EphemeralAppTestBase::UpdateEphemeralApp( // Update the ephemeral app and wait for the update to finish. extensions::CrxInstaller* crx_installer = NULL; content::WindowedNotificationObserver windowed_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(crx_installer)); ExtensionService* service = ExtensionSystem::Get(profile())->extension_service(); @@ -223,7 +224,7 @@ void EphemeralAppTestBase::PromoteEphemeralApp( void EphemeralAppTestBase::CloseApp(const std::string& app_id) { content::WindowedNotificationObserver event_page_destroyed_signal( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<Profile>(profile())); EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); @@ -238,7 +239,7 @@ void EphemeralAppTestBase::EvictApp(const std::string& app_id) { // Uninstall the app, which is what happens when ephemeral apps get evicted // from the cache. content::WindowedNotificationObserver uninstalled_signal( - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::Source<Profile>(profile())); ExtensionService* service = @@ -697,7 +698,7 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, // The delayed installation will occur when the ephemeral app is closed. content::WindowedNotificationObserver installed_signal( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::Source<Profile>(profile())); InstallObserver installed_observer(profile()); CloseApp(app_id); diff --git a/chrome/browser/apps/ephemeral_app_service.cc b/chrome/browser/apps/ephemeral_app_service.cc index 6bbb8f3..46df9cf 100644 --- a/chrome/browser/apps/ephemeral_app_service.cc +++ b/chrome/browser/apps/ephemeral_app_service.cc @@ -18,6 +18,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extension_util.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/uninstall_reason.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" @@ -63,7 +64,8 @@ EphemeralAppService::EphemeralAppService(Profile* profile) return; extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile_)); registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(profile_)); @@ -113,7 +115,7 @@ void EphemeralAppService::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: { + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: { Init(); break; } diff --git a/chrome/browser/apps/ephemeral_app_service_browsertest.cc b/chrome/browser/apps/ephemeral_app_service_browsertest.cc index c1b8c2d..e6b4d41 100644 --- a/chrome/browser/apps/ephemeral_app_service_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_service_browsertest.cc @@ -10,6 +10,7 @@ #include "content/public/test/test_utils.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/manifest.h" using extensions::Extension; @@ -83,7 +84,7 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest, // Perform garbage collection. content::WindowedNotificationObserver uninstall_signal( - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::Source<Profile>(browser()->profile())); GarbageCollectEphemeralApps(); uninstall_signal.Wait(); diff --git a/chrome/browser/apps/event_page_browsertest.cc b/chrome/browser/apps/event_page_browsertest.cc index 1da70cb..76c48b3 100644 --- a/chrome/browser/apps/event_page_browsertest.cc +++ b/chrome/browser/apps/event_page_browsertest.cc @@ -3,11 +3,11 @@ // found in the LICENSE file. #include "chrome/browser/apps/app_browsertest_util.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "content/public/browser/notification_service.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/notification_types.h" using extensions::Extension; using extensions::PlatformAppBrowserTest; @@ -22,7 +22,7 @@ class AppEventPageTest : public PlatformAppBrowserTest { ASSERT_TRUE(extension); content::WindowedNotificationObserver event_page_suspended( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); // Close the app window. diff --git a/chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc b/chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc index e209d48..3ca13c2 100644 --- a/chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc +++ b/chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc @@ -5,7 +5,6 @@ #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" @@ -13,6 +12,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" namespace omnibox_api = extensions::api::omnibox; @@ -28,15 +28,16 @@ KeywordExtensionsDelegateImpl::KeywordExtensionsDelegateImpl( // Extension suggestions always come from the original profile, since that's // where extensions run. We use the input ID to distinguish whether the // suggestions are meant for us. + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, + content::Source<Profile>(profile()->GetOriginalProfile())); registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, + this, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, content::Source<Profile>(profile()->GetOriginalProfile())); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, - content::Source<Profile>(profile()->GetOriginalProfile())); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, - content::Source<Profile>(profile())); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, + content::Source<Profile>(profile())); } KeywordExtensionsDelegateImpl::~KeywordExtensionsDelegateImpl() { @@ -123,7 +124,7 @@ void KeywordExtensionsDelegateImpl::Observe( const AutocompleteInput& input = extension_suggest_last_input_; switch (type) { - case chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED: + case extensions::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED: // Input has been accepted, so we're done with this input session. Ensure // we don't send the OnInputCancelled event, or handle any more stray // suggestions_ready events. @@ -131,7 +132,8 @@ void KeywordExtensionsDelegateImpl::Observe( current_input_id_ = 0; return; - case chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED: { + case extensions::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED + : { // It's possible to change the default suggestion while not in an editing // session. base::string16 keyword, remaining_input; @@ -148,7 +150,7 @@ void KeywordExtensionsDelegateImpl::Observe( return; } - case chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY: { + case extensions::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY: { const omnibox_api::SendSuggestions::Params& suggestions = *content::Details< omnibox_api::SendSuggestions::Params>(details).ptr(); diff --git a/chrome/browser/autocomplete/shortcuts_backend.cc b/chrome/browser/autocomplete/shortcuts_backend.cc index 5acfc9f..50d3b63 100644 --- a/chrome/browser/autocomplete/shortcuts_backend.cc +++ b/chrome/browser/autocomplete/shortcuts_backend.cc @@ -30,6 +30,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" using content::BrowserThread; @@ -83,7 +84,8 @@ ShortcutsBackend::ShortcutsBackend(Profile* profile, bool suppress_db) // |profile| can be NULL in tests. if (profile) { notification_registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile)); notification_registrar_.Add( this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, @@ -175,7 +177,7 @@ void ShortcutsBackend::Observe(int type, if (!initialized()) return; - if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { + if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { // When an extension is unloaded, we want to remove any Shortcuts associated // with it. DeleteShortcutsWithURL(content::Details<extensions::UnloadedExtensionInfo>( diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc index f36be58..e802ce9 100644 --- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc @@ -21,7 +21,6 @@ #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" #include "chrome/browser/autocomplete/shortcuts_backend.h" #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/history/history_service.h" #include "chrome/browser/history/in_memory_url_index.h" #include "chrome/common/pref_names.h" @@ -33,6 +32,7 @@ #include "components/metrics/proto/omnibox_event.pb.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" @@ -840,7 +840,7 @@ TEST_F(ShortcutsProviderTest, Extension) { extensions::UnloadedExtensionInfo details( extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(&profile_), content::Details<extensions::UnloadedExtensionInfo>(&details)); diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc index 7945c4f..50c426b 100644 --- a/chrome/browser/background/background_application_list_model.cc +++ b/chrome/browser/background/background_application_list_model.cc @@ -27,6 +27,7 @@ #include "extensions/browser/extension_system.h" #include "extensions/browser/extension_util.h" #include "extensions/browser/image_loader.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" #include "extensions/common/extension_resource.h" @@ -179,16 +180,16 @@ BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile) ready_(false) { DCHECK(profile_); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, + extensions::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_SERVICE_CHANGED, @@ -353,7 +354,7 @@ void BackgroundApplicationListModel::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { + if (type == extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED) { Update(); ready_ = true; return; @@ -364,14 +365,14 @@ void BackgroundApplicationListModel::Observe( return; switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: OnExtensionLoaded(content::Details<Extension>(details).ptr()); break; - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: OnExtensionUnloaded( content::Details<UnloadedExtensionInfo>(details)->extension); break; - case chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: + case extensions::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: OnExtensionPermissionsUpdated( content::Details<UpdatedExtensionPermissionsInfo>(details)->extension, content::Details<UpdatedExtensionPermissionsInfo>(details)->reason, diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 1b22c25..27650a0 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -39,6 +39,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/image_loader.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" @@ -309,7 +310,8 @@ BackgroundContentsService::GetBackgroundContents() const void BackgroundContentsService::StartObserving(Profile* profile) { // On startup, load our background pages after extension-apps have loaded. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile)); // Track the lifecycle of all BackgroundContents in the system to allow us @@ -331,7 +333,8 @@ void BackgroundContentsService::StartObserving(Profile* profile) { // Track when the extensions crash so that the user can be notified // about it, and the crashed contents can be restarted. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, content::Source<Profile>(profile)); @@ -345,7 +348,7 @@ void BackgroundContentsService::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: { + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: { Profile* profile = content::Source<Profile>(source).ptr(); LoadBackgroundContentsFromManifests(profile); LoadBackgroundContentsFromPrefs(profile); @@ -385,7 +388,7 @@ void BackgroundContentsService::Observe( RegisterBackgroundContents(bgcontents); break; } - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: + case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: case chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED: { Profile* profile = content::Source<Profile>(source).ptr(); const Extension* extension = NULL; diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index b778aa8..d446626bc 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -299,7 +299,8 @@ void BackgroundModeManager::RegisterProfile(Profile* profile) { // Check for the presence of background apps after all extensions have been // loaded, to handle the case where an extension has been manually removed // while Chrome was not running. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile)); bmd->applications_->AddObserver(this); @@ -332,7 +333,7 @@ void BackgroundModeManager::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: // Extensions are loaded, so we don't need to manually keep the browser // process alive any more when running in no-startup-window mode. DecrementKeepAliveCountForStartup(); diff --git a/chrome/browser/chrome_notification_types.h b/chrome/browser/chrome_notification_types.h index 8810e5a..8fa0c3d 100644 --- a/chrome/browser/chrome_notification_types.h +++ b/chrome/browser/chrome_notification_types.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_CHROME_NOTIFICATION_TYPES_H_ #include "build/build_config.h" -#include "content/public/browser/notification_types.h" +#include "extensions/browser/notification_types.h" namespace chrome { enum NotificationType { - NOTIFICATION_CHROME_START = content::NOTIFICATION_CONTENT_END, + NOTIFICATION_CHROME_START = extensions::NOTIFICATION_EXTENSIONS_END, // Browser-window ---------------------------------------------------------- @@ -363,210 +363,6 @@ enum NotificationType { // are all source and no details. NOTIFICATION_SESSION_END, - // User Scripts ------------------------------------------------------------ - - // Sent when there are new user scripts available. The details are a - // pointer to SharedMemory containing the new scripts. - NOTIFICATION_USER_SCRIPTS_UPDATED, - - // Extensions -------------------------------------------------------------- - - // Sent when a CrxInstaller finishes. Source is the CrxInstaller that - // finished. The details are the extension which was installed. - NOTIFICATION_CRX_INSTALLER_DONE, - - // Sent when the known installed extensions have all been loaded. In - // testing scenarios this can happen multiple times if extensions are - // unloaded and reloaded. The source is a Profile. - NOTIFICATION_EXTENSIONS_READY, - - // DEPRECATED: Use ExtensionRegistry::AddObserver instead. - // - // Sent when a new extension is loaded. The details are an Extension, and - // the source is a Profile. - NOTIFICATION_EXTENSION_LOADED_DEPRECATED, - - // An error occured while attempting to load an extension. The details are a - // string with details about why the load failed. - NOTIFICATION_EXTENSION_LOAD_ERROR, - - // Sent when an extension is enabled. Under most circumstances, listeners - // will want to use NOTIFICATION_EXTENSION_LOADED_DEPRECATED. This - // notification is only - // fired when the "Enable" button is hit in the extensions tab. The details - // are an Extension, and the source is a Profile. - NOTIFICATION_EXTENSION_ENABLED, - - // Sent when attempting to load a new extension, but they are disabled. The - // details are an Extension*, and the source is a Profile*. - NOTIFICATION_EXTENSION_UPDATE_DISABLED, - - // Sent when an extension's permissions change. The details are an - // UpdatedExtensionPermissionsInfo, and the source is a Profile. - NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, - - // DEPRECATED: Use ExtensionRegistry::AddObserver instead. - // - // Sent immediately before new extensions are installed or existing - // extensions are updated. The details are an InstalledExtensionInfo, and the - // source is a Profile. - NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, - - // An error occured during extension install. The details are a string with - // details about why the install failed. - NOTIFICATION_EXTENSION_INSTALL_ERROR, - - // DEPRECATED: Use ExtensionRegistry::AddObserver instead. - // - // Sent when an extension has been uninstalled. The details are an Extension, - // and the source is a Profile. - NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, - - // Sent when an extension uninstall is not allowed because the extension is - // not user manageable. The details are an Extension, and the source is a - // Profile. - NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, - - // DEPRECATED: Use ExtensionRegistry::AddObserver instead. - // - // Sent when an extension is unloaded. This happens when an extension is - // uninstalled or disabled. The details are an UnloadedExtensionInfo, and - // the source is a Profile. - // - // Note that when this notification is sent, ExtensionService has already - // removed the extension from its internal state. - NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - - // Sent when an Extension object is removed from ExtensionService. This - // can happen when an extension is uninstalled, upgraded, or blacklisted, - // including all cases when the Extension is deleted. The details are an - // Extension, and the source is a Profile. - NOTIFICATION_EXTENSION_REMOVED, - - // Sent after a new ExtensionHost is created. The details are - // an ExtensionHost* and the source is a Profile*. - NOTIFICATION_EXTENSION_HOST_CREATED, - - // Sent before an ExtensionHost is destroyed. The details are - // an ExtensionHost* and the source is a Profile*. - NOTIFICATION_EXTENSION_HOST_DESTROYED, - - // Sent by an ExtensionHost when it has finished its initial page load, - // including any external resources. - // The details are an ExtensionHost* and the source is a Profile*. - NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, - - // Sent by an ExtensionHost when its render view requests closing through - // window.close(). The details are an ExtensionHost* and the source is a - // Profile*. - NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, - - // Sent when extension render process ends (whether it crashes or closes). - // The details are an ExtensionHost* and the source is a Profile*. Not sent - // during browser shutdown. - NOTIFICATION_EXTENSION_PROCESS_TERMINATED, - - // Sent when a background page is ready so other components can load. - NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, - - // Sent when a browser action's state has changed. The source is the - // ExtensionAction* that changed. The details are the Profile* that the - // browser action belongs to. - NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, - - // Sent when the count of page actions has changed. Note that some of them - // may not apply to the current page. The source is a LocationBar*. There - // are no details. - NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, - - // Sent when a browser action's visibility has changed. The source is the - // ExtensionPrefs* that changed, and the details are a std::string with the - // extension's ID. - NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, - - // Sent when a page action's visibility has changed. The source is the - // ExtensionAction* that changed. The details are a WebContents*. - NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, - - // Sent when a system indicator action's state has changed. The source is the - // Profile* that the browser action belongs to. The details are the - // ExtensionAction* that changed. - NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, - - // Sent when an extension command has been removed. The source is the profile - // and the details is a std::pair of two std::string objects (an extension ID - // and the name of the command being removed). - NOTIFICATION_EXTENSION_COMMAND_REMOVED, - - // Sent when an extension command has been added. The source is the profile - // and the details is a std::pair of two std::string objects (an extension ID - // and the name of the command being added). - NOTIFICATION_EXTENSION_COMMAND_ADDED, - - // Sent when an extension command shortcut for a browser action is activated - // on Mac. The source is the profile and the details is a std::pair of a - // std::string containing an extension ID and a gfx::NativeWindow for the - // associated window. - NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, - - // Sent when an extension command shortcut for a page action is activated - // on Mac. The source is the profile and the details is a std::pair of a - // std::string containing an extension ID and a gfx::NativeWindow for the - // associated window. - NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC, - - // A new extension RenderViewHost has been registered. The details are - // the RenderViewHost*. - NOTIFICATION_EXTENSION_VIEW_REGISTERED, - - // An extension RenderViewHost has been unregistered. The details are - // the RenderViewHost*. - NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, - - // Sent by an extension to notify the browser about the results of a unit - // test. - NOTIFICATION_EXTENSION_TEST_PASSED, - NOTIFICATION_EXTENSION_TEST_FAILED, - - // Sent by extension test javascript code, typically in a browser test. The - // sender is a std::string representing the extension id, and the details - // are a std::string with some message. This is particularly useful when you - // want to have C++ code wait for javascript code to do something. - NOTIFICATION_EXTENSION_TEST_MESSAGE, - - // Sent when an bookmarks extensions API function was successfully invoked. - // The source is the id of the extension that invoked the function, and the - // details are a pointer to the const BookmarksFunction in question. - NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, - - // Sent when a downloads extensions API event is fired. The source is an - // ExtensionDownloadsEventRouter::NotificationSource, and the details is a - // std::string containing json. Used for testing. - NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, - - // Sent when an omnibox extension has sent back omnibox suggestions. The - // source is the profile, and the details are an - // extensions::api::omnibox::SendSuggestions::Params object. - NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, - - // Sent when the user accepts the input in an extension omnibox keyword - // session. The source is the profile. - NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, - - // Sent when an omnibox extension has updated the default suggestion. The - // source is the profile. - NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, - - // Sent when the extension updater starts checking for updates to installed - // extensions. The source is a Profile, and there are no details. - NOTIFICATION_EXTENSION_UPDATING_STARTED, - - // The extension updater found an update and will attempt to download and - // install it. The source is a Profile, and the details are an - // extensions::UpdateDetails object with the extension id and version of the - // found update. - NOTIFICATION_EXTENSION_UPDATE_FOUND, - // Upgrade notifications --------------------------------------------------- // Sent when Chrome believes an update has been installed and available for @@ -799,14 +595,14 @@ enum NotificationType { // Sent when the applications in the NTP app launcher have been reordered. // The details, if not NoDetails, is the std::string ID of the extension that // was moved. - NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + NOTIFICATION_APP_LAUNCHER_REORDERED, // Sent when an app is installed and an NTP has been shown. Source is the // WebContents that was shown, and Details is the string ID of the extension // which was installed. NOTIFICATION_APP_INSTALLED_TO_NTP, - // Similar to NOTIFICATION_APP_INSTALLED_TO_NTP but used to nofity ash AppList + // Similar to NOTIFICATION_APP_INSTALLED_TO_NTP but used to notify ash AppList // about installed app. Source is the profile in which the app is installed // and Details is the string ID of the extension. NOTIFICATION_APP_INSTALLED_TO_APPLIST, @@ -819,6 +615,7 @@ enum NotificationType { // generated when the metro app has connected to the browser IPC channel. // Used only on Windows. NOTIFICATION_ASH_SESSION_STARTED, + // Sent when the Ash session ended. Currently this means the metro app exited. // Used only on Windows. NOTIFICATION_ASH_SESSION_ENDED, diff --git a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc index 58c7352..694e77c 100644 --- a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc +++ b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc @@ -16,7 +16,6 @@ #include "base/strings/stringprintf.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/external_provider_impl.h" #include "chrome/browser/extensions/updater/extension_downloader.h" #include "chrome/common/chrome_paths.h" @@ -30,6 +29,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" #include "extensions/browser/external_provider_interface.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/manifest.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -252,7 +252,7 @@ TEST_F(DeviceLocalAccountExternalPolicyLoaderTest, ForceInstallListSet) { // Wait for the manifest to be parsed. content::WindowedNotificationObserver( - chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, + extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, content::NotificationService::AllSources()).Wait(); // Verify that the downloader is attempting to download a CRX file. diff --git a/chrome/browser/chromeos/extensions/external_cache.cc b/chrome/browser/chromeos/extensions/external_cache.cc index 76c8f09..14ec0a4 100644 --- a/chrome/browser/chromeos/extensions/external_cache.cc +++ b/chrome/browser/chromeos/extensions/external_cache.cc @@ -14,7 +14,6 @@ #include "base/strings/string_util.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/external_provider_impl.h" #include "chrome/browser/extensions/updater/extension_downloader.h" @@ -22,6 +21,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "net/url_request/url_request_context_getter.h" @@ -44,7 +44,7 @@ ExternalCache::ExternalCache(const base::FilePath& cache_dir, weak_ptr_factory_(this) { notification_registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::NotificationService::AllBrowserContextsAndSources()); } @@ -130,7 +130,7 @@ void ExternalCache::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { + case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { extensions::CrxInstaller* installer = content::Source<extensions::CrxInstaller>(source).ptr(); OnDamagedFileDetected(installer->source_file()); diff --git a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc index c8d175e..c8e0a34 100644 --- a/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc +++ b/chrome/browser/chromeos/extensions/input_method_apitest_chromeos.cc @@ -9,7 +9,6 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/extensions/input_method_event_router.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chromeos/ime/extension_ime_util.h" @@ -19,6 +18,7 @@ #include "content/public/browser/notification_service.h" #include "extensions/common/switches.h" #include "extensions/browser/api/test/test_api.h" +#include "extensions/browser/notification_types.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -31,7 +31,8 @@ const char kBackgroundReady[] = "ready"; class TestListener : public content::NotificationObserver { public: explicit TestListener() { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } diff --git a/chrome/browser/chromeos/extensions/input_view_browsertest.cc b/chrome/browser/chromeos/extensions/input_view_browsertest.cc index 895aa8d..eececb2 100644 --- a/chrome/browser/chromeos/extensions/input_view_browsertest.cc +++ b/chrome/browser/chromeos/extensions/input_view_browsertest.cc @@ -19,6 +19,7 @@ #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/file_util.h" @@ -62,7 +63,7 @@ class InputViewBrowserTest : public VirtualKeyboardBrowserTest { extensions::CrxInstaller::CreateSilent(service); ExtensionTestNotificationObserver observer(browser()); - observer.Watch(chrome::NOTIFICATION_CRX_INSTALLER_DONE, + observer.Watch(extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(installer.get())); installer->set_allow_silent_install(true); installer->set_creation_flags(extensions::Extension::FROM_WEBSTORE); diff --git a/chrome/browser/chromeos/extensions/install_limiter.cc b/chrome/browser/chromeos/extensions/install_limiter.cc index d60bc28..be6e0ec 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.cc +++ b/chrome/browser/chromeos/extensions/install_limiter.cc @@ -9,11 +9,11 @@ #include "base/bind.h" #include "base/file_util.h" #include "base/threading/sequenced_worker_pool.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/notification_types.h" using content::BrowserThread; @@ -117,7 +117,7 @@ void InstallLimiter::CheckAndRunDeferrredInstalls() { void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer, const base::FilePath& path) { registrar_.Add(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(installer.get())); installer->InstallCrx(path); @@ -127,11 +127,9 @@ void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer, void InstallLimiter::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_CRX_INSTALLER_DONE, type); + DCHECK_EQ(extensions::NOTIFICATION_CRX_INSTALLER_DONE, type); - registrar_.Remove(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, - source); + registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source); const scoped_refptr<CrxInstaller> installer = content::Source<extensions::CrxInstaller>(source).ptr(); diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc index d4b6ef6..87a2ade 100644 --- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc @@ -8,7 +8,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/file_manager/drive_test_util.h" #include "chrome/browser/chromeos/file_manager/volume_manager.h" @@ -24,6 +23,7 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/notification_types.h" #include "google_apis/drive/drive_api_parser.h" #include "google_apis/drive/test_util.h" #include "google_apis/drive/time_util.h" @@ -293,11 +293,10 @@ bool InitializeDriveService( class BackgroundObserver { public: BackgroundObserver() - : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + : page_created_(extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::NotificationService::AllSources()), - page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, - content::NotificationService::AllSources()) { - } + page_closed_(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, + content::NotificationService::AllSources()) {} void WaitUntilLoaded() { page_created_.Wait(); diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 5ed65d4..94ae908 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc @@ -23,7 +23,6 @@ #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/file_system_interface.h" #include "chrome/browser/chromeos/file_manager/app_id.h" @@ -45,6 +44,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "google_apis/drive/drive_api_parser.h" #include "google_apis/drive/test_util.h" @@ -485,13 +485,13 @@ class FileManagerTestListener : public content::NotificationObserver { FileManagerTestListener() { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_PASSED, + extensions::NOTIFICATION_EXTENSION_TEST_PASSED, content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_FAILED, + extensions::NOTIFICATION_EXTENSION_TEST_FAILED, content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } @@ -508,12 +508,13 @@ class FileManagerTestListener : public content::NotificationObserver { const content::NotificationDetails& details) OVERRIDE { Message entry; entry.type = type; - entry.message = type != chrome::NOTIFICATION_EXTENSION_TEST_PASSED ? - *content::Details<std::string>(details).ptr() : - std::string(); - entry.function = type == chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE ? - content::Source<extensions::TestSendMessageFunction>(source).ptr() : - NULL; + entry.message = type != extensions::NOTIFICATION_EXTENSION_TEST_PASSED + ? *content::Details<std::string>(details).ptr() + : std::string(); + entry.function = + type == extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE + ? content::Source<extensions::TestSendMessageFunction>(source).ptr() + : NULL; messages_.push_back(entry); base::MessageLoopForUI::current()->Quit(); } @@ -621,10 +622,10 @@ void FileManagerBrowserTestBase::RunTestMessageLoop() { FileManagerTestListener listener; while (true) { FileManagerTestListener::Message entry = listener.GetNextMessage(); - if (entry.type == chrome::NOTIFICATION_EXTENSION_TEST_PASSED) { + if (entry.type == extensions::NOTIFICATION_EXTENSION_TEST_PASSED) { // Test succeed. break; - } else if (entry.type == chrome::NOTIFICATION_EXTENSION_TEST_FAILED) { + } else if (entry.type == extensions::NOTIFICATION_EXTENSION_TEST_FAILED) { // Test failed. ADD_FAILURE() << entry.message; break; diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index 1861cb9..04978c5 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc @@ -103,6 +103,7 @@ #include "crypto/rsa_private_key.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/management_policy.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -723,10 +724,10 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) { // Start listening for app/extension installation results. content::WindowedNotificationObserver hosted_app_observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); content::WindowedNotificationObserver extension_observer( - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); // Start login into the device-local account. @@ -824,10 +825,10 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) { // Start listening for app/extension installation results. content::WindowedNotificationObserver hosted_app_observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); content::WindowedNotificationObserver extension_observer( - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); // Start login into the device-local account. @@ -1128,7 +1129,7 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, LastWindowClosedLogoutReminder) { installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); installer->set_creation_flags(extensions::Extension::FROM_WEBSTORE); content::WindowedNotificationObserver app_install_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc index c56ebe6..71dc894 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc @@ -4,7 +4,6 @@ #include "chrome/browser/content_settings/content_settings_internal_extension_provider.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/common/chrome_content_client.h" @@ -15,6 +14,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_host.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" @@ -35,12 +35,14 @@ InternalExtensionProvider::InternalExtensionProvider( SetContentSettingForExtension(it->get(), CONTENT_SETTING_ALLOW); } Profile* profile = extension_service->profile(); - registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, + registrar_->Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_CREATED, content::Source<Profile>(profile)); registrar_->Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile)); - registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_->Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile)); } @@ -71,7 +73,7 @@ void InternalExtensionProvider::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_CREATED: { + case extensions::NOTIFICATION_EXTENSION_HOST_CREATED: { const extensions::ExtensionHost* host = content::Details<extensions::ExtensionHost>(details).ptr(); if (host->extension()->is_platform_app()) { @@ -133,14 +135,14 @@ void InternalExtensionProvider::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const extensions::Extension* extension = content::Details<extensions::Extension>(details).ptr(); if (extensions::PluginInfo::HasPlugins(extension)) SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const UnloadedExtensionInfo& info = *(content::Details<UnloadedExtensionInfo>(details).ptr()); if (extensions::PluginInfo::HasPlugins(info.extension)) diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index a863e3d..ef6ce35 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -49,6 +49,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/switches.h" #include "net/socket/tcp_listen_socket.h" #include "net/test/spawned_test_server/spawned_test_server.h" @@ -322,7 +323,7 @@ class DevToolsExtensionTest : public DevToolsSanityTest, { content::NotificationRegistrar registrar; registrar.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); base::CancelableClosure timeout( base::Bind(&TimeoutCallback, "Extension load timed out.")); @@ -345,7 +346,8 @@ class DevToolsExtensionTest : public DevToolsSanityTest, // this method is running. content::NotificationRegistrar registrar; - registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + registrar.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllSources()); base::CancelableClosure timeout( base::Bind(&TimeoutCallback, "Extension host load timed out.")); @@ -373,8 +375,8 @@ class DevToolsExtensionTest : public DevToolsSanityTest, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: base::MessageLoopForUI::current()->Quit(); break; default: diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 8e81539..2c23826 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -21,7 +21,6 @@ #include "base/threading/sequenced_worker_pool.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/download/download_completion_blocker.h" #include "chrome/browser/download/download_crx_util.h" #include "chrome/browser/download/download_file_picker.h" @@ -47,6 +46,7 @@ #include "content/public/browser/download_manager.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/page_navigator.h" +#include "extensions/browser/notification_types.h" #include "net/base/filename_util.h" #include "net/base/mime_util.h" @@ -360,7 +360,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload( // time, Observe() will call the passed callback. registrar_.Add( this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(crx_installer.get())); crx_installers_[crx_installer.get()] = callback; @@ -669,11 +669,9 @@ void ChromeDownloadManagerDelegate::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { #if defined(ENABLE_EXTENSIONS) - DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); + DCHECK(type == extensions::NOTIFICATION_CRX_INSTALLER_DONE); - registrar_.Remove(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, - source); + registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source); scoped_refptr<extensions::CrxInstaller> installer = content::Source<extensions::CrxInstaller>(source).ptr(); diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc index 348b253..f420726ae 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc @@ -15,7 +15,6 @@ #include "base/memory/scoped_vector.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h" #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" #include "chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h" @@ -30,6 +29,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" namespace extensions { @@ -45,7 +45,7 @@ BluetoothEventRouter::BluetoothEventRouter(content::BrowserContext* context) DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(browser_context_); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<content::BrowserContext>(browser_context_)); extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); } @@ -352,7 +352,7 @@ void BluetoothEventRouter::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, type); ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); CleanUpForExtension(host->extension_id()); } diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index d3e3cbe..8361b94 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -26,7 +26,6 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/chrome_bookmark_client.h" #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" #include "chrome/browser/importer/external_process_importer_host.h" @@ -48,6 +47,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/permissions/permissions_data.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -156,7 +156,7 @@ bool BookmarksFunction::RunAsync() { bool success = RunOnReady(); if (success) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, + extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, content::Source<const Extension>(extension()), content::Details<const BookmarksFunction>(this)); } diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index ddcf18e..a448bf2 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -12,7 +12,6 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/commands/commands.h" #include "chrome/browser/extensions/extension_commands_global_registry.h" #include "chrome/browser/extensions/extension_keybinding_registry.h" @@ -28,6 +27,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/feature_switch.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/permissions_data.h" @@ -286,10 +286,10 @@ bool CommandService::AddKeybindingPref( std::pair<const std::string, const std::string> details = std::make_pair(extension_id, command_name); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED, + extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED, content::Source<Profile>(profile_), - content::Details< - std::pair<const std::string, const std::string> >(&details)); + content::Details<std::pair<const std::string, const std::string> >( + &details)); return true; } @@ -804,10 +804,10 @@ void CommandService::RemoveKeybindingPrefs(const std::string& extension_id, std::pair<const std::string, const std::string> details = std::make_pair(extension_id, command_name); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED, + extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, content::Source<Profile>(profile_), - content::Details< - std::pair<const std::string, const std::string> >(&details)); + content::Details<std::pair<const std::string, const std::string> >( + &details)); } } diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index af8accd..dfbd3f1 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -18,7 +18,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/extensions/api/developer_private/entry_picker.h" #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" @@ -54,6 +53,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/management_policy.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/constants.h" #include "extensions/common/extension_resource.h" @@ -193,10 +193,10 @@ DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context) DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) : extension_registry_observer_(this), profile_(profile) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, + extensions::NOTIFICATION_EXTENSION_VIEW_REGISTERED, content::Source<Profile>(profile_)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, + extensions::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, content::Source<Profile>(profile_)); // TODO(limasdf): Use scoped_observer instead. @@ -229,13 +229,13 @@ void DeveloperPrivateEventRouter::Observe( developer::EventData event_data; switch (type) { - case chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED: { + case extensions::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED: { event_data.event_type = developer::EVENT_TYPE_VIEW_UNREGISTERED; event_data.item_id = GetExtensionID( content::Details<const RenderViewHost>(details).ptr()); break; } - case chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED: { + case extensions::NOTIFICATION_EXTENSION_VIEW_REGISTERED: { event_data.event_type = developer::EVENT_TYPE_VIEW_REGISTERED; event_data.item_id = GetExtensionID( content::Details<const RenderViewHost>(details).ptr()); diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index ceb3cd8..6097e77 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc @@ -26,7 +26,6 @@ #include "base/task/cancelable_task_tracker.h" #include "base/values.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/download/download_danger_prompt.h" #include "chrome/browser/download/download_file_icon_extractor.h" #include "chrome/browser/download/download_prefs.h" @@ -64,6 +63,7 @@ #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/permissions/permissions_data.h" #include "net/base/filename_util.h" #include "net/base/load_flags.h" @@ -1911,7 +1911,7 @@ void ExtensionDownloadsEventRouter::DispatchEvent( content::Source<DownloadsNotificationSource> content_source( ¬ification_source); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, + extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, content_source, content::Details<std::string>(&json_args)); } diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index 53ec289..8853e1e1 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -15,7 +15,6 @@ #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/synchronization/waitable_event.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/download/download_file_icon_extractor.h" #include "chrome/browser/download/download_service.h" #include "chrome/browser/download/download_service_factory.h" @@ -44,6 +43,7 @@ #include "content/public/test/download_test_observer.h" #include "content/test/net/url_request_slow_download_job.h" #include "extensions/browser/event_router.h" +#include "extensions/browser/notification_types.h" #include "net/base/data_url.h" #include "net/base/net_util.h" #include "net/url_request/url_request.h" @@ -80,12 +80,14 @@ class DownloadsEventsListener : public content::NotificationObserver { public: DownloadsEventsListener() : waiting_(false) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, content::NotificationService::AllSources()); } virtual ~DownloadsEventsListener() { - registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, + registrar_.Remove(this, + extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, content::NotificationService::AllSources()); STLDeleteElements(&events_); } @@ -176,8 +178,7 @@ class DownloadsEventsListener : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: - { + case extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: { DownloadsNotificationSource* dns = content::Source<DownloadsNotificationSource>(source).ptr(); Event* new_event = new Event( diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc index db6e0af..9507620a 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc +++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc @@ -6,7 +6,6 @@ #include "base/macros.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/net/nss_context.h" @@ -18,6 +17,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/test_utils.h" #include "content/test/net/url_request_mock_http_job.h" +#include "extensions/browser/notification_types.h" #include "net/base/net_errors.h" #include "net/cert/nss_cert_database.h" #include "policy/policy_constants.h" @@ -160,7 +160,7 @@ class EnterprisePlatformKeysTest : public ExtensionApiTest { // Set the policy and wait until the extension is installed. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::NotificationService::AllSources()); policy_provider_.UpdateChromePolicy(policy); observer.Wait(); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 1aacf49..61e647c 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. #include "build/build_config.h" - -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/browser_action_test_util.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action_icon_factory.h" @@ -24,6 +22,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/feature_switch.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -619,7 +618,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_CloseBackgroundPage) { ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); content::WindowedNotificationObserver host_destroyed_observer( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); // Click the browser action. diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc index e9e2b9d..8b2ed3f 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc @@ -9,7 +9,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/extension_action/extension_page_actions_api_constants.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action_manager.h" @@ -29,6 +28,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/image_util.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/state_store.h" #include "extensions/common/error_utils.h" #include "ui/gfx/codec/png_codec.h" @@ -308,7 +308,7 @@ void ExtensionActionAPI::SetBrowserActionVisibility( kBrowserActionVisible, new base::FundamentalValue(visible)); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionPrefs>(prefs), content::Details<const std::string>(&extension_id)); } @@ -420,7 +420,8 @@ void ExtensionActionAPI::ExtensionActionExecuted( ExtensionActionStorageManager::ExtensionActionStorageManager(Profile* profile) : profile_(profile), extension_registry_observer_(this) { extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::NotificationService::AllBrowserContextsAndSources()); StateStore* storage = ExtensionSystem::Get(profile_)->state_store(); @@ -453,7 +454,7 @@ void ExtensionActionStorageManager::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED); + DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED); ExtensionAction* extension_action = content::Source<ExtensionAction>(source).ptr(); Profile* profile = content::Details<Profile>(details).ptr(); @@ -627,7 +628,7 @@ void ExtensionActionFunction::NotifyChange() { void ExtensionActionFunction::NotifyBrowserActionChange() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::Source<ExtensionAction>(extension_action_), content::Details<Profile>(GetProfile())); } @@ -638,7 +639,7 @@ void ExtensionActionFunction::NotifyLocationBarChange() { void ExtensionActionFunction::NotifySystemIndicatorChange() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, + extensions::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, content::Source<Profile>(GetProfile()), content::Details<ExtensionAction>(extension_action_)); } @@ -807,7 +808,7 @@ bool BrowserActionOpenPopupFunction::RunAsync() { } registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::Source<Profile>(GetProfile())); // Set a timeout for waiting for the notification that the popup is loaded. @@ -835,7 +836,7 @@ void BrowserActionOpenPopupFunction::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, type); if (response_sent_) return; diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc index 079125c..a924d26 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc +++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc @@ -4,7 +4,6 @@ #include "base/lazy_instance.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.h" #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" #include "chrome/browser/extensions/api/image_writer_private/operation.h" @@ -19,6 +18,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" namespace image_writer_api = extensions::api::image_writer_private; @@ -34,13 +34,13 @@ OperationManager::OperationManager(content::BrowserContext* context) extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); Profile* profile = Profile::FromBrowserContext(browser_context_); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<Profile>(profile)); } @@ -229,16 +229,16 @@ void OperationManager::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { + case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { DeleteOperation(content::Details<const Extension>(details).ptr()->id()); break; } - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { DeleteOperation( content::Details<ExtensionHost>(details)->extension()->id()); break; } - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { DeleteOperation( content::Details<ExtensionHost>(details)->extension()->id()); break; diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index a9e395c..7f36d23 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -6,7 +6,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/management/management_api.h" #include "chrome/browser/extensions/api/management/management_api_constants.h" #include "chrome/browser/extensions/extension_browsertest.h" @@ -22,6 +21,7 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" namespace keys = extension_management_api_constants; namespace util = extension_function_test_utils; @@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, // crash it. (NOTIFICATION_RENDERER_PROCESS_CREATED does not wait for the // latter and can cause KillProcess to fail on Windows.) content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_HOST_CREATED, + extensions::NOTIFICATION_EXTENSION_HOST_CREATED, content::NotificationService::AllSources()); ExtensionInstallPrompt::g_auto_confirm_for_tests = ExtensionInstallPrompt::ACCEPT; diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index 5ceeb55..9656e9d 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc @@ -8,7 +8,6 @@ #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "base/stl_util.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_test_message_listener.h" @@ -28,6 +27,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/pref_names.h" #include "net/url_request/url_fetcher.h" @@ -174,10 +174,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { class NotificationListener : public content::NotificationObserver { public: NotificationListener() : started_(false), finished_(false) { - int types[] = { - chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, - chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND - }; + int types[] = {extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, + extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND}; for (size_t i = 0; i < arraysize(types); i++) { registrar_.Add( this, types[i], content::NotificationService::AllSources()); @@ -202,12 +200,12 @@ class NotificationListener : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED: { + case extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED: { EXPECT_FALSE(started_); started_ = true; break; } - case chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND: { + case extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND: { const std::string& id = content::Details<extensions::UpdateDetails>(details)->id; updates_.insert(id); diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc index 93f181c..33f1c9c 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc @@ -15,7 +15,6 @@ #include "testing/gmock/include/gmock/gmock.h" #if defined(OS_CHROMEOS) -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" #include "chromeos/chromeos_switches.h" @@ -39,6 +38,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/notification_types.h" #include "policy/policy_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h" #else // !defined(OS_CHROMEOS) @@ -82,7 +82,7 @@ class TestListener : public content::NotificationObserver { TestListener(const std::string& message, const base::Closure& callback) : message_(message), callback_(callback) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } diff --git a/chrome/browser/extensions/api/notifications/notifications_apitest.cc b/chrome/browser/extensions/api/notifications/notifications_apitest.cc index 7c6a97b..8cfa4a2 100644 --- a/chrome/browser/extensions/api/notifications/notifications_apitest.cc +++ b/chrome/browser/extensions/api/notifications/notifications_apitest.cc @@ -6,7 +6,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/notifications/notifications_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" @@ -15,6 +14,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/features/feature.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification_list.h" @@ -32,7 +32,7 @@ class UserGestureCatcher : public content::NotificationObserver { public: UserGestureCatcher() : waiting_(false) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } @@ -83,7 +83,7 @@ class NotificationsApiTest : public ExtensionApiTest { const std::string& test_name) { base::FilePath extdir = test_data_dir_.AppendASCII(test_name); content::WindowedNotificationObserver page_created( - chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::NotificationService::AllSources()); const extensions::Extension* extension = LoadExtension(extdir); if (extension) { diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index 4f573d5..5281e91 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -7,7 +7,6 @@ #include "base/lazy_instance.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service_factory.h" @@ -21,6 +20,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs_factory.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/notification_types.h" #include "ui/gfx/image/image.h" namespace extensions { @@ -159,7 +159,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered( ->DispatchEventToExtension(extension_id, event.Pass()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, content::Source<Profile>(profile), content::NotificationService::NoDetails()); } @@ -282,7 +282,7 @@ bool OmniboxSendSuggestionsFunction::RunSync() { EXTENSION_FUNCTION_VALIDATE(params); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, content::Source<Profile>(GetProfile()->GetOriginalProfile()), content::Details<SendSuggestions::Params>(params.get())); @@ -297,7 +297,7 @@ bool OmniboxSetDefaultSuggestionFunction::RunSync() { if (SetOmniboxDefaultSuggestion( GetProfile(), extension_id(), params->suggestion)) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + extensions::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, content::Source<Profile>(GetProfile()->GetOriginalProfile()), content::NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc index bc743e9..a5acea5 100644 --- a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc +++ b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc @@ -7,7 +7,6 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/time/time.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_warning_service.h" #include "chrome/browser/extensions/extension_warning_set.h" @@ -19,6 +18,7 @@ #include "components/omaha_query_params/omaha_query_params.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/api/runtime.h" #if defined(OS_CHROMEOS) @@ -53,7 +53,7 @@ ChromeRuntimeAPIDelegate::ChromeRuntimeAPIDelegate( content::BrowserContext* context) : browser_context_(context), registered_for_updates_(false) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, + extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, content::NotificationService::AllSources()); } @@ -245,7 +245,7 @@ void ChromeRuntimeAPIDelegate::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK(type == chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND); + DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND); typedef const std::pair<std::string, Version> UpdateDetails; const std::string& id = content::Details<UpdateDetails>(details)->first; const Version& version = content::Details<UpdateDetails>(details)->second; diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc index f4ac377..f36a716 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/signin/signin_manager_factory.h" @@ -10,6 +9,7 @@ #include "components/signin/core/common/profile_management_switches.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/api/test/test_api.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/switches.h" namespace extensions { @@ -51,7 +51,7 @@ class ScreenlockPrivateApiTest : public ExtensionApiTest, // ExtensionApiTest override: virtual void RunTestOnMainThreadLoop() OVERRIDE { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); ExtensionApiTest::RunTestOnMainThreadLoop(); registrar_.RemoveAll(); diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc index 4dc3036..2260090 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc @@ -6,7 +6,6 @@ #include "base/memory/linked_ptr.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" @@ -19,6 +18,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "ui/gfx/image/image.h" @@ -127,7 +127,8 @@ SystemIndicatorManager::SystemIndicatorManager(Profile* profile, extension_registry_observer_(this) { extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, content::Source<Profile>(profile_->GetOriginalProfile())); } @@ -151,7 +152,7 @@ void SystemIndicatorManager::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED); + DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED); OnSystemIndicatorChanged(content::Details<ExtensionAction>(details).ptr()); } diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc index 1403470..c876524 100644 --- a/chrome/browser/extensions/bookmark_app_helper.cc +++ b/chrome/browser/extensions/bookmark_app_helper.cc @@ -7,7 +7,6 @@ #include <cctype> #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/favicon_downloader.h" @@ -18,6 +17,7 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/image_loader.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handlers/icons_handler.h" @@ -174,11 +174,11 @@ BookmarkAppHelper::BookmarkAppHelper(ExtensionService* service, : web_app_info_(web_app_info), crx_installer_(extensions::CrxInstaller::CreateSilent(service)) { registrar_.Add(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(crx_installer_.get())); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::Source<CrxInstaller>(crx_installer_.get())); crx_installer_->set_error_on_unsupported_requirements(true); @@ -330,7 +330,7 @@ void BookmarkAppHelper::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { + case extensions::NOTIFICATION_CRX_INSTALLER_DONE: { const Extension* extension = content::Details<const Extension>(details).ptr(); DCHECK(extension); @@ -339,7 +339,7 @@ void BookmarkAppHelper::Observe(int type, callback_.Run(extension, web_app_info_); break; } - case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: + case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: callback_.Run(NULL, web_app_info_); break; default: diff --git a/chrome/browser/extensions/chrome_app_sorting.cc b/chrome/browser/extensions/chrome_app_sorting.cc index d781931..10a4431 100644 --- a/chrome/browser/extensions/chrome_app_sorting.cc +++ b/chrome/browser/extensions/chrome_app_sorting.cc @@ -218,7 +218,7 @@ void ChromeAppSorting::FixNTPOrdinalCollisions() { } content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, content::Source<ChromeAppSorting>(this), content::NotificationService::NoDetails()); } @@ -281,7 +281,7 @@ void ChromeAppSorting::OnExtensionMoved( SyncIfNeeded(moved_extension_id); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, content::Source<ChromeAppSorting>(this), content::Details<const std::string>(&moved_extension_id)); } diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 01aa743..aad743d 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -4,7 +4,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/permissions/permissions_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_service.h" @@ -14,6 +13,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -209,7 +209,7 @@ IN_PROC_BROWSER_TEST_F( ASSERT_TRUE(StartEmbeddedTestServer()); content::WindowedNotificationObserver signal( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(browser()->profile())); // Start with a renderer already open at a URL. diff --git a/chrome/browser/extensions/convert_web_app_browsertest.cc b/chrome/browser/extensions/convert_web_app_browsertest.cc index a33359c..1c3cc72 100644 --- a/chrome/browser/extensions/convert_web_app_browsertest.cc +++ b/chrome/browser/extensions/convert_web_app_browsertest.cc @@ -5,7 +5,6 @@ #include <string> #include "base/command_line.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -22,6 +21,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" #include "extensions/common/manifest_handlers/icons_handler.h" @@ -44,7 +44,8 @@ class ExtensionFromWebAppTest virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - if (type == chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { + if (type == + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { const Extension* extension = content::Details<const InstalledExtensionInfo>(details)->extension; if (extension->id() == expected_extension_id_) { @@ -69,7 +70,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, DISABLED_Basic) { content::NotificationRegistrar registrar; registrar.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::NotificationService::AllSources()); expected_extension_id_ = "ffnmbohohhobhkjpfbefbjifapgcmpaa"; diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 021affd..f5294a5 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -21,7 +21,6 @@ #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "base/version.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/convert_user_script.h" #include "chrome/browser/extensions/convert_web_app.h" #include "chrome/browser/extensions/crx_installer_error.h" @@ -45,6 +44,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/install_flag.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension_icon_set.h" #include "extensions/common/feature_switch.h" #include "extensions/common/file_util.h" @@ -750,7 +750,7 @@ void CrxInstaller::ReportFailureFromUIThread(const CrxInstallerError& error) { content::NotificationService* service = content::NotificationService::current(); - service->Notify(chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + service->Notify(extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::Source<CrxInstaller>(this), content::Details<const base::string16>(&error.message())); @@ -825,10 +825,9 @@ void CrxInstaller::NotifyCrxInstallComplete(bool success) { // extension before it is unpacked, so they cannot filter based // on the extension. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(this), - content::Details<const Extension>( - success ? extension() : NULL)); + content::Details<const Extension>(success ? extension() : NULL)); InstallTrackerFactory::GetForBrowserContext(profile()) ->OnFinishCrxInstall(success ? extension()->id() : expected_id_, success); diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index 9a3610a..aeb7313 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -26,6 +26,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/management_policy.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/feature_switch.h" #include "extensions/common/file_util.h" @@ -424,7 +425,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, // Make test extension non-idle by opening the extension's browser action // popup. This should cause the installation to be delayed. content::WindowedNotificationObserver loading_observer( - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::Source<Profile>(profile())); BrowserActionTestUtil util(browser()); // There is only one extension, so just click the first browser action. diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index a8c397b..7a89e3d 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -7,7 +7,6 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/profiles/profile.h" @@ -18,6 +17,7 @@ #include "content/public/browser/notification_service.h" #include "extensions/browser/api/test/test_api.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" #include "net/base/escape.h" @@ -144,9 +144,11 @@ ExtensionApiTest::~ExtensionApiTest() {} ExtensionApiTest::ResultCatcher::ResultCatcher() : profile_restriction_(NULL), waiting_(false) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_TEST_PASSED, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_TEST_FAILED, content::NotificationService::AllSources()); } @@ -185,7 +187,7 @@ void ExtensionApiTest::ResultCatcher::Observe( } switch (type) { - case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: + case extensions::NOTIFICATION_EXTENSION_TEST_PASSED: VLOG(1) << "Got EXTENSION_TEST_PASSED notification."; results_.push_back(true); messages_.push_back(std::string()); @@ -193,7 +195,7 @@ void ExtensionApiTest::ResultCatcher::Observe( base::MessageLoopForUI::current()->Quit(); break; - case chrome::NOTIFICATION_EXTENSION_TEST_FAILED: + case extensions::NOTIFICATION_EXTENSION_TEST_FAILED: VLOG(1) << "Got EXTENSION_TEST_FAILED notification."; results_.push_back(false); messages_.push_back(*(content::Details<std::string>(details).ptr())); diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index bb26394..56906ae 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -14,7 +14,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/browsertest_util.h" #include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/crx_installer.h" @@ -43,6 +42,7 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/uninstall_reason.h" #include "extensions/common/constants.h" #include "extensions/common/extension_set.h" @@ -151,7 +151,7 @@ ExtensionBrowserTest::LoadExtensionWithInstallParam( ExtensionService* service = extensions::ExtensionSystem::Get( profile())->extension_service(); { - observer_->Watch(chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + observer_->Watch(extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); scoped_refptr<extensions::UnpackedInstaller> installer( @@ -197,7 +197,7 @@ ExtensionBrowserTest::LoadExtensionWithInstallParam( // Re-enable the extension if needed. if (service->extensions()->Contains(extension_id)) { content::WindowedNotificationObserver load_signal( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile())); // Reload the extension so that the // NOTIFICATION_EXTENSION_LOADED_DEPRECATED @@ -215,7 +215,7 @@ ExtensionBrowserTest::LoadExtensionWithInstallParam( // cases. { content::WindowedNotificationObserver load_signal( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile())); CHECK(!extensions::util::IsIncognitoEnabled(extension_id, profile())); @@ -229,7 +229,7 @@ ExtensionBrowserTest::LoadExtensionWithInstallParam( { content::WindowedNotificationObserver load_signal( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile())); CHECK(extensions::util::AllowFileAccess(extension_id, profile())); if (!(flags & kFlagEnableFileAccess)) { @@ -495,7 +495,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( } observer_->Watch( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(installer.get())); installer->InstallCrx(crx_path); @@ -531,7 +531,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( } void ExtensionBrowserTest::ReloadExtension(const std::string extension_id) { - observer_->Watch(chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + observer_->Watch(extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); ExtensionService* service = diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc index d9a91ce..55bf31d 100644 --- a/chrome/browser/extensions/extension_disabled_ui.cc +++ b/chrome/browser/extensions/extension_disabled_ui.cc @@ -15,7 +15,6 @@ #include "base/metrics/histogram.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_install_prompt.h" #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/browser/extensions/extension_service.h" @@ -34,6 +33,7 @@ #include "content/public/browser/notification_source.h" #include "extensions/browser/extension_util.h" #include "extensions/browser/image_loader.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/uninstall_reason.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -223,9 +223,10 @@ ExtensionDisabledGlobalError::ExtensionDisabledGlobalError( gfx::Size(kIconSize, kIconSize))); } registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(service->profile())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_REMOVED, content::Source<Profile>(service->profile())); } @@ -382,17 +383,17 @@ void ExtensionDisabledGlobalError::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { // The error is invalidated if the extension has been loaded or removed. - DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || - type == chrome::NOTIFICATION_EXTENSION_REMOVED); + DCHECK(type == extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || + type == extensions::NOTIFICATION_EXTENSION_REMOVED); const Extension* extension = content::Details<const Extension>(details).ptr(); if (extension != extension_) return; GlobalErrorServiceFactory::GetForProfile(service_->profile())-> RemoveGlobalError(this); - if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) + if (type == extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) user_response_ = REENABLE; - else if (type == chrome::NOTIFICATION_EXTENSION_REMOVED) + else if (type == extensions::NOTIFICATION_EXTENSION_REMOVED) user_response_ = UNINSTALL; delete this; } diff --git a/chrome/browser/extensions/extension_error_reporter.cc b/chrome/browser/extensions/extension_error_reporter.cc index eb28566..4e5b956 100644 --- a/chrome/browser/extensions/extension_error_reporter.cc +++ b/chrome/browser/extensions/extension_error_reporter.cc @@ -13,10 +13,10 @@ #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/simple_message_box.h" #include "content/public/browser/notification_service.h" +#include "extensions/browser/notification_types.h" ExtensionErrorReporter* ExtensionErrorReporter::instance_ = NULL; @@ -46,7 +46,7 @@ void ExtensionErrorReporter::ReportLoadError( content::BrowserContext* browser_context, bool be_noisy) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, + extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, content::Source<Profile>(Profile::FromBrowserContext(browser_context)), content::Details<const std::string>(&error)); diff --git a/chrome/browser/extensions/extension_functional_browsertest.cc b/chrome/browser/extensions/extension_functional_browsertest.cc index 8c69a7b..e2fcaa5 100644 --- a/chrome/browser/extensions/extension_functional_browsertest.cc +++ b/chrome/browser/extensions/extension_functional_browsertest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" @@ -12,6 +11,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" namespace extensions { @@ -25,7 +25,7 @@ class ExtensionFunctionalTest : public ExtensionBrowserTest { base::FilePath path = test_data_dir_.AppendASCII(filename); content::WindowedNotificationObserver extension_loaded_observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); scoped_refptr<extensions::CrxInstaller> installer( @@ -37,7 +37,7 @@ class ExtensionFunctionalTest : public ExtensionBrowserTest { extensions::CrxInstaller::OffStoreInstallAllowedInTest); observer_->Watch( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(installer.get())); installer->InstallCrx(path); diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc index df66e8d..01e9188 100644 --- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc +++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc @@ -315,7 +315,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test { extensions::CrxInstaller* installer = NULL; content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, base::Bind(&IsCrxInstallerDone, &installer)); extension_service_->UpdateExtension( extension->id(), path, true, &installer); diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc index e769519..ba16960 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_infobar_delegate.cc @@ -50,7 +50,8 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( extension_registry_observer_.Add( extensions::ExtensionRegistry::Get(browser->profile())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<Profile>(browser->profile())); height_ = std::max(0, height); @@ -109,7 +110,7 @@ void ExtensionInfoBarDelegate::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); + DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); if (extension_view_host_.get() == content::Details<extensions::ExtensionHost>(details).ptr()) infobar()->RemoveSelf(); diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc index 2fde73b..ba9fca2 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -200,7 +200,7 @@ class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest, virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - if (type != chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED) { + if (type != chrome::NOTIFICATION_APP_LAUNCHER_REORDERED) { observer_->Observe(type, source, details); return; } @@ -233,8 +233,9 @@ IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting(); // Register for notifications in the same way as AppLauncherHandler. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, - content::Source<AppSorting>(sorting)); + registrar_.Add(this, + chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, + content::Source<AppSorting>(sorting)); // ExtensionAppItem calls this when an app install starts. sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal()); // Vefify the app is not actually installed yet. diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc index d372e13..86b9116 100644 --- a/chrome/browser/extensions/extension_keybinding_registry.cc +++ b/chrome/browser/extensions/extension_keybinding_registry.cc @@ -5,7 +5,6 @@ #include "chrome/browser/extensions/extension_keybinding_registry.h" #include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/active_tab_permission_granter.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" @@ -14,6 +13,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension_set.h" #include "extensions/common/manifest_constants.h" @@ -31,10 +31,10 @@ ExtensionKeybindingRegistry::ExtensionKeybindingRegistry( Profile* profile = Profile::FromBrowserContext(browser_context_); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED, + extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED, content::Source<Profile>(profile->GetOriginalProfile())); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED, + extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, content::Source<Profile>(profile->GetOriginalProfile())); } @@ -184,8 +184,8 @@ void ExtensionKeybindingRegistry::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED: - case chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { + case extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED: + case extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { std::pair<const std::string, const std::string>* payload = content::Details<std::pair<const std::string, const std::string> >( details).ptr(); @@ -200,7 +200,7 @@ void ExtensionKeybindingRegistry::Observe( return; if (ExtensionMatchesFilter(extension)) { - if (type == chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED) + if (type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED) AddExtensionKeybinding(extension, payload->second); else RemoveExtensionKeybinding(extension, payload->second); diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index c286db3..1d6fff6 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc @@ -46,7 +46,8 @@ namespace { class MessageSender : public content::NotificationObserver { public: MessageSender() { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllSources()); } diff --git a/chrome/browser/extensions/extension_notification_observer.cc b/chrome/browser/extensions/extension_notification_observer.cc index e7bb65a..074dbba 100644 --- a/chrome/browser/extensions/extension_notification_observer.cc +++ b/chrome/browser/extensions/extension_notification_observer.cc @@ -14,11 +14,13 @@ namespace extensions { namespace { -std::string Str(const std::vector<chrome::NotificationType>& types) { +std::string Str(const std::vector<extensions::NotificationType>& types) { std::string str = "["; bool needs_comma = false; - for (std::vector<chrome::NotificationType>::const_iterator it = - types.begin(); it != types.end(); ++it) { + for (std::vector<extensions::NotificationType>::const_iterator it = + types.begin(); + it != types.end(); + ++it) { if (needs_comma) str += ","; needs_comma = true; @@ -35,39 +37,40 @@ ExtensionNotificationObserver::ExtensionNotificationObserver( const std::set<std::string>& extension_ids) : extension_ids_(extension_ids) { registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, source); - registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, - source); + this, extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, source); registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, source); + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + source); + registrar_.Add( + this, extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, source); } ExtensionNotificationObserver::~ExtensionNotificationObserver() {} testing::AssertionResult ExtensionNotificationObserver::CheckNotifications() { - return CheckNotifications(std::vector<chrome::NotificationType>()); + return CheckNotifications(std::vector<extensions::NotificationType>()); } testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( - chrome::NotificationType type) { - return CheckNotifications(std::vector<chrome::NotificationType>(1, type)); + extensions::NotificationType type) { + return CheckNotifications(std::vector<extensions::NotificationType>(1, type)); } testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2) { - std::vector<chrome::NotificationType> types; + extensions::NotificationType t1, + extensions::NotificationType t2) { + std::vector<extensions::NotificationType> types; types.push_back(t1); types.push_back(t2); return CheckNotifications(types); } testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2, - chrome::NotificationType t3) { - std::vector<chrome::NotificationType> types; + extensions::NotificationType t1, + extensions::NotificationType t2, + extensions::NotificationType t3) { + std::vector<extensions::NotificationType> types; types.push_back(t1); types.push_back(t2); types.push_back(t3); @@ -75,13 +78,13 @@ testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( } testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2, - chrome::NotificationType t3, - chrome::NotificationType t4, - chrome::NotificationType t5, - chrome::NotificationType t6) { - std::vector<chrome::NotificationType> types; + extensions::NotificationType t1, + extensions::NotificationType t2, + extensions::NotificationType t3, + extensions::NotificationType t4, + extensions::NotificationType t5, + extensions::NotificationType t6) { + std::vector<extensions::NotificationType> types; types.push_back(t1); types.push_back(t2); types.push_back(t3); @@ -97,27 +100,30 @@ void ExtensionNotificationObserver::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { const Extension* extension = content::Details<const InstalledExtensionInfo>(details)->extension; if (extension_ids_.count(extension->id())) - notifications_.push_back(static_cast<chrome::NotificationType>(type)); + notifications_.push_back( + static_cast<extensions::NotificationType>(type)); break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const Extension* extension = content::Details<const Extension>(details).ptr(); if (extension_ids_.count(extension->id())) - notifications_.push_back(static_cast<chrome::NotificationType>(type)); + notifications_.push_back( + static_cast<extensions::NotificationType>(type)); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { UnloadedExtensionInfo* reason = content::Details<UnloadedExtensionInfo>(details).ptr(); if (extension_ids_.count(reason->extension->id())) { - notifications_.push_back(static_cast<chrome::NotificationType>(type)); + notifications_.push_back( + static_cast<extensions::NotificationType>(type)); // The only way that extensions are unloaded in these tests is // by blacklisting. EXPECT_EQ(UnloadedExtensionInfo::REASON_BLACKLIST, @@ -133,7 +139,7 @@ void ExtensionNotificationObserver::Observe( } testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( - const std::vector<chrome::NotificationType>& types) { + const std::vector<extensions::NotificationType>& types) { testing::AssertionResult result = (notifications_ == types) ? testing::AssertionSuccess() : testing::AssertionFailure() << "Expected " << Str(types) << ", " << diff --git a/chrome/browser/extensions/extension_notification_observer.h b/chrome/browser/extensions/extension_notification_observer.h index facb403..caba786 100644 --- a/chrome/browser/extensions/extension_notification_observer.h +++ b/chrome/browser/extensions/extension_notification_observer.h @@ -9,12 +9,12 @@ #include <string> #include "base/compiler_specific.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "extensions/browser/notification_types.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { @@ -32,22 +32,22 @@ class ExtensionNotificationObserver : public content::NotificationObserver { // notifications occurred for any extensions in |extension_ids|, and no more, // since the last time any of these methods were called. testing::AssertionResult CheckNotifications() WARN_UNUSED_RESULT; - testing::AssertionResult CheckNotifications( - chrome::NotificationType type) WARN_UNUSED_RESULT; - testing::AssertionResult CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2) WARN_UNUSED_RESULT; - testing::AssertionResult CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2, - chrome::NotificationType t3) WARN_UNUSED_RESULT; - testing::AssertionResult CheckNotifications( - chrome::NotificationType t1, - chrome::NotificationType t2, - chrome::NotificationType t3, - chrome::NotificationType t4, - chrome::NotificationType t5, - chrome::NotificationType t6) WARN_UNUSED_RESULT; + testing::AssertionResult CheckNotifications(extensions::NotificationType type) + WARN_UNUSED_RESULT; + testing::AssertionResult CheckNotifications(extensions::NotificationType t1, + extensions::NotificationType t2) + WARN_UNUSED_RESULT; + testing::AssertionResult CheckNotifications(extensions::NotificationType t1, + extensions::NotificationType t2, + extensions::NotificationType t3) + WARN_UNUSED_RESULT; + testing::AssertionResult CheckNotifications(extensions::NotificationType t1, + extensions::NotificationType t2, + extensions::NotificationType t3, + extensions::NotificationType t4, + extensions::NotificationType t5, + extensions::NotificationType t6) + WARN_UNUSED_RESULT; private: // content::NotificationObserver implementation. @@ -57,10 +57,10 @@ class ExtensionNotificationObserver : public content::NotificationObserver { // Checks then clears notifications for our extensions. testing::AssertionResult CheckNotifications( - const std::vector<chrome::NotificationType>& types); + const std::vector<extensions::NotificationType>& types); const std::set<std::string> extension_ids_; - std::vector<chrome::NotificationType> notifications_; + std::vector<extensions::NotificationType> notifications_; content::NotificationRegistrar registrar_; }; diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8884c2d..bdcccfd 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -269,7 +269,8 @@ ExtensionService::ExtensionService(Profile* profile, registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::NotificationService::AllBrowserContextsAndSources()); @@ -707,7 +708,7 @@ bool ExtensionService::UninstallExtension( !system_->management_policy()->UserMayModifySettings( extension.get(), error)) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, + extensions::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, content::Source<Profile>(profile_), content::Details<const Extension>(extension.get())); return false; @@ -749,7 +750,7 @@ bool ExtensionService::UninstallExtension( // Notify interested parties that we've uninstalled this extension. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const Extension>(extension.get())); ExtensionRegistry::Get(profile_) @@ -831,7 +832,7 @@ void ExtensionService::EnableExtension(const std::string& extension_id) { // Notify listeners that the extension was enabled. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_ENABLED, + extensions::NOTIFICATION_EXTENSION_ENABLED, content::Source<Profile>(profile_), content::Details<const Extension>(extension)); @@ -997,7 +998,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { registry_->TriggerOnLoaded(extension); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const Extension>(extension)); @@ -1047,7 +1048,7 @@ void ExtensionService::NotifyExtensionUnloaded( registry_->TriggerOnUnloaded(extension, reason); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile_), content::Details<UnloadedExtensionInfo>(&details)); @@ -1280,7 +1281,7 @@ void ExtensionService::UnloadExtension( } content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_REMOVED, + extensions::NOTIFICATION_EXTENSION_REMOVED, content::Source<Profile>(profile_), content::Details<const Extension>(extension.get())); } @@ -1292,7 +1293,7 @@ void ExtensionService::RemoveComponentExtension( UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_UNINSTALL); if (extension.get()) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const Extension>(extension.get())); ExtensionRegistry::Get(profile_)->TriggerOnUninstalled( @@ -1317,7 +1318,7 @@ void ExtensionService::ReloadExtensionsForTest() { void ExtensionService::SetReadyAndNotifyListeners() { ready_->Signal(); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile_), content::NotificationService::NoDetails()); } @@ -1388,7 +1389,7 @@ void ExtensionService::AddExtension(const Extension* extension) { if (extension_sync_service_) extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, + extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED, content::Source<Profile>(profile_), content::Details<const Extension>(extension)); @@ -1792,7 +1793,7 @@ void ExtensionService::FinishInstallation( extensions::InstalledExtensionInfo details( extension, is_update, from_ephemeral, old_name); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const extensions::InstalledExtensionInfo>(&details)); @@ -1854,7 +1855,7 @@ void ExtensionService::PromoteEphemeralApp( true /* from ephemeral */, extension->name() /* old name */); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const extensions::InstalledExtensionInfo>(&details)); @@ -1866,7 +1867,7 @@ void ExtensionService::PromoteEphemeralApp( if (registry_->enabled_extensions().Contains(extension->id())) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_), content::Details<const Extension>(extension)); @@ -1903,7 +1904,7 @@ void ExtensionService::UntrackTerminatedExtension(const std::string& id) { registry_->RemoveTerminated(lowercase_id); if (extension) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_REMOVED, + extensions::NOTIFICATION_EXTENSION_REMOVED, content::Source<Profile>(profile_), content::Details<const Extension>(extension)); } @@ -2012,7 +2013,7 @@ void ExtensionService::Observe(int type, // happens too late in browser teardown.) browser_terminating_ = true; break; - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { + case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { if (profile_ != content::Source<Profile>(source).ptr()->GetOriginalProfile()) { break; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index a23f98c..634ce59 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -470,20 +470,22 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, false), expected_extensions_count_(0) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, - content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::NotificationService::AllSources()); } virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const Extension* extension = content::Details<const Extension>(details).ptr(); loaded_.push_back(make_scoped_refptr(extension)); @@ -493,7 +495,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { UnloadedExtensionInfo* unloaded_info = content::Details<UnloadedExtensionInfo>(details).ptr(); const Extension* e = unloaded_info->extension; @@ -508,7 +510,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, loaded_.erase(i); break; } - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { const extensions::InstalledExtensionInfo* installed_info = content::Details<const extensions::InstalledExtensionInfo>(details) .ptr(); @@ -665,7 +667,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, installer->set_install_source(install_location); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); installer->InstallCrx(crx_path); observer.Wait(); @@ -791,7 +793,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, extensions::CrxInstaller* installer = NULL; content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, base::Bind(&IsCrxInstallerDone, &installer)); service()->UpdateExtension(id, path, true, &installer); @@ -1105,7 +1107,7 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, installer->set_allow_silent_install(true); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(installer)); installer->InstallCrx(crx_path); @@ -1487,7 +1489,7 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { // Register and install an external extension. Version version("1.0.0.0"); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); if (service()->OnExternalExtensionFileFound(good_crx, &version, @@ -1522,7 +1524,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { // Install an external extension. Version version("1.0.0.0"); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); if (service()->OnExternalExtensionFileFound(good_crx, &version, @@ -1620,7 +1622,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) { // Install an external extension with an ID from the external // source that is not equal to the ID in the extension manifest. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->OnExternalExtensionFileFound(wrong_id, &version, @@ -1634,7 +1636,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) { // Try again with the right ID. Expect success. content::WindowedNotificationObserver observer2( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); if (service()->OnExternalExtensionFileFound(correct_id, &version, @@ -1657,7 +1659,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) { // source that is not equal to the version in the extension manifest. Version wrong_version("1.2.3.4"); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->OnExternalExtensionFileFound(good_crx, &wrong_version, @@ -1673,7 +1675,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) { service()->pending_extension_manager()->Remove(good_crx); Version correct_version("1.0.0.0"); content::WindowedNotificationObserver observer2( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); if (service()->OnExternalExtensionFileFound(good_crx, &correct_version, @@ -3682,7 +3684,7 @@ TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) { // Reloading extensions should find our externally registered extension // and install it. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -3878,7 +3880,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalExtensionAutoAcknowledgement) { // Providers are set up. Let them run. int count = 2; content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, base::Bind(&WaitForCountNotificationsCallback, &count)); service()->CheckForExternalUpdates(); @@ -3920,7 +3922,7 @@ TEST_F(ExtensionServiceTest, DefaultAppsInstall) { ASSERT_EQ(0u, registry()->enabled_extensions().size()); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -4608,7 +4610,7 @@ void ExtensionServiceTest::TestExternalProvider( // Reloading extensions should find our externally registered extension // and install it. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -4638,7 +4640,7 @@ void ExtensionServiceTest::TestExternalProvider( loaded_.clear(); content::WindowedNotificationObserver observer_2( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer_2.Wait(); @@ -4681,7 +4683,7 @@ void ExtensionServiceTest::TestExternalProvider( loaded_.clear(); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -4710,7 +4712,7 @@ void ExtensionServiceTest::TestExternalProvider( // Now test the case where user uninstalls and then the extension is removed // from the external provider. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); provider->UpdateOrAddExtension(good_crx, "1.0.0.1", source_path); service()->CheckForExternalUpdates(); @@ -4863,7 +4865,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) { // Two checks for external updates should find the extension, and install it // once. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); provider->set_visit_count(0); service()->CheckForExternalUpdates(); @@ -5111,7 +5113,8 @@ TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) { class ExtensionsReadyRecorder : public content::NotificationObserver { public: ExtensionsReadyRecorder() : ready_(false) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::NotificationService::AllSources()); } @@ -5123,7 +5126,7 @@ class ExtensionsReadyRecorder : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: ready_ = true; break; default: @@ -6253,7 +6256,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { { // Simulate an external source adding the extension as INTERNAL. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); EXPECT_TRUE(service()->OnExternalExtensionFileFound(kGoodId, &older_version, @@ -6269,7 +6272,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { { // Simulate an external source adding the extension as EXTERNAL_PREF. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); EXPECT_TRUE(service()->OnExternalExtensionFileFound(kGoodId, &older_version, @@ -6305,7 +6308,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { { // Now the registry adds the extension. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); EXPECT_TRUE( service()->OnExternalExtensionFileFound(kGoodId, @@ -6622,7 +6625,7 @@ TEST_F(ExtensionSourcePriorityTest, PendingExternalFileOverSync) { // Install pending extension from sync. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); EXPECT_TRUE(AddPendingSyncInstall()); ASSERT_EQ(Manifest::INTERNAL, GetPendingLocation()); @@ -6681,7 +6684,7 @@ TEST_F(ExtensionSourcePriorityTest, InstallExternalBlocksSyncRequest) { // Before the CRX installer runs, Sync requests that the same extension // be installed. Should fail, because an external source is pending. content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); ASSERT_FALSE(AddPendingSyncInstall()); @@ -6728,7 +6731,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) { hosted_app, "1.0.0.0", data_dir().AppendASCII("hosted_app.crx")); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -6741,7 +6744,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) { page_action, "1.0.0.0", data_dir().AppendASCII("page_action.crx")); content::WindowedNotificationObserver observer2( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer2.Wait(); @@ -6763,7 +6766,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallInitiallyDisabled) { page_action, "1.0.0.0", data_dir().AppendASCII("page_action.crx")); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -6806,7 +6809,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalInstallMultiple) { int count = 3; content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, base::Bind(&WaitForCountNotificationsCallback, &count)); service()->CheckForExternalUpdates(); observer.Wait(); @@ -6858,7 +6861,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallUpdatesFromWebstoreOldProfile) { provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -6887,7 +6890,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallUpdatesFromWebstoreNewProfile) { provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service()->CheckForExternalUpdates(); observer.Wait(); @@ -6919,7 +6922,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallClickToRemove) { provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service_->CheckForExternalUpdates(); observer.Wait(); @@ -6961,7 +6964,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallClickToKeep) { provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); service_->CheckForExternalUpdates(); observer.Wait(); @@ -7012,7 +7015,7 @@ TEST_F(ExtensionServiceTest, InstallBlacklistedExtension) { // Extension was installed but not loaded. EXPECT_TRUE(notifications.CheckNotifications( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED)); + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED)); EXPECT_TRUE(service()->GetInstalledExtension(id)); EXPECT_FALSE(registry()->enabled_extensions().Contains(id)); diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index 03ee7c3..455545d 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -129,7 +129,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); content::WindowedNotificationObserver user_scripts_observer( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); extensions::UserScriptMaster* master = extensions::ExtensionSystem::Get(browser()->profile())-> @@ -221,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { for (size_t i = 0; i < extension_list.size(); ++i) { content::WindowedNotificationObserver user_scripts_observer( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); extensions::util::SetAllowFileAccess( extension_list[i]->id(), browser()->profile(), false); diff --git a/chrome/browser/extensions/extension_test_message_listener.cc b/chrome/browser/extensions/extension_test_message_listener.cc index a4a1001..083594b 100644 --- a/chrome/browser/extensions/extension_test_message_listener.cc +++ b/chrome/browser/extensions/extension_test_message_listener.cc @@ -6,11 +6,11 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" +#include "extensions/browser/notification_types.h" ExtensionTestMessageListener::ExtensionTestMessageListener( const std::string& expected_message, @@ -22,7 +22,8 @@ ExtensionTestMessageListener::ExtensionTestMessageListener( will_reply_(will_reply), replied_(false), failed_(false) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } @@ -34,7 +35,7 @@ ExtensionTestMessageListener::ExtensionTestMessageListener(bool will_reply) replied_(false), failed_(false) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); } @@ -81,7 +82,7 @@ void ExtensionTestMessageListener::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, type); // Return immediately if we're already satisfied or it's not the right // extension. diff --git a/chrome/browser/extensions/extension_test_notification_observer.cc b/chrome/browser/extensions/extension_test_notification_observer.cc index 9303b3b..665cd52 100644 --- a/chrome/browser/extensions/extension_test_notification_observer.cc +++ b/chrome/browser/extensions/extension_test_notification_observer.cc @@ -156,7 +156,7 @@ bool ExtensionTestNotificationObserver::WaitForPageActionCountChangeTo( WaitForCondition( base::Bind( &HasExtensionPageActionCountReachedTarget, location_bar, count), - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED); + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED); return true; } @@ -167,7 +167,7 @@ bool ExtensionTestNotificationObserver::WaitForPageActionVisibilityChangeTo( WaitForCondition( base::Bind( &HasExtensionPageActionVisibilityReachedTarget, location_bar, count), - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED); + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED); return true; } @@ -186,20 +186,20 @@ bool ExtensionTestNotificationObserver::WaitForExtensionViewsToLoad() { bool ExtensionTestNotificationObserver::WaitForExtensionInstall() { int before = extension_installs_observed_; WaitForNotification( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED); + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED); return extension_installs_observed_ == (before + 1); } bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() { int before = extension_installs_observed_; content::WindowedNotificationObserver( - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::NotificationService::AllSources()).Wait(); return extension_installs_observed_ == before; } void ExtensionTestNotificationObserver::WaitForExtensionLoad() { - WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED); + WaitForNotification(extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED); } void ExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() { @@ -209,7 +209,7 @@ void ExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() { bool ExtensionTestNotificationObserver::WaitForExtensionLoadError() { int before = extension_load_errors_observed_; - WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR); + WaitForNotification(extensions::NOTIFICATION_EXTENSION_LOAD_ERROR); return extension_load_errors_observed_ != before; } @@ -223,14 +223,14 @@ bool ExtensionTestNotificationObserver::WaitForExtensionCrash( return true; } content::WindowedNotificationObserver( - chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllSources()).Wait(); return (service->GetExtensionById(extension_id, true) == NULL); } bool ExtensionTestNotificationObserver::WaitForCrxInstallerDone() { int before = crx_installers_done_observed_; - WaitForNotification(chrome::NOTIFICATION_CRX_INSTALLER_DONE); + WaitForNotification(extensions::NOTIFICATION_CRX_INSTALLER_DONE); return crx_installers_done_observed_ == (before + 1); } @@ -254,13 +254,13 @@ void ExtensionTestNotificationObserver::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: last_loaded_extension_id_ = content::Details<const Extension>(details).ptr()->id(); VLOG(1) << "Got EXTENSION_LOADED notification."; break; - case chrome::NOTIFICATION_CRX_INSTALLER_DONE: + case extensions::NOTIFICATION_CRX_INSTALLER_DONE: VLOG(1) << "Got CRX_INSTALLER_DONE notification."; { const Extension* extension = @@ -273,12 +273,12 @@ void ExtensionTestNotificationObserver::Observe( ++crx_installers_done_observed_; break; - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: VLOG(1) << "Got EXTENSION_INSTALLED notification."; ++extension_installs_observed_; break; - case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: + case extensions::NOTIFICATION_EXTENSION_LOAD_ERROR: VLOG(1) << "Got EXTENSION_LOAD_ERROR notification."; ++extension_load_errors_observed_; break; diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc index d155b4a..fd8fa3b 100644 --- a/chrome/browser/extensions/extension_toolbar_model.cc +++ b/chrome/browser/extensions/extension_toolbar_model.cc @@ -210,8 +210,9 @@ void ExtensionToolbarModel::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, - type); + DCHECK_EQ( + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + type); const Extension* extension = ExtensionRegistry::Get(profile_)->GetExtensionById( *content::Details<const std::string>(details).ptr(), @@ -232,7 +233,7 @@ void ExtensionToolbarModel::OnReady() { extension_registry_observer_.Add(registry); registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionPrefs>(extension_prefs_)); } diff --git a/chrome/browser/extensions/extension_view_host.cc b/chrome/browser/extensions/extension_view_host.cc index 84e99e7..7c382a6 100644 --- a/chrome/browser/extensions/extension_view_host.cc +++ b/chrome/browser/extensions/extension_view_host.cc @@ -117,7 +117,7 @@ void ExtensionViewHost::LoadInitialURL() { runtime_data()->IsBackgroundPageReady(extension())) { // Make sure the background page loads before any others. registrar()->Add(this, - chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::Source<Extension>(extension())); return; } @@ -305,7 +305,7 @@ WebContents* ExtensionViewHost::GetVisibleWebContents() const { void ExtensionViewHost::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - if (type == chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY) { + if (type == extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY) { DCHECK(ExtensionSystem::Get(browser_context())-> runtime_data()->IsBackgroundPageReady(extension())); LoadInitialURL(); diff --git a/chrome/browser/extensions/external_install_manager.cc b/chrome/browser/extensions/external_install_manager.cc index 9004bcc..2488458 100644 --- a/chrome/browser/extensions/external_install_manager.cc +++ b/chrome/browser/extensions/external_install_manager.cc @@ -68,7 +68,7 @@ ExternalInstallManager::ExternalInstallManager( extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_REMOVED, + extensions::NOTIFICATION_EXTENSION_REMOVED, content::Source<Profile>(Profile::FromBrowserContext(browser_context_))); } @@ -216,7 +216,7 @@ void ExternalInstallManager::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_REMOVED, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_REMOVED, type); // The error is invalidated if the extension has been loaded or removed. // It's a shame we have to use the notification system (instead of the // registry observer) for this, but the ExtensionUnloaded notification is diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc index 1e2dfcf..c88ecce 100644 --- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc @@ -99,7 +99,7 @@ TEST_F(ExternalProviderImplChromeOSTest, Normal) { service_->CheckForExternalUpdates(); content::WindowedNotificationObserver( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()).Wait(); EXPECT_TRUE(service_->GetInstalledExtension(kExternalAppId)); diff --git a/chrome/browser/extensions/gtalk_extension_browsertest.cc b/chrome/browser/extensions/gtalk_extension_browsertest.cc index 039f002..ac440d1 100644 --- a/chrome/browser/extensions/gtalk_extension_browsertest.cc +++ b/chrome/browser/extensions/gtalk_extension_browsertest.cc @@ -85,8 +85,8 @@ class GtalkExtensionTest : public ExtensionBrowserTest { IN_PROC_BROWSER_TEST_F(GtalkExtensionTest, InstallCurrent) { content::WindowedNotificationObserver panel_loaded( - chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, - content::NotificationService::AllSources()); + extensions::NOTIFICATION_EXTENSION_VIEW_REGISTERED, + content::NotificationService::AllSources()); InstallGtalkExtension(ReadCurrentVersion()); panel_loaded.Wait(); ASSERT_TRUE(GetViewer()); diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc index ffa52fa..b3a272f 100644 --- a/chrome/browser/extensions/install_tracker.cc +++ b/chrome/browser/extensions/install_tracker.cc @@ -18,7 +18,7 @@ InstallTracker::InstallTracker(content::BrowserContext* browser_context, extensions::ExtensionPrefs* prefs) : extension_registry_observer_(this) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, + extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED, content::Source<content::BrowserContext>(browser_context)); registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, @@ -29,7 +29,7 @@ InstallTracker::InstallTracker(content::BrowserContext* browser_context, if (prefs) { AppSorting* sorting = prefs->app_sorting(); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, content::Source<AppSorting>(sorting)); pref_change_registrar_.Init(prefs->pref_service()); pref_change_registrar_.Add( @@ -135,14 +135,14 @@ void InstallTracker::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: { + case extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED: { const Extension* extension = content::Details<const Extension>(details).ptr(); FOR_EACH_OBSERVER( InstallObserver, observers_, OnDisabledExtensionUpdated(extension)); break; } - case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: { + case chrome::NOTIFICATION_APP_LAUNCHER_REORDERED: { FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered()); break; } diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index 37c106b..95c0452 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -173,8 +173,8 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) { // Open a tab to a URL that will trigger the page action to show. LazyBackgroundObserver page_complete; content::WindowedNotificationObserver page_action_changed( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, - content::NotificationService::AllSources()); + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + content::NotificationService::AllSources()); ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); page_complete.Wait(); diff --git a/chrome/browser/extensions/lazy_background_page_test_util.h b/chrome/browser/extensions/lazy_background_page_test_util.h index cf5f540..ba9e7f8 100644 --- a/chrome/browser/extensions/lazy_background_page_test_util.h +++ b/chrome/browser/extensions/lazy_background_page_test_util.h @@ -13,17 +13,15 @@ class LazyBackgroundObserver { public: LazyBackgroundObserver() - : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + : page_created_(extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::NotificationService::AllSources()), - page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, - content::NotificationService::AllSources()) { - } + page_closed_(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, + content::NotificationService::AllSources()) {} explicit LazyBackgroundObserver(Profile* profile) - : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + : page_created_(extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::NotificationService::AllSources()), - page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, - content::Source<Profile>(profile)) { - } + page_closed_(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, + content::Source<Profile>(profile)) {} void Wait() { page_created_.Wait(); page_closed_.Wait(); diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc index d95f812..5f2f629 100644 --- a/chrome/browser/extensions/permissions_updater.cc +++ b/chrome/browser/extensions/permissions_updater.cc @@ -302,7 +302,7 @@ void PermissionsUpdater::NotifyPermissionsUpdated( extension, changed, reason); Profile* profile = Profile::FromBrowserContext(browser_context_); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, + extensions::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, content::Source<Profile>(profile), content::Details<UpdatedExtensionPermissionsInfo>(&info)); diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 122ca6a..88d85e3 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -101,7 +101,7 @@ class PermissionsUpdaterListener : public content::NotificationObserver { PermissionsUpdaterListener() : received_notification_(false), waiting_(false) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, + extensions::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, content::NotificationService::AllSources()); } diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index bde2e6f..029ac8d 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc @@ -268,7 +268,7 @@ void TabHelper::DidNavigateMainFrame( if (browser_action) { browser_action->ClearAllValuesForTab(SessionID::IdForTab(web_contents())); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::Source<ExtensionAction>(browser_action), content::NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/updater/extension_cache_impl.cc b/chrome/browser/extensions/updater/extension_cache_impl.cc index 11708cb..f79eab8 100644 --- a/chrome/browser/extensions/updater/extension_cache_impl.cc +++ b/chrome/browser/extensions/updater/extension_cache_impl.cc @@ -51,7 +51,7 @@ ExtensionCacheImpl::ExtensionCacheImpl() base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))) { notification_registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::NotificationService::AllBrowserContextsAndSources()); cache_->Init(true, base::Bind(&ExtensionCacheImpl::OnCacheInitialized, weak_ptr_factory_.GetWeakPtr())); @@ -123,7 +123,7 @@ void ExtensionCacheImpl::Observe(int type, return; switch (type) { - case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { + case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { extensions::CrxInstaller* installer = content::Source<extensions::CrxInstaller>(source).ptr(); // TODO(dpolukhin): remove extension from cache only if installation diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index 7a04b02..361d41e 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -825,7 +825,7 @@ void ExtensionDownloader::NotifyUpdateFound(const std::string& id, const std::string& version) { UpdateDetails updateInfo(id, Version(version)); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, + extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, content::NotificationService::AllBrowserContextsAndSources(), content::Details<UpdateDetails>(&updateInfo)); } diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 5e1bbbf..0aa1ac0 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -573,7 +573,7 @@ void ExtensionUpdater::MaybeInstallCRXFile() { // Source parameter ensures that we only see the completion event for the // the installer we started. registrar_.Add(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(installer)); } else { for (std::set<int>::const_iterator it = crx_file.request_ids.begin(); @@ -596,11 +596,9 @@ void ExtensionUpdater::MaybeInstallCRXFile() { void ExtensionUpdater::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(type, chrome::NOTIFICATION_CRX_INSTALLER_DONE); + DCHECK_EQ(type, extensions::NOTIFICATION_CRX_INSTALLER_DONE); - registrar_.Remove(this, - chrome::NOTIFICATION_CRX_INSTALLER_DONE, - source); + registrar_.Remove(this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, source); crx_install_is_running_ = false; const FetchedCRXFile& crx_file = current_crx_file_; @@ -626,7 +624,7 @@ void ExtensionUpdater::OnExtensionWillBeInstalled( void ExtensionUpdater::NotifyStarted() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, + extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, content::Source<Profile>(profile_), content::NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index ec362c8..fc62624 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -185,8 +185,8 @@ class MockExtensionDownloaderDelegate : public ExtensionDownloaderDelegate { }; const int kNotificationsObserved[] = { - chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, - chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, + extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, + extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND, }; // A class that observes the notifications sent by the ExtensionUpdater and @@ -234,7 +234,7 @@ class NotificationsObserver : public content::NotificationObserver { for (size_t i = 0; i < arraysize(kNotificationsObserved); ++i) { if (kNotificationsObserved[i] == type) { count_[i]++; - if (type == chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND) { + if (type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND) { updated_.insert( content::Details<UpdateDetails>(details)->id); } diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index eda5957..35d2d5e7 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc @@ -72,11 +72,13 @@ UserScriptListener::UserScriptListener() DCHECK_CURRENTLY_ON(BrowserThread::UI); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + registrar_.Add(this, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, content::NotificationService::AllSources()); @@ -208,7 +210,7 @@ void UserScriptListener::Observe(int type, DCHECK_CURRENTLY_ON(BrowserThread::UI); switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { Profile* profile = content::Source<Profile>(source).ptr(); const Extension* extension = content::Details<const Extension>(details).ptr(); @@ -225,7 +227,7 @@ void UserScriptListener::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { Profile* profile = content::Source<Profile>(source).ptr(); const Extension* unloaded_extension = content::Details<UnloadedExtensionInfo>(details)->extension; @@ -247,7 +249,7 @@ void UserScriptListener::Observe(int type, break; } - case chrome::NOTIFICATION_USER_SCRIPTS_UPDATED: { + case extensions::NOTIFICATION_USER_SCRIPTS_UPDATED: { Profile* profile = content::Source<Profile>(source).ptr(); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &UserScriptListener::UserScriptsReady, this, profile)); diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index 42be1e7..aa45e98 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -217,7 +217,7 @@ TEST_F(UserScriptListenerTest, DelayAndUpdate) { ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_.get()), content::NotificationService::NoDetails()); base::MessageLoop::current()->RunUntilIdle(); @@ -242,7 +242,7 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_.get()), content::NotificationService::NoDetails()); base::MessageLoop::current()->RunUntilIdle(); @@ -294,7 +294,7 @@ TEST_F(UserScriptListenerTest, MultiProfile) { extensions::ExtensionRegistry::Get(&profile2)->AddEnabled(extension); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(&profile2), content::Details<Extension>(extension.get())); @@ -307,7 +307,7 @@ TEST_F(UserScriptListenerTest, MultiProfile) { // When the first profile's user scripts are ready, the request should still // be blocked waiting for profile2. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_.get()), content::NotificationService::NoDetails()); base::MessageLoop::current()->RunUntilIdle(); @@ -316,7 +316,7 @@ TEST_F(UserScriptListenerTest, MultiProfile) { // After profile2 is ready, the request should proceed. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(&profile2), content::NotificationService::NoDetails()); base::MessageLoop::current()->RunUntilIdle(); @@ -343,7 +343,7 @@ TEST_F(UserScriptListenerTest, ResumeBeforeStart) { ASSERT_FALSE(request->is_pending()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_.get()), content::NotificationService::NoDetails()); base::MessageLoop::current()->RunUntilIdle(); diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 1f72436..5fce82b 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -350,7 +350,8 @@ UserScriptMaster::UserScriptMaster(Profile* profile) extension_registry_observer_(this), weak_factory_(this) { extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile_)); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, content::NotificationService::AllBrowserContextsAndSources()); @@ -396,7 +397,7 @@ void UserScriptMaster::OnScriptsLoaded( changed_extensions_.clear(); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(profile_), content::Details<base::SharedMemory>(shared_memory_.get())); } @@ -438,7 +439,7 @@ void UserScriptMaster::Observe(int type, const content::NotificationDetails& details) { bool should_start_load = false; switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: extensions_service_ready_ = true; should_start_load = true; break; diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index ccc2c12..4731ceb 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -46,7 +46,8 @@ class UserScriptMasterTest : public testing::Test, ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); // Register for all user script notifications. - registrar_.Add(this, chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, + registrar_.Add(this, + extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); // UserScriptMaster posts tasks to the file thread so make the current @@ -65,7 +66,7 @@ class UserScriptMasterTest : public testing::Test, virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - DCHECK(type == chrome::NOTIFICATION_USER_SCRIPTS_UPDATED); + DCHECK(type == extensions::NOTIFICATION_USER_SCRIPTS_UPDATED); shared_memory_ = content::Details<base::SharedMemory>(details).ptr(); if (base::MessageLoop::current() == &message_loop_) diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 364a3e3..6bfa00f 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -290,7 +290,8 @@ WebstoreInstaller::WebstoreInstaller(Profile* profile, DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(web_contents); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::Source<CrxInstaller>(NULL)); extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); } @@ -360,7 +361,7 @@ void WebstoreInstaller::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { + case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); CHECK(crx_installer); if (crx_installer != crx_installer_.get()) diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc index 36478f2..dab0827 100644 --- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc @@ -244,9 +244,10 @@ class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest, virtual void SetUpOnMainThread() OVERRIDE { WebstoreStartupInstallerTest::SetUpOnMainThread(); - registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, - content::NotificationService::AllSources()); + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, content::NotificationService::AllSources()); } @@ -259,7 +260,8 @@ class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest, virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - if (type == chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { + if (type == + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { const Extension* extension = content::Details<const extensions::InstalledExtensionInfo>(details)-> extension; diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 8554177..d023a27 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -126,7 +126,8 @@ class FirstRunDelayedTasks : public content::NotificationObserver { explicit FirstRunDelayedTasks(Tasks task) { if (task == INSTALL_EXTENSIONS) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::NotificationService::AllSources()); } registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, @@ -137,7 +138,7 @@ class FirstRunDelayedTasks : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { // After processing the notification we always delete ourselves. - if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { + if (type == extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED) { Profile* profile = content::Source<Profile>(source).ptr(); ExtensionService* service = extensions::ExtensionSystem::Get(profile)->extension_service(); diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index 7773a0e..98544a9 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -33,7 +33,7 @@ class InfoBarsTest : public InProcessBrowserTest { browser()->profile())->extension_service(); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); scoped_ptr<ExtensionInstallPrompt> client(new ExtensionInstallPrompt( diff --git a/chrome/browser/notifications/notification_system_observer.cc b/chrome/browser/notifications/notification_system_observer.cc index 36dbb9c9..97c9654 100644 --- a/chrome/browser/notifications/notification_system_observer.cc +++ b/chrome/browser/notifications/notification_system_observer.cc @@ -17,7 +17,8 @@ NotificationSystemObserver::NotificationSystemObserver( DCHECK(ui_manager_); registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, content::NotificationService::AllSources()); @@ -32,7 +33,7 @@ void NotificationSystemObserver::Observe( const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_APP_TERMINATING) { ui_manager_->CancelAll(); - } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { + } else if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { if (!content::Source<Profile>(source)->IsOffTheRecord()) { extensions::UnloadedExtensionInfo* extension_info = content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); diff --git a/chrome/browser/performance_monitor/performance_monitor.cc b/chrome/browser/performance_monitor/performance_monitor.cc index dd76da9..d8b214e 100644 --- a/chrome/browser/performance_monitor/performance_monitor.cc +++ b/chrome/browser/performance_monitor/performance_monitor.cc @@ -229,17 +229,21 @@ void PerformanceMonitor::RegisterForNotifications() { DCHECK(database_logging_enabled_); // Extensions + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_ENABLED, + content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + content::NotificationService::AllSources()); + registrar_.Add(this, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, - content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, - content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::NotificationService::AllSources()); // Crashes @@ -556,19 +560,19 @@ void PerformanceMonitor::Observe(int type, DCHECK(database_logging_enabled_); switch (type) { - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { AddExtensionEvent( EVENT_EXTENSION_INSTALL, content::Details<const extensions::InstalledExtensionInfo>(details)-> extension); break; } - case chrome::NOTIFICATION_EXTENSION_ENABLED: { + case extensions::NOTIFICATION_EXTENSION_ENABLED: { AddExtensionEvent(EVENT_EXTENSION_ENABLE, content::Details<Extension>(details).ptr()); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const UnloadedExtensionInfo* info = content::Details<UnloadedExtensionInfo>(details).ptr(); @@ -579,7 +583,7 @@ void PerformanceMonitor::Observe(int type, } break; } - case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { + case extensions::NOTIFICATION_CRX_INSTALLER_DONE: { const extensions::CrxInstaller* installer = content::Source<extensions::CrxInstaller>(source).ptr(); const extensions::Extension* extension = @@ -593,7 +597,7 @@ void PerformanceMonitor::Observe(int type, } break; } - case chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: { AddExtensionEvent(EVENT_EXTENSION_UNINSTALL, content::Details<Extension>(details).ptr()); break; diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc index b773c44..ee0d5f2 100644 --- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc +++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc @@ -508,7 +508,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { // Create an observer to wait for the update to finish. content::WindowedNotificationObserver windowed_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(crx_installer)); ASSERT_TRUE(extension_service->UpdateExtension( extension->id(), path_v2_, true, &crx_installer)); diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 1fbeddc..f1fd484 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -672,7 +672,7 @@ class PolicyTest : public InProcessBrowserTest { installer->set_creation_flags(extensions::Extension::FROM_WEBSTORE); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); installer->InstallCrx(extension_path); observer.Wait(); @@ -687,8 +687,8 @@ class PolicyTest : public InProcessBrowserTest { scoped_refptr<extensions::UnpackedInstaller> installer = extensions::UnpackedInstaller::Create(extension_service()); content::WindowedNotificationObserver observer( - expect_success ? chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED - : chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, + expect_success ? extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED + : extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, content::NotificationService::AllSources()); installer->Load(extension_path); observer.Wait(); @@ -705,8 +705,9 @@ class PolicyTest : public InProcessBrowserTest { void UninstallExtension(const std::string& id, bool expect_success) { content::WindowedNotificationObserver observer( - expect_success ? chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED - : chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, + expect_success + ? extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED + : extensions::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, content::NotificationService::AllSources()); extension_service()->UninstallExtension( id, @@ -1621,7 +1622,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, forcelist.DeepCopy(), NULL); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::NotificationService::AllSources()); UpdateProviderPolicy(policies); observer.Wait(); @@ -1659,7 +1660,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { extensions::ExtensionUpdater::CheckParams params; params.install_immediately = true; content::WindowedNotificationObserver update_observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::NotificationService::AllSources()); updater->CheckNow(params); update_observer.Wait(); @@ -1702,10 +1703,10 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { BackgroundContentsService:: SetRestartDelayForForceInstalledAppsAndExtensionsForTesting(0); content::WindowedNotificationObserver extension_crashed_observer( - chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllSources()); content::WindowedNotificationObserver extension_loaded_observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); extensions::ExtensionHost* extension_host = extensions::ExtensionSystem::Get(browser()->profile())-> @@ -1789,7 +1790,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { UpdateProviderPolicy(policies); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, content::NotificationService::AllSources()); PerformClick(1, 0); observer.Wait(); diff --git a/chrome/browser/supervised_user/supervised_user_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_service_unittest.cc index ae7f433..bc68d83 100644 --- a/chrome/browser/supervised_user/supervised_user_service_unittest.cc +++ b/chrome/browser/supervised_user/supervised_user_service_unittest.cc @@ -348,7 +348,7 @@ TEST_F(SupervisedUserServiceExtensionTest, InstallContentPacks) { base::FilePath extension_path = test_data_dir.AppendASCII("extensions/supervised_user/content_pack"); content::WindowedNotificationObserver extension_load_observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_.get())); installer->Load(extension_path); extension_load_observer.Wait(); diff --git a/chrome/browser/sync/glue/extensions_activity_monitor.cc b/chrome/browser/sync/glue/extensions_activity_monitor.cc index 5768718..b7b2391 100644 --- a/chrome/browser/sync/glue/extensions_activity_monitor.cc +++ b/chrome/browser/sync/glue/extensions_activity_monitor.cc @@ -25,7 +25,7 @@ ExtensionsActivityMonitor::ExtensionsActivityMonitor() // wanted to use the string name). Thus, we use all sources and filter in // Observe. registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, + extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, content::NotificationService::AllSources()); } diff --git a/chrome/browser/sync/glue/extensions_activity_monitor_unittest.cc b/chrome/browser/sync/glue/extensions_activity_monitor_unittest.cc index 3b3ee3c..80d5e9c 100644 --- a/chrome/browser/sync/glue/extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/extensions_activity_monitor_unittest.cc @@ -52,7 +52,7 @@ void FireBookmarksApiEvent( bookmarks_function->set_name(T::function_name()); for (int i = 0; i < repeats; i++) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, + extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, content::Source<Extension>(extension.get()), content::Details<const extensions::BookmarksFunction>( bookmarks_function.get())); diff --git a/chrome/browser/sync/test/integration/sync_extension_installer.cc b/chrome/browser/sync/test/integration/sync_extension_installer.cc index a97b702..9d08d1a 100644 --- a/chrome/browser/sync/test/integration/sync_extension_installer.cc +++ b/chrome/browser/sync/test/integration/sync_extension_installer.cc @@ -15,7 +15,7 @@ SyncedExtensionInstaller::SyncedExtensionInstaller(Profile* profile) weak_ptr_factory_(this) { DoInstallSyncedExtensions(); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, + extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, content::Source<Profile>(profile_)); } @@ -26,7 +26,7 @@ void SyncedExtensionInstaller::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, type); // The extension system is trying to check for updates. In the real world, // this would be where synced extensions are asynchronously downloaded from diff --git a/chrome/browser/sync/test/integration/themes_helper.cc b/chrome/browser/sync/test/integration/themes_helper.cc index 78f4d7a..7f6c980 100644 --- a/chrome/browser/sync/test/integration/themes_helper.cc +++ b/chrome/browser/sync/test/integration/themes_helper.cc @@ -130,7 +130,7 @@ void ThemePendingInstallChecker::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, type); CheckExitCondition(); } @@ -138,7 +138,7 @@ void ThemePendingInstallChecker::Wait() { // We'll check to see if the condition is met whenever the extension system // tries to contact the web store. registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, + extensions::NOTIFICATION_EXTENSION_UPDATING_STARTED, content::Source<Profile>(profile_)); if (IsExitConditionSatisfied()) { diff --git a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc index 616befb..322df28 100644 --- a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc @@ -92,7 +92,7 @@ class TwoClientAppListSyncTest : public SyncTest { if (extension_service && extension_service->is_ready()) return; content::WindowedNotificationObserver extensions_loaded_observer( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::NotificationService::AllSources()); extensions_loaded_observer.Wait(); } diff --git a/chrome/browser/sync/test/integration/two_client_apps_sync_test.cc b/chrome/browser/sync/test/integration/two_client_apps_sync_test.cc index 5649cce..c6532bf 100644 --- a/chrome/browser/sync/test/integration/two_client_apps_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_apps_sync_test.cc @@ -542,7 +542,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { ++num_extensions; { content::WindowedNotificationObserver windowed_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); extensions::CreateOrUpdateBookmarkApp(GetExtensionService(GetProfile(0)), web_app_info); @@ -552,7 +552,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { } { content::WindowedNotificationObserver windowed_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); extensions::CreateOrUpdateBookmarkApp(GetExtensionService(verifier()), web_app_info); @@ -563,7 +563,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { { // Wait for the synced app to install. content::WindowedNotificationObserver windowed_observer( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); ASSERT_TRUE(AwaitQuiescence()); windowed_observer.Wait(); diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index a4a854d..bc77a17 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -101,7 +101,7 @@ void ThemeService::Init(Profile* profile) { LoadThemePrefs(); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile_)); theme_syncable_service_.reset(new ThemeSyncableService(profile_, this)); @@ -247,12 +247,13 @@ void ThemeService::Observe(int type, const content::NotificationDetails& details) { using content::Details; switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: - registrar_.Remove(this, chrome::NOTIFICATION_EXTENSIONS_READY, - content::Source<Profile>(profile_)); + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: + registrar_.Remove(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, + content::Source<Profile>(profile_)); OnExtensionServiceReady(); break; - case chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED: { // The theme may be initially disabled. Wait till it is loaded (if ever). Details<const extensions::InstalledExtensionInfo> installed_details( details); @@ -260,8 +261,7 @@ void ThemeService::Observe(int type, installed_pending_load_id_ = installed_details->extension->id(); break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: - { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const Extension* extension = Details<const Extension>(details).ptr(); if (extension->is_theme() && installed_pending_load_id_ != kDefaultThemeID && @@ -271,15 +271,13 @@ void ThemeService::Observe(int type, installed_pending_load_id_ = kDefaultThemeID; break; } - case chrome::NOTIFICATION_EXTENSION_ENABLED: - { + case extensions::NOTIFICATION_EXTENSION_ENABLED: { const Extension* extension = Details<const Extension>(details).ptr(); if (extension->is_theme()) SetTheme(extension); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: - { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { Details<const UnloadedExtensionInfo> unloaded_details(details); if (unloaded_details->reason != UnloadedExtensionInfo::REASON_UPDATE && unloaded_details->extension->is_theme() && @@ -508,17 +506,18 @@ void ThemeService::OnExtensionServiceReady() { NotifyThemeChanged(); } + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::Source<Profile>(profile_)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_ENABLED, content::Source<Profile>(profile_)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_ENABLED, - content::Source<Profile>(profile_)); - registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile_)); base::MessageLoop::current()->PostDelayedTask(FROM_HERE, diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc index 8f370a3..177a4e7 100644 --- a/chrome/browser/themes/theme_service_unittest.cc +++ b/chrome/browser/themes/theme_service_unittest.cc @@ -48,7 +48,7 @@ class ThemeServiceTest : public extensions::ExtensionServiceTestBase { scoped_refptr<extensions::UnpackedInstaller> installer( extensions::UnpackedInstaller::Create(service_)); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_.get())); installer->Load(temp_dir); observer.Wait(); @@ -66,8 +66,8 @@ class ThemeServiceTest : public extensions::ExtensionServiceTestBase { void UpdateUnpackedTheme(const std::string& extension_id) { int updated_notification = service_->IsExtensionEnabled(extension_id) - ? chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED - : chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED; + ? extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED + : extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED; const base::FilePath& path = service_->GetInstalledExtension(extension_id)->path(); diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index a5c826c..a852574 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc @@ -234,7 +234,8 @@ AppListSyncableService::AppListSyncableService( } // The extensions for this profile have not yet all been loaded. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<Profile>(profile)); } @@ -280,7 +281,7 @@ void AppListSyncableService::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, type); DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); registrar_.RemoveAll(); BuildModel(); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 4b2f03a..44c2e00 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc @@ -382,12 +382,13 @@ ChromeLauncherController::ChromeLauncherController(Profile* profile, ash::Shell::GetInstance()->shelf_item_delegate_manager(); } - notification_registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, - content::Source<Profile>(profile_)); notification_registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + content::Source<Profile>(profile_)); + notification_registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile_)); } @@ -1155,7 +1156,7 @@ void ChromeLauncherController::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const Extension* extension = content::Details<const Extension>(details).ptr(); if (IsAppPinned(extension->id())) { @@ -1167,7 +1168,7 @@ void ChromeLauncherController::Observe( UpdateAppLaunchersFromPref(); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const content::Details<UnloadedExtensionInfo>& unload_info(details); const Extension* extension = unload_info->extension; const std::string& id = extension->id(); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 51ebb0e..e83eb7d 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -378,14 +378,16 @@ Browser::Browser(const CreateParams& params) search_delegate_.reset(new SearchDelegate(search_model_.get())); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile_->GetOriginalProfile())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile_->GetOriginalProfile())); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, content::Source<Profile>(profile_->GetOriginalProfile())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllSources()); #if defined(ENABLE_THEMES) registrar_.Add( @@ -1931,7 +1933,7 @@ void Browser::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { chrome::UpdateCommandEnabled( this, IDC_BOOKMARK_PAGE, @@ -1972,14 +1974,14 @@ void Browser::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { + case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { Profile* profile = content::Source<Profile>(source).ptr(); if (profile_->IsSameProfile(profile) && window()->GetLocationBar()) window()->GetLocationBar()->InvalidatePageActions(); break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: chrome::UpdateCommandEnabled( this, IDC_BOOKMARK_PAGE, @@ -1989,7 +1991,7 @@ void Browser::Observe(int type, IDC_BOOKMARK_ALL_TABS, !chrome::ShouldRemoveBookmarkOpenPagesUI(profile_)); // fallthrough - case chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: // During window creation on Windows we may end up calling into // SHAppBarMessage, which internally spawns a nested message loop. This // makes it possible for us to end up here before window creation has diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm index 889f544..bf2cd9a 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm @@ -52,9 +52,9 @@ class ExtensionActionIconFactoryBridge : owner_(owner), browser_action_([[owner cell] extensionAction]), icon_factory_(profile, extension, browser_action_, this) { - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, - content::Source<ExtensionAction>(browser_action_)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + content::Source<ExtensionAction>(browser_action_)); } virtual ~ExtensionActionIconFactoryBridge() {} @@ -69,7 +69,7 @@ class ExtensionActionIconFactoryBridge int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) + if (type == extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) [owner_ updateState]; else NOTREACHED(); diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index ee551c1..c8281f3 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -184,11 +184,13 @@ class ExtensionServiceObserverBridge ExtensionServiceObserverBridge(BrowserActionsController* owner, Browser* browser) : owner_(owner), browser_(browser) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, - content::Source<Profile>(browser->profile())); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<Profile>(browser->profile())); + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, + content::Source<Profile>(browser->profile())); } // Overridden from content::NotificationObserver. @@ -197,14 +199,14 @@ class ExtensionServiceObserverBridge const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionPopupController* popup = [ExtensionPopupController popup]; if (popup && ![popup isClosing]) [popup close]; break; } - case chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC: { + case extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC: { std::pair<const std::string, gfx::NativeWindow>* payload = content::Details<std::pair<const std::string, gfx::NativeWindow> >( details).ptr(); diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm index 01f53d4..2e7f6b9 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm @@ -61,10 +61,11 @@ class ExtensionLoadedNotificationObserver ExtensionInstalledBubbleController* controller, Profile* profile) : controller_(controller) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + content::Source<Profile>(profile)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - content::Source<Profile>(profile)); } private: @@ -74,7 +75,7 @@ class ExtensionLoadedNotificationObserver int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { - if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) { + if (type == extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) { const Extension* extension = content::Details<const Extension>(details).ptr(); if (extension == [controller_ extension]) { @@ -82,7 +83,7 @@ class ExtensionLoadedNotificationObserver withObject:controller_ waitUntilDone:NO]; } - } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { + } else if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { const Extension* extension = content::Details<const UnloadedExtensionInfo>(details)->extension; if (extension == [controller_ extension]) { diff --git a/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm b/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm index 35ff743..ef45ec5 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm @@ -61,9 +61,9 @@ bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent( int type = 0; if (command_name == values::kPageActionCommandEvent) { - type = chrome::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC; + type = extensions::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC; } else if (command_name == values::kBrowserActionCommandEvent) { - type = chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC; + type = extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC; } else { // Not handled by using notifications. Route it through the Browser Event // Router using the base class (it will iterate through all targets). diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm index 1e88c84..5bc804b 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm @@ -127,7 +127,7 @@ class DevtoolsNotificationBridge : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { if (content::Details<extensions::ExtensionViewHost>( [controller_ extensionViewHost]) == details) { [controller_ showDevTools]; @@ -195,7 +195,7 @@ class DevtoolsNotificationBridge : public content::NotificationObserver { // Listen for the extension to finish loading so the dev tools can be // opened. registrar_->Add(notificationBridge_.get(), - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::Source<BrowserContext>(host->browser_context())); } } diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 85e21cb..a1cf28d 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -143,12 +143,15 @@ LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field, } registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + this, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, content::NotificationService::AllSources()); content::Source<Profile> profile_source = content::Source<Profile>(profile); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + profile_source); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, profile_source); edit_bookmarks_enabled_.Init( @@ -218,7 +221,7 @@ void LocationBarViewMac::UpdatePageActions() { Layout(); if (page_action_decorations_.size() != count_before) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, content::Source<LocationBar>(this), content::NotificationService::NoDetails()); } @@ -230,7 +233,7 @@ void LocationBarViewMac::InvalidatePageActions() { Layout(); if (page_action_decorations_.size() != count_before) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, content::Source<LocationBar>(this), content::NotificationService::NoDetails()); } @@ -618,7 +621,7 @@ void LocationBarViewMac::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { + case extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { WebContents* contents = GetWebContents(); if (content::Details<WebContents>(contents) != details) return; @@ -628,8 +631,8 @@ void LocationBarViewMac::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: Update(NULL); break; diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm index 12345a3..3c4db07 100644 --- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm @@ -60,10 +60,12 @@ PageActionDecoration::PageActionDecoration( icon_factory_.reset(new ExtensionActionIconFactory( browser_->profile(), extension, page_action, this)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, - content::Source<Profile>(browser_->profile())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC, - content::Source<Profile>(browser_->profile())); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + content::Source<Profile>(browser_->profile())); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC, + content::Source<Profile>(browser_->profile())); // We set the owner last of all so that we can determine whether we are in // the process of initializing this class or not. @@ -161,7 +163,7 @@ void PageActionDecoration::UpdateVisibility(WebContents* contents, if (IsVisible() != visible) { SetVisible(visible); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionAction>(page_action_), content::Details<WebContents>(contents)); } @@ -232,14 +234,14 @@ void PageActionDecoration::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionPopupController* popup = [ExtensionPopupController popup]; if (popup && ![popup isClosing]) [popup close]; break; } - case chrome::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC: { + case extensions::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC: { std::pair<const std::string, gfx::NativeWindow>* payload = content::Details<std::pair<const std::string, gfx::NativeWindow> >( details).ptr(); diff --git a/chrome/browser/ui/extensions/extension_enable_flow.cc b/chrome/browser/ui/extensions/extension_enable_flow.cc index 1689d41..ebfbdb7 100644 --- a/chrome/browser/ui/extensions/extension_enable_flow.cc +++ b/chrome/browser/ui/extensions/extension_enable_flow.cc @@ -114,7 +114,8 @@ void ExtensionEnableFlow::CreatePrompt() { void ExtensionEnableFlow::StartObserving() { extension_registry_observer_.Add( extensions::ExtensionRegistry::Get(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, content::Source<Profile>(profile_)); } @@ -126,7 +127,7 @@ void ExtensionEnableFlow::StopObserving() { void ExtensionEnableFlow::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, type); StopObserving(); delegate_->ExtensionEnableFlowAborted(false); } diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index 725cccf..f857040 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -439,7 +439,7 @@ void Panel::Observe(int type, case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: ConfigureAutoResize(content::Source<content::WebContents>(source).ptr()); break; - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: if (content::Details<extensions::UnloadedExtensionInfo>( details)->extension->id() == extension_id()) Close(); @@ -532,7 +532,8 @@ void Panel::Initialize(const GURL& url, native_panel_->AttachWebContents(web_contents); // Close when the extension is unloaded or the browser is exiting. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile_)); registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 52c4d30..f682312a 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -1421,7 +1421,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, extensions::UnloadedExtensionInfo details( extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(browser()->profile()), content::Details<extensions::UnloadedExtensionInfo>(&details)); diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc index 2726129..6384564 100644 --- a/chrome/browser/ui/views/extensions/extension_dialog.cc +++ b/chrome/browser/ui/views/extensions/extension_dialog.cc @@ -39,13 +39,16 @@ ExtensionDialog::ExtensionDialog(extensions::ExtensionViewHost* host, observer_(observer) { AddRef(); // Balanced in DeleteDelegate(); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::Source<BrowserContext>(host->browser_context())); // Listen for the containing view calling window.close(); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<BrowserContext>(host->browser_context())); // Listen for a crash or other termination of the extension process. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::Source<BrowserContext>(host->browser_context())); } @@ -194,7 +197,7 @@ void ExtensionDialog::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: // Avoid potential overdraw by removing the temporary background after // the extension finishes loading. GetExtensionView(host_.get())->set_background(NULL); @@ -203,13 +206,13 @@ void ExtensionDialog::Observe(int type, if (content::Details<extensions::ExtensionHost>(host()) == details) MaybeFocusRenderView(); break; - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: // If we aren't the host of the popup, then disregard the notification. if (content::Details<extensions::ExtensionHost>(host()) != details) return; GetWidget()->Close(); break; - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: + case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: if (content::Details<extensions::ExtensionHost>(host()) != details) return; if (observer_) diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 68b0868..06a8bc0 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -65,7 +65,9 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host, content::Source<content::WebContents>(host->host_contents())); // Listen for the containing view calling window.close(); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add( + this, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<content::BrowserContext>(host->browser_context())); content::DevToolsManager::GetInstance()->AddAgentStateCallback( devtools_callback_); @@ -91,7 +93,7 @@ void ExtensionPopup::Observe(int type, // Show when the content finishes loading and its width is computed. ShowBubble(); break; - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: // If we aren't the host of the popup, then disregard the notification. if (content::Details<extensions::ExtensionHost>(host()) == details) GetWidget()->Close(); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 87fc383..0ad124e 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -412,10 +412,11 @@ void LocationBarView::Init() { hide_url_animation_->SetSlideDuration(175); content::Source<Profile> profile_source = content::Source<Profile>(profile()); - registrar_.Add( - this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + profile_source); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, profile_source); // Initialize the location entry. We do this to avoid a black flash which is @@ -1216,7 +1217,7 @@ bool LocationBarView::RefreshPageActionViews() { old_visibility[action] != (*i)->visible()) { changed = true; content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionAction>(action), content::Details<WebContents>(web_contents)); } @@ -1383,7 +1384,7 @@ void LocationBarView::UpdatePageActions() { bool changed = RefreshPageActionViews(); if (page_action_views_.size() != count_before) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, content::Source<LocationBar>(this), content::NotificationService::NoDetails()); } @@ -1399,7 +1400,7 @@ void LocationBarView::InvalidatePageActions() { DeletePageActionViews(); if (page_action_views_.size() != count_before) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, content::Source<LocationBar>(this), content::NotificationService::NoDetails()); } @@ -1748,8 +1749,8 @@ void LocationBarView::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: Update(NULL); break; diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.cc b/chrome/browser/ui/views/toolbar/browser_action_view.cc index 2ccafe6..28185ab 100644 --- a/chrome/browser/ui/views/toolbar/browser_action_view.cc +++ b/chrome/browser/ui/views/toolbar/browser_action_view.cc @@ -122,11 +122,14 @@ BrowserActionButton::BrowserActionButton(const Extension* extension, content::NotificationSource notification_source = content::Source<Profile>(browser_->profile()->GetOriginalProfile()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::Source<ExtensionAction>(browser_action_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED, notification_source); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, notification_source); // We also listen for browser theme changes on linux because a switch from or @@ -326,21 +329,21 @@ void BrowserActionButton::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED: + case extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED: UpdateState(); // The browser action may have become visible/hidden so we need to make // sure the state gets updated. delegate_->OnBrowserActionVisibilityChanged(); break; - case chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED: - case chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { + case extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED: + case extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { std::pair<const std::string, const std::string>* payload = content::Details<std::pair<const std::string, const std::string> >( details).ptr(); if (extension_->id() == payload->first && payload->second == extensions::manifest_values::kBrowserActionCommandEvent) { - if (type == chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED) + if (type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED) MaybeRegisterExtensionCommand(); else MaybeUnregisterExtensionCommand(true); diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc index 15fb429..2f08380 100644 --- a/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc +++ b/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc @@ -42,7 +42,7 @@ class BrowserActionsContainerTest : public ExtensionBrowserTest { browser_actions_bar_->GetExtensionAction(extension_index); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::Source<ExtensionAction>(browser_action)); observer.Wait(); } diff --git a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc index fbb9af1..a7640ef4 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc @@ -98,7 +98,7 @@ const Extension* ExtensionSettingsUIBrowserTest::InstallExtension( extensions::CrxInstaller::OffStoreInstallAllowedInTest); observer_->Watch( - chrome::NOTIFICATION_CRX_INSTALLER_DONE, + extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(installer.get())); installer->InstallCrx(crx_path); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 213e65b..3ac289d 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -682,7 +682,7 @@ void ExtensionSettingsHandler::Observe( web_contents()->GetRenderViewHost(); // Fall through. case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: - case chrome::NOTIFICATION_EXTENSION_HOST_CREATED: + case extensions::NOTIFICATION_EXTENSION_HOST_CREATED: source_profile = content::Source<Profile>(source).ptr(); if (!profile->IsSameProfile(source_profile)) return; @@ -696,11 +696,11 @@ void ExtensionSettingsHandler::Observe( MaybeUpdateAfterNotification(); break; } - case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: - case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: + case extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED: + case extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: MaybeUpdateAfterNotification(); break; - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: // This notification is sent when the extension host destruction begins, // not when it finishes. We use PostTask to delay the update until after // the destruction finishes. @@ -1214,9 +1214,11 @@ void ExtensionSettingsHandler::MaybeRegisterForNotifications() { Profile* profile = Profile::FromWebUI(web_ui()); // Register for notifications that we need to reload the page. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED, content::Source<Profile>(profile)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_CREATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, @@ -1226,10 +1228,10 @@ void ExtensionSettingsHandler::MaybeRegisterForNotifications() { content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add( this, - chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionPrefs>(ExtensionPrefs::Get(profile))); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index b2e58cc..b5c95a2 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -254,7 +254,7 @@ void AppLauncherHandler::Observe(int type, return; switch (type) { - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { const Extension* extension = content::Details<const Extension>(details).ptr(); if (!extension->is_app()) @@ -280,11 +280,11 @@ void AppLauncherHandler::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: - case chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: { const Extension* extension = NULL; bool uninstalled = false; - if (type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED) { + if (type == extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED) { extension = content::Details<const Extension>(details).ptr(); uninstalled = true; } else { // NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED @@ -319,7 +319,7 @@ void AppLauncherHandler::Observe(int type, } break; } - case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: { + case chrome::NOTIFICATION_APP_LAUNCHER_REORDERED: { const std::string* id = content::Details<const std::string>(details).ptr(); if (id) { @@ -340,7 +340,7 @@ void AppLauncherHandler::Observe(int type, } break; } - case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { + case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); if (!Profile::FromWebUI(web_ui())->IsSameProfile( crx_installer->profile())) { @@ -348,7 +348,7 @@ void AppLauncherHandler::Observe(int type, } // Fall through. } - case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: { + case extensions::NOTIFICATION_EXTENSION_LOAD_ERROR: { attempted_bookmark_app_install_ = false; break; } @@ -456,21 +456,24 @@ void AppLauncherHandler::HandleGetApps(const base::ListValue* args) { extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<Profile>(profile)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<Profile>(profile)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + content::Source<Profile>(profile)); + registrar_.Add(this, + chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, content::Source<AppSorting>( ExtensionPrefs::Get(profile)->app_sorting())); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, - content::Source<CrxInstaller>(NULL)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, - content::Source<Profile>(profile)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, + content::Source<CrxInstaller>(NULL)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, + content::Source<Profile>(profile)); } has_loaded_apps_ = true; diff --git a/chrome/browser/ui/webui/policy_ui.cc b/chrome/browser/ui/webui/policy_ui.cc index b1f3c39..b70dfc7 100644 --- a/chrome/browser/ui/webui/policy_ui.cc +++ b/chrome/browser/ui/webui/policy_ui.cc @@ -577,10 +577,10 @@ void PolicyUIHandler::RegisterMessages() { GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); web_ui()->RegisterMessageCallback( @@ -595,8 +595,8 @@ void PolicyUIHandler::RegisterMessages() { void PolicyUIHandler::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || - type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); + DCHECK(type == extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || + type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); SendPolicyNames(); SendPolicyValues(); } diff --git a/chrome/browser/ui/webui/uber/uber_ui.cc b/chrome/browser/ui/webui/uber/uber_ui.cc index edd2487..989807e 100644 --- a/chrome/browser/ui/webui/uber/uber_ui.cc +++ b/chrome/browser/ui/webui/uber/uber_ui.cc @@ -193,10 +193,12 @@ UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { content::WebUIDataSource::Add(profile, CreateUberFrameHTMLSource(profile)); // Register as an observer for when extensions are loaded and unloaded. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, - content::Source<Profile>(profile)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - content::Source<Profile>(profile)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + content::Source<Profile>(profile)); + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + content::Source<Profile>(profile)); } UberFrameUI::~UberFrameUI() { @@ -212,8 +214,8 @@ void UberFrameUI::Observe(int type, // we must update the behavior of the History navigation element so that // it opens the history extension if one is installed and enabled or // opens the default history page if one is uninstalled or disabled. - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { Profile* profile = Profile::FromWebUI(web_ui()); bool overrides_history = HasExtensionType(profile, chrome::kChromeUIHistoryHost); diff --git a/chrome/test/base/extension_load_waiter_one_shot.cc b/chrome/test/base/extension_load_waiter_one_shot.cc index 5da086e..ccd3661 100644 --- a/chrome/test/base/extension_load_waiter_one_shot.cc +++ b/chrome/test/base/extension_load_waiter_one_shot.cc @@ -25,7 +25,7 @@ void ExtensionLoadWaiterOneShot::WaitForExtension(const char* extension_id, extension_id_ = extension_id; load_looper_ = new content::MessageLoopRunner(); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllSources()); load_cb.Run(); load_looper_->Run(); @@ -35,15 +35,16 @@ void ExtensionLoadWaiterOneShot::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { extensions::ExtensionHost* host = content::Details<extensions::ExtensionHost>(details).ptr(); if (host->extension_id() == extension_id_) { browser_context_ = host->browser_context(); CHECK(browser_context_); - registrar_.Remove(this, - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, - content::NotificationService::AllSources()); + registrar_.Remove( + this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + content::NotificationService::AllSources()); load_looper_->Quit(); } break; diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc index 1c5288c..6510489 100644 --- a/chrome/test/remoting/remote_desktop_browsertest.cc +++ b/chrome/test/remoting/remote_desktop_browsertest.cc @@ -120,7 +120,7 @@ void RemoteDesktopBrowserTest::InstallChromotingAppUnpacked() { installer->set_prompt_for_plugins(false); content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); installer->Load(webapp_unpacked_); diff --git a/extensions/DEPS b/extensions/DEPS index f0606ba..fede72f 100644 --- a/extensions/DEPS +++ b/extensions/DEPS @@ -12,13 +12,8 @@ include_rules = [ "+testing", "+ui", - # Temporarily allowed includes as part of the app shell/extensions refactor. - # # NOTE: Please do not add includes without talking to the app shell team; # see OWNERS for this directory. - # - # TODO(jamescook): Remove this. http://crbug.com/392622 - "!chrome/browser/chrome_notification_types.h", ] specific_include_rules = { diff --git a/extensions/browser/api/api_resource_manager.h b/extensions/browser/api/api_resource_manager.h index 56795e6..c220278 100644 --- a/extensions/browser/api/api_resource_manager.h +++ b/extensions/browser/api/api_resource_manager.h @@ -12,7 +12,6 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/threading/non_thread_safe.h" -#include "chrome/browser/chrome_notification_types.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" @@ -20,6 +19,7 @@ #include "content/public/browser/notification_service.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_host.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" namespace extensions { @@ -117,10 +117,10 @@ class ApiResourceManager : public BrowserContextKeyedAPI, explicit ApiResourceManager(content::BrowserContext* context) : data_(new ApiResourceData()) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); } // For Testing. @@ -186,13 +186,13 @@ class ApiResourceManager : public BrowserContextKeyedAPI, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { std::string id = content::Details<extensions::UnloadedExtensionInfo>( details)->extension->id(); data_->InitiateExtensionUnloadedCleanup(id); break; } - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); data_->InitiateExtensionSuspendedCleanup(host->extension_id()); break; diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc index b028aee..95ca66a 100644 --- a/extensions/browser/api/runtime/runtime_api.cc +++ b/extensions/browser/api/runtime/runtime_api.cc @@ -12,7 +12,6 @@ #include "base/metrics/histogram.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/notification_service.h" @@ -27,6 +26,7 @@ #include "extensions/browser/extension_util.h" #include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/lazy_background_task_queue.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/common/api/runtime.h" #include "extensions/common/error_utils.h" @@ -141,7 +141,7 @@ RuntimeAPI::RuntimeAPI(content::BrowserContext* context) dispatch_chrome_updated_event_(false), extension_registry_observer_(this) { registrar_.Add(this, - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(context)); extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); @@ -161,7 +161,7 @@ RuntimeAPI::~RuntimeAPI() { void RuntimeAPI::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); + DCHECK_EQ(extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, type); // We're done restarting Chrome after an update. dispatch_chrome_updated_event_ = false; diff --git a/extensions/browser/api/runtime/runtime_apitest.cc b/extensions/browser/api/runtime/runtime_apitest.cc index 167a91a..2f92756 100644 --- a/extensions/browser/api/runtime/runtime_apitest.cc +++ b/extensions/browser/api/runtime/runtime_apitest.cc @@ -97,10 +97,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_ChromeRuntimeReload) { // anyway. for (int i = 0; i < 30; i++) { content::WindowedNotificationObserver unload_observer( - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources()); content::WindowedNotificationObserver load_observer( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); ASSERT_TRUE(ExecuteScriptInBackgroundPageNoWait( diff --git a/extensions/browser/api/test/test_api.cc b/extensions/browser/api/test/test_api.cc index 1dd1f93..4faaa03 100644 --- a/extensions/browser/api/test/test_api.cc +++ b/extensions/browser/api/test/test_api.cc @@ -8,11 +8,11 @@ #include "base/command_line.h" #include "base/memory/singleton.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/notification_service.h" #include "content/public/common/content_switches.h" #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/api/test.h" namespace { @@ -49,7 +49,7 @@ TestNotifyPassFunction::~TestNotifyPassFunction() {} bool TestNotifyPassFunction::RunSafe() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_TEST_PASSED, + extensions::NOTIFICATION_EXTENSION_TEST_PASSED, content::Source<content::BrowserContext>(dispatcher()->browser_context()), content::NotificationService::NoDetails()); return true; @@ -61,7 +61,7 @@ bool TestNotifyFailFunction::RunSafe() { scoped_ptr<NotifyFail::Params> params(NotifyFail::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_TEST_FAILED, + extensions::NOTIFICATION_EXTENSION_TEST_FAILED, content::Source<content::BrowserContext>(dispatcher()->browser_context()), content::Details<std::string>(¶ms->message)); return true; @@ -80,7 +80,7 @@ bool TestSendMessageFunction::RunAsync() { scoped_ptr<PassMessage::Params> params(PassMessage::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, + extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::Source<TestSendMessageFunction>(this), content::Details<std::string>(¶ms->message)); return true; diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc index 21985b1..d8ae867 100644 --- a/extensions/browser/event_router.cc +++ b/extensions/browser/event_router.cc @@ -11,7 +11,6 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" @@ -23,6 +22,7 @@ #include "extensions/browser/extension_util.h" #include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/lazy_background_task_queue.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/process_map.h" #include "extensions/common/extension.h" @@ -174,12 +174,14 @@ EventRouter::EventRouter(BrowserContext* browser_context, content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_ENABLED, content::Source<BrowserContext>(browser_context_)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<BrowserContext>(browser_context_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<BrowserContext>(browser_context_)); } @@ -735,7 +737,7 @@ void EventRouter::Observe(int type, listeners_.RemoveListenersForProcess(renderer); break; } - case chrome::NOTIFICATION_EXTENSION_ENABLED: { + case extensions::NOTIFICATION_EXTENSION_ENABLED: { // If the extension has a lazy background page, make sure it gets loaded // to register the events the extension is interested in. const Extension* extension = @@ -748,7 +750,7 @@ void EventRouter::Observe(int type, } break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { // Add all registered lazy listeners to our cache. const Extension* extension = content::Details<const Extension>(details).ptr(); @@ -762,7 +764,7 @@ void EventRouter::Observe(int type, listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events); break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { // Remove all registered lazy listeners from our cache. UnloadedExtensionInfo* unloaded = content::Details<UnloadedExtensionInfo>(details).ptr(); diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc index e1de908..2f0572e 100644 --- a/extensions/browser/extension_host.cc +++ b/extensions/browser/extension_host.cc @@ -14,7 +14,6 @@ #include "base/metrics/histogram.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -31,6 +30,7 @@ #include "extensions/browser/extension_host_delegate.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/view_type_utils.h" @@ -140,7 +140,8 @@ ExtensionHost::ExtensionHost(const Extension* extension, // Listen for when an extension is unloaded from the same profile, as it may // be the same extension that this points to. - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<BrowserContext>(browser_context_)); // Set up web contents observers and pref observers. @@ -154,7 +155,7 @@ ExtensionHost::~ExtensionHost() { since_created_.Elapsed()); } content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<BrowserContext>(browser_context_), content::Details<ExtensionHost>(this)); ProcessCreationQueue::GetInstance()->Remove(this); @@ -210,7 +211,7 @@ bool ExtensionHost::IsBackgroundPage() const { void ExtensionHost::Close() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<BrowserContext>(browser_context_), content::Details<ExtensionHost>(this)); } @@ -219,7 +220,7 @@ void ExtensionHost::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: // The extension object will be deleted after this notification has been // sent. NULL it out so that dirty pointer issues don't arise in cases // when multiple ExtensionHost objects pointing to the same Extension are @@ -256,7 +257,7 @@ void ExtensionHost::RenderProcessGone(base::TerminationStatus status) { // and they aren't all going to use ExtensionHost. This should be in someplace // more central, like EPM maybe. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::Source<BrowserContext>(browser_context_), content::Details<ExtensionHost>(this)); } @@ -288,7 +289,7 @@ void ExtensionHost::DidStopLoading(content::RenderViewHost* render_view_host) { // Send the notification last, because it might result in this being // deleted. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::Source<BrowserContext>(browser_context_), content::Details<ExtensionHost>(this)); } @@ -314,7 +315,7 @@ void ExtensionHost::OnDocumentAvailable() { ->runtime_data() ->SetBackgroundPageReady(extension_, true); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, content::Source<const Extension>(extension_), content::NotificationService::NoDetails()); } @@ -414,7 +415,7 @@ void ExtensionHost::AddNewContents(WebContents* source, void ExtensionHost::RenderViewReady() { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_HOST_CREATED, + extensions::NOTIFICATION_EXTENSION_HOST_CREATED, content::Source<BrowserContext>(browser_context_), content::Details<ExtensionHost>(this)); } diff --git a/extensions/browser/extension_icon_image.cc b/extensions/browser/extension_icon_image.cc index 99473b1..e2c7e13 100644 --- a/extensions/browser/extension_icon_image.cc +++ b/extensions/browser/extension_icon_image.cc @@ -7,9 +7,9 @@ #include <vector> #include "base/bind.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/image_loader.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/canvas_image_source.h" @@ -150,7 +150,7 @@ IconImage::IconImage( image_skia_ = gfx::ImageSkia(source_, resource_size); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_REMOVED, + extensions::NOTIFICATION_EXTENSION_REMOVED, content::NotificationService::AllSources()); } @@ -228,7 +228,7 @@ void IconImage::OnImageLoaded(float scale, const gfx::Image& image_in) { void IconImage::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_REMOVED); + DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); const Extension* extension = content::Details<const Extension>(details).ptr(); diff --git a/extensions/browser/image_loader_unittest.cc b/extensions/browser/image_loader_unittest.cc index 68b93b0..39ae9e2 100644 --- a/extensions/browser/image_loader_unittest.cc +++ b/extensions/browser/image_loader_unittest.cc @@ -9,12 +9,12 @@ #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/strings/string_util.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" #include "extensions/browser/component_extension_resource_manager.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" @@ -189,7 +189,7 @@ TEST_F(ImageLoaderTest, DeleteExtensionWhileWaitingForCache) { UnloadedExtensionInfo details(extension.get(), UnloadedExtensionInfo::REASON_UNINSTALL); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::NotificationService::AllSources(), content::Details<UnloadedExtensionInfo>(&details)); diff --git a/extensions/browser/lazy_background_task_queue.cc b/extensions/browser/lazy_background_task_queue.cc index 4b8ee09..d5a3afa 100644 --- a/extensions/browser/lazy_background_task_queue.cc +++ b/extensions/browser/lazy_background_task_queue.cc @@ -5,7 +5,6 @@ #include "extensions/browser/lazy_background_task_queue.h" #include "base/callback.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" @@ -16,6 +15,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/process_map.h" #include "extensions/common/extension.h" @@ -28,9 +28,11 @@ namespace extensions { LazyBackgroundTaskQueue::LazyBackgroundTaskQueue( content::BrowserContext* browser_context) : browser_context_(browser_context), extension_registry_observer_(this) { - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllBrowserContextsAndSources()); extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context)); @@ -137,7 +139,7 @@ void LazyBackgroundTaskQueue::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { + case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { // If an on-demand background page finished loading, dispatch queued up // events for it. ExtensionHost* host = @@ -148,7 +150,7 @@ void LazyBackgroundTaskQueue::Observe( } break; } - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { // Notify consumers about the load failure when the background host dies. // This can happen if the extension crashes. This is not strictly // necessary, since we also unload the extension in that case (which diff --git a/extensions/browser/notification_types.h b/extensions/browser/notification_types.h new file mode 100644 index 0000000..74ab91c --- /dev/null +++ b/extensions/browser/notification_types.h @@ -0,0 +1,226 @@ +// Copyright 2014 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. + +#ifndef EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_ +#define EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_ + +#include "content/public/browser/notification_types.h" + +namespace extensions { + +// Only notifications fired by the extensions module should be here. The +// extensions module should not listen to notifications fired by the +// embedder. +enum NotificationType { + NOTIFICATION_EXTENSIONS_START = content::NOTIFICATION_CONTENT_END, + + // Sent when a CrxInstaller finishes. Source is the CrxInstaller that + // finished. The details are the extension which was installed. + NOTIFICATION_CRX_INSTALLER_DONE = NOTIFICATION_EXTENSIONS_START, + + // Sent when the known installed extensions have all been loaded. In + // testing scenarios this can happen multiple times if extensions are + // unloaded and reloaded. The source is a BrowserContext*. + // + // DEPRECATED: Use ExtensionSystem::Get(browser_context)->ready().Post(). + NOTIFICATION_EXTENSIONS_READY_DEPRECATED, + + // Sent when a new extension is loaded. The details are an Extension, and + // the source is a BrowserContext*. + // + // DEPRECATED: Use ExtensionRegistry::AddObserver instead. + NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + + // An error occured while attempting to load an extension. The details are a + // string with details about why the load failed. + NOTIFICATION_EXTENSION_LOAD_ERROR, + + // Sent when an extension is enabled. Under most circumstances, listeners will + // want to use ExtensionRegistryObserver::OnExtensionLoaded(). This + // notification is only fired when the "Enable" button is hit in the + // extensions tab. The details are an Extension, and the source is a + // BrowserContext*. + NOTIFICATION_EXTENSION_ENABLED, + + // Sent when attempting to load a new extension, but they are disabled. The + // details are an Extension, and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_UPDATE_DISABLED, + + // Sent when an extension's permissions change. The details are an + // UpdatedExtensionPermissionsInfo, and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, + + // Sent immediately before new extensions are installed or existing + // extensions are updated. The details are an InstalledExtensionInfo, and the + // source is a BrowserContext*. + // + // DEPRECATED: Use ExtensionRegistry::AddObserver instead. + NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + + // An error occured during extension install. The details are a string with + // details about why the install failed. + NOTIFICATION_EXTENSION_INSTALL_ERROR, + + // Sent when an extension has been uninstalled. The details are an Extension, + // and the source is a BrowserContext*. + // + // DEPRECATED: Use ExtensionRegistry::AddObserver instead. + NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, + + // Sent when an extension uninstall is not allowed because the extension is + // not user manageable. The details are an Extension, and the source is a + // BrowserContext*. + NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, + + // Sent when an extension is unloaded. This happens when an extension is + // uninstalled or disabled. The details are an UnloadedExtensionInfo, and the + // source is a BrowserContext*. + // + // Note that when this notification is sent, the ExtensionService and the + // ExtensionRegistry have already removed the extension from their internal + // state. + // + // DEPRECATED: Use ExtensionRegistry::AddObserver instead. + NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + + // Sent when an Extension object is removed from ExtensionService. This + // can happen when an extension is uninstalled, upgraded, or blacklisted, + // including all cases when the Extension is deleted. The details are an + // Extension, and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_REMOVED, + + // Sent after a new ExtensionHost* is created. The details are + // an ExtensionHost* and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_HOST_CREATED, + + // Sent before an ExtensionHost* is destroyed. The details are + // an ExtensionHost* and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_HOST_DESTROYED, + + // Sent by an ExtensionHost* when it has finished its initial page load, + // including any external resources. + // The details are an ExtensionHost* and the source is a BrowserContext*. + NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + + // Sent by an ExtensionHost* when its render view requests closing through + // window.close(). The details are an ExtensionHost* and the source is a + // BrowserContext*. + NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + + // Sent when extension render process ends (whether it crashes or closes). The + // details are an ExtensionHost* and the source is a BrowserContext*. Not sent + // during browser shutdown. + NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + + // Sent when a background page is ready so other components can load. + NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + + // Sent when a browser action's state has changed. The source is the + // ExtensionAction* that changed. The details are the BrowserContext* that the + // browser action belongs to. + NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + + // Sent when the count of page actions has changed. Note that some of them + // may not apply to the current page. The source is a LocationBar*. There + // are no details. + NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + + // Sent when a browser action's visibility has changed. The source is the + // ExtensionPrefs* that changed, and the details are a std::string with the + // extension's ID. + NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + + // Sent when a page action's visibility has changed. The source is the + // ExtensionAction* that changed. The details are a WebContents*. + NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + + // Sent when a system indicator action's state has changed. The source is the + // BrowserContext* that the browser action belongs to. The details are the + // ExtensionAction* that changed. + NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, + + // Sent when an extension command has been removed. The source is the + // BrowserContext* and the details is a std::pair of two std::string objects + // (an extension ID and the name of the command being removed). + NOTIFICATION_EXTENSION_COMMAND_REMOVED, + + // Sent when an extension command has been added. The source is the + // BrowserContext* and the details is a std::pair of two std::string objects + // (an extension ID and the name of the command being added). + NOTIFICATION_EXTENSION_COMMAND_ADDED, + + // Sent when an extension command shortcut for a browser action is activated + // on Mac. The source is the BrowserContext* and the details is a std::pair of + // a std::string containing an extension ID and a gfx::NativeWindow for the + // associated window. + NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, + + // Sent when an extension command shortcut for a page action is activated + // on Mac. The source is the BrowserContext* and the details is a std::pair of + // a + // std::string containing an extension ID and a gfx::NativeWindow for the + // associated window. + NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC, + + // A new extension RenderViewHost has been registered. The details are + // the RenderViewHost*. + NOTIFICATION_EXTENSION_VIEW_REGISTERED, + + // An extension RenderViewHost has been unregistered. The details are + // the RenderViewHost*. + NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, + + // Sent by an extension to notify the browser about the results of a unit + // test. + NOTIFICATION_EXTENSION_TEST_PASSED, + NOTIFICATION_EXTENSION_TEST_FAILED, + + // Sent by extension test javascript code, typically in a browser test. The + // sender is a std::string representing the extension id, and the details + // are a std::string with some message. This is particularly useful when you + // want to have C++ code wait for javascript code to do something. + NOTIFICATION_EXTENSION_TEST_MESSAGE, + + // Sent when an bookmarks extensions API function was successfully invoked. + // The source is the id of the extension that invoked the function, and the + // details are a pointer to the const BookmarksFunction in question. + NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, + + // Sent when a downloads extensions API event is fired. The source is an + // ExtensionDownloadsEventRouter::NotificationSource, and the details is a + // std::string containing json. Used for testing. + NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, + + // Sent when an omnibox extension has sent back omnibox suggestions. The + // source is the BrowserContext*, and the details are an + // extensions::api::omnibox::SendSuggestions::Params object. + NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, + + // Sent when the user accepts the input in an extension omnibox keyword + // session. The source is the BrowserContext*. + NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, + + // Sent when an omnibox extension has updated the default suggestion. The + // source is the BrowserContext*. + NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + + // Sent when the extension updater starts checking for updates to installed + // extensions. The source is a BrowserContext*, and there are no details. + NOTIFICATION_EXTENSION_UPDATING_STARTED, + + // The extension updater found an update and will attempt to download and + // install it. The source is a BrowserContext*, and the details are an + // extensions::UpdateDetails object with the extension id and version of the + // found update. + NOTIFICATION_EXTENSION_UPDATE_FOUND, + + // Sent when there are new user scripts available. The details are a + // pointer to SharedMemory containing the new scripts. + NOTIFICATION_USER_SCRIPTS_UPDATED, + NOTIFICATION_EXTENSIONS_END +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_ diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc index d111d62..5ba8c13 100644 --- a/extensions/browser/process_manager.cc +++ b/extensions/browser/process_manager.cc @@ -13,7 +13,6 @@ #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_agent_host.h" @@ -33,6 +32,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager_delegate.h" #include "extensions/browser/process_manager_observer.h" #include "extensions/browser/view_type_utils.h" @@ -94,7 +94,7 @@ bool IsFrameInExtensionHost(ExtensionHost* extension_host, void OnRenderViewHostUnregistered(BrowserContext* context, RenderViewHost* render_view_host) { content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, + extensions::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED, content::Source<BrowserContext>(context), content::Details<RenderViewHost>(render_view_host)); } @@ -248,16 +248,20 @@ ProcessManager::ProcessManager(BrowserContext* context, weak_ptr_factory_(this) { // ExtensionRegistry is shared between incognito and regular contexts. DCHECK_EQ(original_context, extension_registry_->browser_context()); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context)); registrar_.Add(this, - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<BrowserContext>(original_context)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source<BrowserContext>(original_context)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<BrowserContext>(context)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, + extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, content::Source<BrowserContext>(context)); registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, content::NotificationService::AllSources()); @@ -653,14 +657,14 @@ void ProcessManager::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_EXTENSIONS_READY: { + case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: { // TODO(jamescook): Convert this to use ExtensionSystem::ready() instead // of a notification. MaybeCreateStartupBackgroundHosts(); break; } - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { BrowserContext* context = content::Source<BrowserContext>(source).ptr(); ExtensionSystem* system = ExtensionSystem::Get(context); if (system->ready().is_signaled()) { @@ -672,7 +676,7 @@ void ProcessManager::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { + case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { const Extension* extension = content::Details<UnloadedExtensionInfo>(details)->extension; for (ExtensionHostSet::iterator iter = background_hosts_.begin(); @@ -687,7 +691,7 @@ void ProcessManager::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { + case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); if (background_hosts_.erase(host)) { ClearBackgroundPageData(host->extension()->id()); @@ -697,7 +701,7 @@ void ProcessManager::Observe(int type, break; } - case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + case extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); if (host->extension_host_type() == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { CloseBackgroundHost(host); @@ -741,7 +745,7 @@ void ProcessManager::Observe(int type, // RegisterRenderViewHost is called too early (before the process is // available), so we need to wait until now to notify. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, + extensions::NOTIFICATION_EXTENSION_VIEW_REGISTERED, content::Source<BrowserContext>(GetBrowserContext()), content::Details<RenderViewHost>(contents->GetRenderViewHost())); break; @@ -802,10 +806,10 @@ void ProcessManager::MaybeCreateStartupBackgroundHosts() { ExtensionsBrowserClient::Get()->GetOriginalContext(GetBrowserContext()); if (registrar_.IsRegistered( this, - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context))) { registrar_.Remove(this, - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context)); } } @@ -898,7 +902,8 @@ IncognitoProcessManager::IncognitoProcessManager( // load the background pages of the spanning extensions. This process // manager need only worry about the split mode extensions, which is handled // in the NOTIFICATION_BROWSER_WINDOW_READY notification handler. - registrar_.Remove(this, chrome::NOTIFICATION_EXTENSIONS_READY, + registrar_.Remove(this, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context)); } diff --git a/extensions/browser/process_manager_unittest.cc b/extensions/browser/process_manager_unittest.cc index 3848d1c..e04b0d3 100644 --- a/extensions/browser/process_manager_unittest.cc +++ b/extensions/browser/process_manager_unittest.cc @@ -4,7 +4,6 @@ #include "extensions/browser/process_manager.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/site_instance.h" @@ -12,6 +11,7 @@ #include "content/public/test/test_browser_context.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extensions_test.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager_delegate.h" #include "extensions/browser/test_extensions_browser_client.h" @@ -108,16 +108,17 @@ TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) { // It observes other notifications from this context. EXPECT_TRUE(IsRegistered(manager1.get(), - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, original_context())); EXPECT_TRUE(IsRegistered(manager1.get(), - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, original_context())); + EXPECT_TRUE( + IsRegistered(manager1.get(), + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + original_context())); EXPECT_TRUE(IsRegistered(manager1.get(), - chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, - original_context())); - EXPECT_TRUE(IsRegistered(manager1.get(), - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, original_context())); // Test for an incognito context ProcessManager. @@ -132,18 +133,19 @@ TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) { // Some notifications are observed for the original context. EXPECT_TRUE(IsRegistered(manager2.get(), - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, original_context())); // Some notifications are observed for the incognito context. EXPECT_TRUE(IsRegistered(manager2.get(), - chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, incognito_context())); // Some are not observed at all. - EXPECT_FALSE(IsRegistered(manager2.get(), - chrome::NOTIFICATION_EXTENSIONS_READY, - original_context())); + EXPECT_FALSE( + IsRegistered(manager2.get(), + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, + original_context())); } // Test that startup background hosts are created when the extension system @@ -159,7 +161,7 @@ TEST_F(ProcessManagerTest, CreateBackgroundHostsOnExtensionsReady) { // Simulate the extension system becoming ready. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context()), content::NotificationService::NoDetails()); EXPECT_TRUE(manager->startup_background_hosts_created_for_test()); @@ -192,7 +194,7 @@ TEST_F(ProcessManagerTest, CreateBackgroundHostsDeferred) { // The extension system becoming ready still doesn't create the hosts. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context()), content::NotificationService::NoDetails()); EXPECT_FALSE(manager->startup_background_hosts_created_for_test()); @@ -217,7 +219,7 @@ TEST_F(ProcessManagerTest, IsBackgroundHostAllowed) { // The extension system becoming ready still doesn't create the hosts. content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(original_context()), content::NotificationService::NoDetails()); EXPECT_FALSE(manager->startup_background_hosts_created_for_test()); diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 021e21a..bcfaee8 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -451,6 +451,7 @@ 'browser/lazy_background_task_queue.h', 'browser/management_policy.cc', 'browser/management_policy.h', + 'browser/notification_types.h', 'browser/pref_names.cc', 'browser/pref_names.h', 'browser/process_manager.cc', diff --git a/extensions/shell/DEPS b/extensions/shell/DEPS index ffa7287..83649ba 100644 --- a/extensions/shell/DEPS +++ b/extensions/shell/DEPS @@ -1,6 +1,7 @@ include_rules = [ # The apps module has dependencies on chrome. "-apps", + # Individual subdirectories should have their own DEPS that include # their allowed directories. "-extensions/shell", @@ -17,7 +18,4 @@ include_rules = [ "+grit/extensions_resources.h", # Real DEPS go in subdirectories, for example extensions/shell/browser/DEPS. - # Temporary exceptions for app_shell bring-up go here. - # TODO(jamescook): Remove these. http://crbug.com/305404 - "!chrome/browser/chrome_notification_types.h", ] diff --git a/extensions/shell/browser/shell_browsertest.cc b/extensions/shell/browser/shell_browsertest.cc index 9520691..271ff08 100644 --- a/extensions/shell/browser/shell_browsertest.cc +++ b/extensions/shell/browser/shell_browsertest.cc @@ -5,9 +5,9 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/path_service.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/notification_types.h" #include "extensions/common/extension_paths.h" #include "extensions/shell/test/shell_test.h" @@ -18,7 +18,7 @@ IN_PROC_BROWSER_TEST_F(AppShellTest, Basic) { base::FilePath test_data_dir; content::WindowedNotificationObserver test_pass_observer( - chrome::NOTIFICATION_EXTENSION_TEST_PASSED, + extensions::NOTIFICATION_EXTENSION_TEST_PASSED, content::NotificationService::AllSources()); PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); diff --git a/extensions/shell/browser/shell_extension_system.cc b/extensions/shell/browser/shell_extension_system.cc index db14d32..8c20401 100644 --- a/extensions/shell/browser/shell_extension_system.cc +++ b/extensions/shell/browser/shell_extension_system.cc @@ -8,7 +8,6 @@ #include "base/file_util.h" #include "base/files/file_path.h" -#include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" @@ -20,6 +19,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/info_map.h" #include "extensions/browser/lazy_background_task_queue.h" +#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" @@ -66,14 +66,14 @@ bool ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) { RegisterExtensionWithRequestContexts(extension_); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, + extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source<BrowserContext>(browser_context_), content::Details<const Extension>(extension_)); // Inform the rest of the extensions system to start. ready_.Signal(); content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSIONS_READY, + extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, content::Source<BrowserContext>(browser_context_), content::NotificationService::NoDetails()); return true; |