diff options
Diffstat (limited to 'content')
56 files changed, 773 insertions, 1707 deletions
diff --git a/content/browser/accessibility/browser_accessibility_manager.h b/content/browser/accessibility/browser_accessibility_manager.h index bbb7d77..1b0e1315 100644 --- a/content/browser/accessibility/browser_accessibility_manager.h +++ b/content/browser/accessibility/browser_accessibility_manager.h @@ -55,7 +55,7 @@ class BrowserAccessibilityManager { virtual ~BrowserAccessibilityManager(); - // Type is a ViewHostMsg_AccessibilityNotification_Params::NotificationType. + // Type is a ViewHostMsg_AccessibilityNotification_Params::int. // We pass it as int so that we don't include the render message declaration // header here. virtual void NotifyAccessibilityEvent( diff --git a/content/browser/appcache/chrome_appcache_service.cc b/content/browser/appcache/chrome_appcache_service.cc index 169f59e..dd593ef 100644 --- a/content/browser/appcache/chrome_appcache_service.cc +++ b/content/browser/appcache/chrome_appcache_service.cc @@ -51,7 +51,8 @@ void ChromeAppCacheService::InitializeOnIOThread( cache_path_ = cache_path; resource_context_ = resource_context; registrar_.Add( - this, NotificationType::PURGE_MEMORY, NotificationService::AllSources()); + this, content::NOTIFICATION_PURGE_MEMORY, + NotificationService::AllSources()); SetClearLocalStateOnExit(clear_local_state_on_exit); // Init our base class. @@ -98,11 +99,11 @@ int ChromeAppCacheService::CanCreateAppCache( manifest_url, *resource_context_) ? net::OK : net::ERR_ACCESS_DENIED; } -void ChromeAppCacheService::Observe(NotificationType type, +void ChromeAppCacheService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(type == NotificationType::PURGE_MEMORY); + DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); PurgeMemory(); } diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h index 4ebff8d..d325b37 100644 --- a/content/browser/appcache/chrome_appcache_service.h +++ b/content/browser/appcache/chrome_appcache_service.h @@ -57,7 +57,7 @@ class ChromeAppCacheService net::CompletionCallback* callback); // NotificationObserver override - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index 4a65aa0..22a777d 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -35,7 +35,7 @@ static base::LazyInstance<ChildProcessList> g_child_process_list( class ChildNotificationTask : public Task { public: ChildNotificationTask( - NotificationType notification_type, ChildProcessInfo* info) + int notification_type, ChildProcessInfo* info) : notification_type_(notification_type), info_(*info) { } virtual void Run() { @@ -45,7 +45,7 @@ class ChildNotificationTask : public Task { } private: - NotificationType notification_type_; + int notification_type_; ChildProcessInfo info_; }; @@ -113,7 +113,7 @@ void BrowserChildProcessHost::SetTerminateChildOnShutdown( child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); } -void BrowserChildProcessHost::Notify(NotificationType type) { +void BrowserChildProcessHost::Notify(int type) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, new ChildNotificationTask(type, this)); } @@ -133,7 +133,7 @@ void BrowserChildProcessHost::OnChildDied() { OnProcessCrashed(exit_code); // Report that this child process crashed. - Notify(NotificationType::CHILD_PROCESS_CRASHED); + Notify(content::NOTIFICATION_CHILD_PROCESS_CRASHED); UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); break; } @@ -141,7 +141,7 @@ void BrowserChildProcessHost::OnChildDied() { OnProcessWasKilled(exit_code); // Report that this child process was killed. - Notify(NotificationType::CHILD_PROCESS_WAS_KILLED); + Notify(content::NOTIFICATION_CHILD_PROCESS_WAS_KILLED); UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type()); break; } @@ -149,7 +149,7 @@ void BrowserChildProcessHost::OnChildDied() { break; } // Notify in the main loop of the disconnection. - Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); + Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED); } ChildProcessHost::OnChildDied(); } diff --git a/content/browser/browser_child_process_host.h b/content/browser/browser_child_process_host.h index 61e7981..cc04b2a 100644 --- a/content/browser/browser_child_process_host.h +++ b/content/browser/browser_child_process_host.h @@ -87,7 +87,7 @@ class BrowserChildProcessHost : public ChildProcessHost, // Overrides from ChildProcessHost virtual void OnChildDied(); virtual void ShutdownStarted(); - virtual void Notify(NotificationType type); + virtual void Notify(int type); // Extends the base class implementation and removes this host from // the host list. Calls ChildProcessHost::ForceShutdown virtual void ForceShutdown(); diff --git a/content/browser/cert_store.cc b/content/browser/cert_store.cc index be75b38..a5ecee8 100644 --- a/content/browser/cert_store.cc +++ b/content/browser/cert_store.cc @@ -35,9 +35,9 @@ CertStore::CertStore() : next_cert_id_(1) { // removed from cache, and remove the cert when we know it // is not used anymore. - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); } @@ -135,11 +135,11 @@ void CertStore::RemoveCertsForRenderProcesHost(int process_id) { } } -void CertStore::Observe(NotificationType type, +void CertStore::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED || - type == NotificationType::RENDERER_PROCESS_CLOSED); + DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED || + type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED); RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); DCHECK(rph); RemoveCertsForRenderProcesHost(rph->id()); diff --git a/content/browser/cert_store.h b/content/browser/cert_store.h index af5e46c..294e932 100644 --- a/content/browser/cert_store.h +++ b/content/browser/cert_store.h @@ -42,7 +42,7 @@ class CertStore : public NotificationObserver { bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/debugger/devtools_manager.cc b/content/browser/debugger/devtools_manager.cc index 1db381f..e2509e3 100644 --- a/content/browser/debugger/devtools_manager.cc +++ b/content/browser/debugger/devtools_manager.cc @@ -41,7 +41,7 @@ void DevToolsManager::RegisterUserPrefs(PrefService* prefs) { DevToolsManager::DevToolsManager() : last_orphan_cookie_(0) { - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_DELETED, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); } @@ -135,17 +135,17 @@ void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) { } NotificationService::current()->Notify( - NotificationType::DEVTOOLS_WINDOW_CLOSING, + content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, Source<Profile>(inspected_rvh->site_instance()->GetProcess()->profile()), Details<RenderViewHost>(inspected_rvh)); UnbindClientHost(inspected_rvh, host); } -void DevToolsManager::Observe(NotificationType type, +void DevToolsManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDER_VIEW_HOST_DELETED); + DCHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED); UnregisterDevToolsClientHostFor(Source<RenderViewHost>(source).ptr()); } diff --git a/content/browser/debugger/devtools_manager.h b/content/browser/debugger/devtools_manager.h index 71161b6..66a8008 100644 --- a/content/browser/debugger/devtools_manager.h +++ b/content/browser/debugger/devtools_manager.h @@ -98,7 +98,7 @@ class DevToolsManager : public DevToolsClientHost::CloseListener, virtual void ClientHostClosing(DevToolsClientHost* host); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/debugger/devtools_sanity_unittest.cc b/content/browser/debugger/devtools_sanity_unittest.cc index fb7f691..c9d49a2 100644 --- a/content/browser/debugger/devtools_sanity_unittest.cc +++ b/content/browser/debugger/devtools_sanity_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" @@ -28,12 +29,12 @@ namespace { class BrowserClosedObserver : public NotificationObserver { public: explicit BrowserClosedObserver(Browser* browser) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(browser)); ui_test_utils::RunMessageLoop(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { MessageLoopForUI::current()->Quit(); @@ -182,7 +183,7 @@ class DevToolsExtensionDebugTest : public DevToolsSanityTest, size_t num_before = service->extensions()->size(); { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_LOADED, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); CancelableQuitTask* delayed_quit = new CancelableQuitTask("Extension load timed out."); @@ -205,7 +206,7 @@ class DevToolsExtensionDebugTest : public DevToolsSanityTest, // this method is running. NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); CancelableQuitTask* delayed_quit = new CancelableQuitTask("Extension host load timed out."); @@ -226,12 +227,12 @@ class DevToolsExtensionDebugTest : public DevToolsSanityTest, return true; } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: MessageLoopForUI::current()->Quit(); break; default: diff --git a/content/browser/debugger/devtools_window.cc b/content/browser/debugger/devtools_window.cc index ba633243..1c4e7e6 100644 --- a/content/browser/debugger/devtools_window.cc +++ b/content/browser/debugger/devtools_window.cc @@ -23,6 +23,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -121,14 +122,14 @@ DevToolsWindow::DevToolsWindow(Profile* profile, // Register on-load actions. registrar_.Add(this, - NotificationType::LOAD_STOP, + content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(&tab_contents_->controller())); registrar_.Add(this, - NotificationType::TAB_CLOSING, + content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(&tab_contents_->controller())); registrar_.Add( this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); if (tab) @@ -394,15 +395,15 @@ void DevToolsWindow::CallClientFunction(const string16& function_name, ExecuteJavascriptInWebFrame(string16(), javascript); } -void DevToolsWindow::Observe(NotificationType type, +void DevToolsWindow::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOAD_STOP && !is_loaded_) { + if (type == content::NOTIFICATION_LOAD_STOP && !is_loaded_) { is_loaded_ = true; UpdateTheme(); DoAction(); AddDevToolsExtensionsToClient(); - } else if (type == NotificationType::TAB_CLOSING) { + } else if (type == content::NOTIFICATION_TAB_CLOSING) { if (Source<NavigationController>(source).ptr() == &tab_contents_->controller()) { // This happens when browser closes all of its tabs as a result @@ -412,7 +413,7 @@ void DevToolsWindow::Observe(NotificationType type, NotifyCloseListener(); delete this; } - } else if (type == NotificationType::BROWSER_THEME_CHANGED) { + } else if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { UpdateTheme(); } } diff --git a/content/browser/debugger/devtools_window.h b/content/browser/debugger/devtools_window.h index fbe6409..e8af7eb 100644 --- a/content/browser/debugger/devtools_window.h +++ b/content/browser/debugger/devtools_window.h @@ -67,7 +67,7 @@ class DevToolsWindow void UpdateFrontendAttachedState(); // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc index b392ea0..64e96f4 100644 --- a/content/browser/host_zoom_map.cc +++ b/content/browser/host_zoom_map.cc @@ -20,7 +20,7 @@ using WebKit::WebView; HostZoomMap::HostZoomMap() : default_zoom_level_(0.0) { registrar_.Add( - this, NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, + this, content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, NotificationService::AllSources()); } @@ -41,9 +41,10 @@ void HostZoomMap::SetZoomLevel(std::string host, double level) { host_zoom_levels_[host] = level; } - NotificationService::current()->Notify(NotificationType::ZOOM_LEVEL_CHANGED, - Source<HostZoomMap>(this), - Details<const std::string>(&host)); + NotificationService::current()->Notify( + content::NOTIFICATION_ZOOM_LEVEL_CHANGED, + Source<HostZoomMap>(this), + Details<const std::string>(&host)); } double HostZoomMap::GetTemporaryZoomLevel(int render_process_id, @@ -88,20 +89,21 @@ void HostZoomMap::SetTemporaryZoomLevel(int render_process_id, } std::string host; - NotificationService::current()->Notify(NotificationType::ZOOM_LEVEL_CHANGED, - Source<HostZoomMap>(this), - Details<const std::string>(&host)); + NotificationService::current()->Notify( + content::NOTIFICATION_ZOOM_LEVEL_CHANGED, + Source<HostZoomMap>(this), + Details<const std::string>(&host)); } void HostZoomMap::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - switch (type.value) { - case NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: { + switch (type) { + case content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: { base::AutoLock auto_lock(lock_); int render_view_id = Source<RenderViewHost>(source)->routing_id(); int render_process_id = Source<RenderViewHost>(source)->process()->id(); diff --git a/content/browser/host_zoom_map.h b/content/browser/host_zoom_map.h index 1e1c2c89..6f6b06d 100644 --- a/content/browser/host_zoom_map.h +++ b/content/browser/host_zoom_map.h @@ -65,7 +65,7 @@ class HostZoomMap : double level); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/mach_broker_mac.cc b/content/browser/mach_broker_mac.cc index dca1b11..40a0db9 100644 --- a/content/browser/mach_broker_mac.cc +++ b/content/browser/mach_broker_mac.cc @@ -33,16 +33,16 @@ class RegisterNotificationTask : public Task { virtual void Run() { broker_->registrar_.Add(broker_, - NotificationType::RENDERER_PROCESS_CLOSED, + content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); broker_->registrar_.Add(broker_, - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); broker_->registrar_.Add(broker_, - NotificationType::CHILD_PROCESS_CRASHED, + content::NOTIFICATION_CHILD_PROCESS_CRASHED, NotificationService::AllSources()); broker_->registrar_.Add(broker_, - NotificationType::CHILD_PROCESS_HOST_DISCONNECTED, + content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, NotificationService::AllSources()); } @@ -195,7 +195,7 @@ mach_port_t MachBroker::TaskForPid(base::ProcessHandle pid) const { return it->second.mach_task_; } -void MachBroker::Observe(NotificationType type, +void MachBroker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // TODO(rohitrao): These notifications do not always carry the proper PIDs, @@ -203,12 +203,12 @@ void MachBroker::Observe(NotificationType type, // way to listen for child process deaths. http://crbug.com/55734 base::ProcessHandle handle = 0; switch (type.value) { - case NotificationType::RENDERER_PROCESS_CLOSED: - case NotificationType::RENDERER_PROCESS_TERMINATED: + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: handle = Source<RenderProcessHost>(source)->GetHandle(); break; - case NotificationType::CHILD_PROCESS_CRASHED: - case NotificationType::CHILD_PROCESS_HOST_DISCONNECTED: + case content::NOTIFICATION_CHILD_PROCESS_CRASHED: + case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: handle = Details<ChildProcessInfo>(details)->handle(); break; default: diff --git a/content/browser/mach_broker_mac.h b/content/browser/mach_broker_mac.h index da38162..6efeab4 100644 --- a/content/browser/mach_broker_mac.h +++ b/content/browser/mach_broker_mac.h @@ -80,7 +80,7 @@ class MachBroker : public base::ProcessMetrics::PortProvider, virtual mach_port_t TaskForPid(base::ProcessHandle process) const; // Implement |NotificationObserver|. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc index 52bb519..d090917 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service.cc @@ -20,9 +20,9 @@ #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/resource_context.h" +#include "content/common/content_notification_types.h" #include "content/common/content_switches.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/pepper_plugin_registry.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" @@ -102,7 +102,7 @@ PluginService::PluginService() #elif defined(OS_MACOSX) // We need to know when the browser comes forward so we can bring modal plugin // windows forward too. - registrar_.Add(this, NotificationType::APP_ACTIVATED, + registrar_.Add(this, content::NOTIFICATION_APP_ACTIVATED, NotificationService::AllSources()); #elif defined(OS_POSIX) // The FilePathWatcher produces too many false positives on MacOS (access time @@ -134,10 +134,10 @@ PluginService::PluginService() file_watchers_.push_back(watcher); } #endif - registrar_.Add(this, NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, + registrar_.Add(this, content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::RENDERER_PROCESS_CLOSED, + content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); } @@ -390,24 +390,24 @@ void PluginService::OnWaitableEventSignaled( #endif // defined(OS_WIN) } -void PluginService::Observe(NotificationType type, +void PluginService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { + switch (type) { #if defined(OS_MACOSX) - case NotificationType::APP_ACTIVATED: { + case content::NOTIFICATION_APP_ACTIVATED: { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableFunction(&NotifyPluginsOfActivation)); break; } #endif - case NotificationType::PLUGIN_ENABLE_STATUS_CHANGED: { + case content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED: { webkit::npapi::PluginList::Singleton()->RefreshPlugins(); PurgePluginListCache(false); break; } - case NotificationType::RENDERER_PROCESS_CLOSED: { + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { int render_process_id = Source<RenderProcessHost>(source).ptr()->id(); base::AutoLock auto_lock(overridden_plugins_lock_); diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h index 399055e..975d815 100644 --- a/content/browser/plugin_service.h +++ b/content/browser/plugin_service.h @@ -130,7 +130,7 @@ class PluginService virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); // NotificationObserver implementation - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); void RegisterPepperPlugins(); diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index b291d53..a50c607 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -812,7 +812,7 @@ void BrowserRenderProcessHost::OnChannelError() { RendererClosedDetails details(status, exit_code, is_extension_process_); NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_CLOSED, + content::NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), Details<RendererClosedDetails>(&details)); @@ -842,7 +842,7 @@ void BrowserRenderProcessHost::OnShutdownRequest() { // Notify any tabs that might have swapped out renderers from this process. // They should not attempt to swap them back in. NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_CLOSING, + content::NOTIFICATION_RENDERER_PROCESS_CLOSING, Source<RenderProcessHost>(this), NotificationService::NoDetails()); Send(new ChildProcessMsg_Shutdown()); @@ -896,7 +896,7 @@ void BrowserRenderProcessHost::OnProcessLaunched() { // was after, we can end up executing JavaScript before the initialization // happens. NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_CREATED, + content::NOTIFICATION_RENDERER_PROCESS_CREATED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); while (!queued_messages_.empty()) { diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc index f58444f..f942e04 100644 --- a/content/browser/renderer_host/render_process_host.cc +++ b/content/browser/renderer_host/render_process_host.cc @@ -130,7 +130,7 @@ void RenderProcessHost::Release(int listener_id) { // When no other owners of this object, we can delete ourselves if (listeners_.IsEmpty()) { NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); MessageLoop::current()->DeleteSoon(FROM_HERE, this); deleting_soon_ = true; diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 0e5f66b..37bf2bd 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -31,12 +31,12 @@ #include "content/browser/user_metrics.h" #include "content/common/bindings_policy.h" #include "content/common/content_constants.h" +#include "content/common/content_notification_types.h" #include "content/common/desktop_notification_messages.h" #include "content/common/drag_messages.h" #include "content/common/native_web_keyboard_event.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/result_codes.h" #include "content/common/swapped_out_messages.h" #include "content/common/url_constants.h" @@ -116,7 +116,7 @@ RenderViewHost::RenderViewHost(SiteInstance* instance, content::GetContentClient()->browser()->RenderViewHostCreated(this); NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CREATED, + content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, Source<RenderViewHost>(this), NotificationService::NoDetails()); } @@ -126,7 +126,7 @@ RenderViewHost::~RenderViewHost() { RenderViewHostObserver, observers_, RenderViewHostDestruction()); NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_DELETED, + content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, Source<RenderViewHost>(this), NotificationService::NoDetails()); @@ -354,7 +354,7 @@ void RenderViewHost::ClosePage() { // TODO(creis): Should this be moved to Shutdown? It may not be called for // RenderViewHosts that have been swapped out. NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, + content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, Source<RenderViewHost>(this), NotificationService::NoDetails()); @@ -1051,7 +1051,7 @@ void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { void RenderViewHost::OnTargetDropACK() { NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, + content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, Source<RenderViewHost>(this), NotificationService::NoDetails()); } @@ -1248,7 +1248,7 @@ void RenderViewHost::OnAccessibilityNotifications( } NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, Source<RenderViewHost>(this), NotificationService::NoDetails()); } @@ -1265,7 +1265,7 @@ void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { } std::pair<int, Value*> details(id, result_value); NotificationService::current()->Notify( - NotificationType::EXECUTE_JAVASCRIPT_RESULT, + content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, Source<RenderViewHost>(this), Details<std::pair<int, Value*> >(&details)); } diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc index 116dbec..4d22de0 100644 --- a/content/browser/renderer_host/render_view_host_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_browsertest.cc @@ -26,7 +26,7 @@ class ExecuteNotificationObserver : public NotificationObserver { public: ExecuteNotificationObserver() : id_(0) {} - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { id_ = (static_cast<Details<ExecuteDetailType > >(details))->first; @@ -65,7 +65,7 @@ class RenderViewHostTest : public InProcessBrowserTest { ExecuteNotificationObserver observer; ui_test_utils::RegisterAndWait( out_result, - NotificationType::EXECUTE_JAVASCRIPT_RESULT, + content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, Source<RenderViewHost>(rvh)); EXPECT_EQ(execute_id, out_result->id()); ASSERT_TRUE(out_result->value()); diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index 8a9ebce..7f36823 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -11,10 +11,10 @@ #include "chrome/test/ui_test_utils.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" #include "net/base/net_util.h" #include "net/test/test_server.h" diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 4e01606..00df753 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -249,7 +249,7 @@ void RenderWidgetHost::WasHidden() { bool is_visible = false; NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); } @@ -284,7 +284,7 @@ void RenderWidgetHost::WasRestored() { bool is_visible = true; NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); @@ -757,7 +757,7 @@ void RenderWidgetHost::ImeCancelComposition() { void RenderWidgetHost::Destroy() { NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_HOST_DESTROYED, + content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, Source<RenderWidgetHost>(this), NotificationService::NoDetails()); @@ -785,7 +785,7 @@ void RenderWidgetHost::CheckRendererIsUnresponsive() { // OK, looks like we have a hung renderer! NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_HANG, + content::NOTIFICATION_RENDERER_PROCESS_HANG, Source<RenderWidgetHost>(this), NotificationService::NoDetails()); is_unresponsive_ = true; @@ -858,7 +858,7 @@ void RenderWidgetHost::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { PaintAtSizeAckDetails details = {tag, size}; gfx::Size size_details = size; NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, Source<RenderWidgetHost>(this), Details<PaintAtSizeAckDetails>(&details)); } @@ -869,7 +869,7 @@ void RenderWidgetHost::OnMsgUpdateRect( TimeTicks paint_start = TimeTicks::Now(); NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_HOST_WILL_PAINT, + content::NOTIFICATION_RENDER_WIDGET_HOST_WILL_PAINT, Source<RenderWidgetHost>(this), NotificationService::NoDetails()); @@ -966,7 +966,7 @@ void RenderWidgetHost::OnMsgUpdateRect( } NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, Source<RenderWidgetHost>(this), NotificationService::NoDetails()); @@ -1024,7 +1024,7 @@ void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) { } // This is used only for testing. NotificationService::current()->Notify( - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, Source<RenderWidgetHost>(this), Details<int>(&type)); } diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 17c8108..42a3cf0 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -219,11 +219,11 @@ class MockPaintingObserver : public NotificationObserver { size_ = size; } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (type == - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK) { + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK) { RenderWidgetHost::PaintAtSizeAckDetails* size_ack_details = Details<RenderWidgetHost::PaintAtSizeAckDetails>(details).ptr(); WidgetDidReceivePaintAtSizeAck( @@ -574,7 +574,7 @@ TEST_F(RenderWidgetHostTest, PaintAtSize) { MockPaintingObserver observer; registrar.Add( &observer, - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, Source<RenderWidgetHost>(host_.get())); host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index 2fcdca3..cefab8b 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -1655,7 +1655,7 @@ void ResourceDispatcherHost::NotifyResponseStarted(net::URLRequest* request, BrowserThread::UI, FROM_HERE, NewRunnableFunction( &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>, - NotificationType::RESOURCE_RESPONSE_STARTED, + content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, render_process_id, render_view_id, detail)); } @@ -1673,12 +1673,12 @@ void ResourceDispatcherHost::NotifyReceivedRedirect(net::URLRequest* request, BrowserThread::UI, FROM_HERE, NewRunnableFunction( &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>, - NotificationType::RESOURCE_RECEIVED_REDIRECT, + content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, render_process_id, render_view_id, detail)); } template <class T> -void ResourceDispatcherHost::NotifyOnUI(NotificationType type, +void ResourceDispatcherHost::NotifyOnUI(int type, int render_process_id, int render_view_id, T* detail) { diff --git a/content/browser/renderer_host/resource_dispatcher_host.h b/content/browser/renderer_host/resource_dispatcher_host.h index ee476d0..35f5106 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.h +++ b/content/browser/renderer_host/resource_dispatcher_host.h @@ -23,7 +23,7 @@ #include "base/timer.h" #include "content/browser/renderer_host/resource_queue.h" #include "content/common/child_process_info.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "ipc/ipc_message.h" #include "net/url_request/url_request.h" #include "webkit/glue/resource_type.h" @@ -407,7 +407,7 @@ class ResourceDispatcherHost : public net::URLRequest::Delegate { // Sends the given notification on the UI thread. The RenderViewHost's // controller is used as the source. template <class T> - static void NotifyOnUI(NotificationType type, + static void NotifyOnUI(int type, int render_process_id, int render_view_id, T* detail); diff --git a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc index 846ca3b..14be3f5 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc @@ -5,10 +5,10 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" #include "net/test/test_server.h" class ResourceDispatcherHostBrowserTest : public InProcessBrowserTest { @@ -30,7 +30,7 @@ bool ResourceDispatcherHostBrowserTest::GetPopupTitle(const GURL& url, ui_test_utils::NavigateToURL(browser(), url); ui_test_utils::WindowedNotificationObserver observer( - NotificationType::BROWSER_WINDOW_READY, + chrome::NOTIFICATION_BROWSER_WINDOW_READY, NotificationService::AllSources()); // Create dynamic popup. diff --git a/content/browser/site_instance.cc b/content/browser/site_instance.cc index 53caf57..d69690e 100644 --- a/content/browser/site_instance.cc +++ b/content/browser/site_instance.cc @@ -37,7 +37,7 @@ SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) has_site_(false) { DCHECK(browsing_instance); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); } @@ -232,10 +232,10 @@ RenderProcessHost::Type SiteInstance::GetRendererType() { return RendererTypeForURL(site_); } -void SiteInstance::Observe(NotificationType type, +void SiteInstance::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); + DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); if (rph == process_) process_ = NULL; diff --git a/content/browser/site_instance.h b/content/browser/site_instance.h index ebe1b3e..4d3692c 100644 --- a/content/browser/site_instance.h +++ b/content/browser/site_instance.h @@ -166,7 +166,7 @@ class SiteInstance : public base::RefCounted<SiteInstance>, private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc index 49e852f..e179f9a 100644 --- a/content/browser/ssl/ssl_client_auth_handler.cc +++ b/content/browser/ssl/ssl_client_auth_handler.cc @@ -58,7 +58,7 @@ void SSLClientAuthHandler::CertificateSelected(net::X509Certificate* cert) { SSLClientAuthNotificationDetails details(cert_request_info_, cert); NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::SSL_CLIENT_AUTH_CERT_SELECTED, + service->Notify(content::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, Source<SSLClientAuthHandler>(this), Details<SSLClientAuthNotificationDetails>(&details)); @@ -111,12 +111,12 @@ SSLClientAuthObserver::~SSLClientAuthObserver() { } void SSLClientAuthObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { VLOG(1) << "SSLClientAuthObserver::Observe " << this << " " << handler_.get(); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(type == NotificationType::SSL_CLIENT_AUTH_CERT_SELECTED); + DCHECK(type == content::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED); if (Source<SSLClientAuthHandler>(source).ptr() == handler_.get()) { VLOG(1) << "got notification from ourself " << handler_.get(); @@ -138,9 +138,9 @@ void SSLClientAuthObserver::Observe( void SSLClientAuthObserver::StartObserving() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - notification_registrar_.Add(this, - NotificationType::SSL_CLIENT_AUTH_CERT_SELECTED, - NotificationService::AllSources()); + notification_registrar_.Add( + this, content::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, + NotificationService::AllSources()); } void SSLClientAuthObserver::StopObserving() { diff --git a/content/browser/ssl/ssl_client_auth_handler.h b/content/browser/ssl/ssl_client_auth_handler.h index 0b2e9cb..404b8d2 100644 --- a/content/browser/ssl/ssl_client_auth_handler.h +++ b/content/browser/ssl/ssl_client_auth_handler.h @@ -84,7 +84,7 @@ class SSLClientAuthObserver : public NotificationObserver { virtual void OnCertSelectedByNotification() = 0; // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 0fd022c..96578a0 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -47,7 +47,7 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, // static void SSLManager::NotifySSLInternalStateChanged() { NotificationService::current()->Notify( - NotificationType::SSL_INTERNAL_STATE_CHANGED, + content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, NotificationService::AllSources(), NotificationService::NoDetails()); } @@ -97,15 +97,15 @@ SSLManager::SSLManager(NavigationController* controller) DCHECK(controller_); // Subscribe to various notifications. - registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, + registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, Source<NavigationController>(controller_)); - registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED, + registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, Source<RenderViewHostDelegate>(controller_->tab_contents())); - registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT, + registrar_.Add(this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, Source<RenderViewHostDelegate>(controller_->tab_contents())); - registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE, + registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, Source<NavigationController>(controller_)); - registrar_.Add(this, NotificationType::SSL_INTERNAL_STATE_CHANGED, + registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, NotificationService::AllSources()); } @@ -158,26 +158,26 @@ bool SSLManager::ProcessedSSLErrorFromRequest() const { return net::IsCertStatusError(entry->ssl().cert_status()); } -void SSLManager::Observe(NotificationType type, +void SSLManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Dispatch by type. - switch (type.value) { - case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: + switch (type) { + case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: // Do nothing. break; - case NotificationType::RESOURCE_RESPONSE_STARTED: + case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED: DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr()); break; - case NotificationType::RESOURCE_RECEIVED_REDIRECT: + case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: DidReceiveResourceRedirect( Details<ResourceRedirectDetails>(details).ptr()); break; - case NotificationType::LOAD_FROM_MEMORY_CACHE: + case content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE: DidLoadFromMemoryCache( Details<LoadFromMemoryCacheDetails>(details).ptr()); break; - case NotificationType::SSL_INTERNAL_STATE_CHANGED: + case content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED: DidChangeSSLInternalState(); break; default: @@ -240,7 +240,7 @@ void SSLManager::UpdateEntry(NavigationEntry* entry) { if (!entry->ssl().Equals(original_ssl_status)) { NotificationService::current()->Notify( - NotificationType::SSL_VISIBLE_STATE_CHANGED, + content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, Source<NavigationController>(controller_), NotificationService::NoDetails()); } diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h index 8ceeddf..6961c20 100644 --- a/content/browser/ssl/ssl_manager.h +++ b/content/browser/ssl/ssl_manager.h @@ -92,7 +92,7 @@ class SSLManager : public NotificationObserver { // the security UI when the main frame navigates to a new URL. // // Called on the UI thread. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 07c661b..307074a 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -204,7 +204,7 @@ void InterstitialPage::Show() { // NOTIFY_TAB_CONTENTS_DESTROYED as at that point the RenderViewHost has // already been destroyed. notification_registrar_.Add( - this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, + this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, Source<RenderWidgetHost>(tab_->render_view_host())); // Update the tab_to_interstitial_page_ map. @@ -232,11 +232,12 @@ void InterstitialPage::Show() { EscapePath(GetHTMLContents()); render_view_host_->NavigateToURL(GURL(data_url)); - notification_registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + notification_registrar_.Add(this, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_)); - notification_registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab_->controller())); - notification_registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, Source<NavigationController>(&tab_->controller())); } @@ -271,11 +272,11 @@ void InterstitialPage::Hide() { delete this; } -void InterstitialPage::Observe(NotificationType type, +void InterstitialPage::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NAV_ENTRY_PENDING: + switch (type) { + case content::NOTIFICATION_NAV_ENTRY_PENDING: // We are navigating away from the interstitial (the user has typed a URL // in the location bar or clicked a bookmark). Make sure clicking on the // interstitial will have no effect. Also cancel any blocked requests @@ -288,7 +289,7 @@ void InterstitialPage::Observe(NotificationType type, Disable(); TakeActionOnResourceDispatcher(CANCEL); break; - case NotificationType::RENDER_WIDGET_HOST_DESTROYED: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: if (action_taken_ == NO_ACTION) { // The RenderViewHost is being destroyed (as part of the tab being // closed), make sure we clear the blocked requests. @@ -298,8 +299,8 @@ void InterstitialPage::Observe(NotificationType type, TakeActionOnResourceDispatcher(CANCEL); } break; - case NotificationType::TAB_CONTENTS_DESTROYED: - case NotificationType::NAV_ENTRY_COMMITTED: + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: if (action_taken_ == NO_ACTION) { // We are navigating away from the interstitial or closing a tab with an // interstitial. Default to DontProceed(). We don't just call Hide as @@ -358,7 +359,7 @@ void InterstitialPage::DidNavigate( // a callback to |tab_| testing if an interstitial page is showing before // hiding the bookmark bar. NotificationService::current()->Notify( - NotificationType::INTERSTITIAL_ATTACHED, + content::NOTIFICATION_INTERSTITIAL_ATTACHED, Source<TabContents>(tab_), NotificationService::NoDetails()); diff --git a/content/browser/tab_contents/interstitial_page.h b/content/browser/tab_contents/interstitial_page.h index 78139f6..2719274 100644 --- a/content/browser/tab_contents/interstitial_page.h +++ b/content/browser/tab_contents/interstitial_page.h @@ -115,7 +115,7 @@ class InterstitialPage : public NotificationObserver, protected: // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 0d1a9ac..1e28654 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -42,7 +42,7 @@ void NotifyPrunedEntries(NavigationController* nav_controller, details.from_front = from_front; details.count = count; NotificationService::current()->Notify( - NotificationType::NAV_LIST_PRUNED, + content::NOTIFICATION_NAV_LIST_PRUNED, Source<NavigationController>(nav_controller), Details<content::PrunedDetails>(&details)); } @@ -133,7 +133,7 @@ NavigationController::~NavigationController() { DiscardNonCommittedEntriesInternal(); NotificationService::current()->Notify( - NotificationType::TAB_CLOSED, + content::NOTIFICATION_TAB_CLOSED, Source<NavigationController>(this), NotificationService::NoDetails()); } @@ -183,7 +183,7 @@ void NavigationController::ReloadInternal(bool check_for_repost, // they really want to do this. If they do, the dialog will call us back // with check_for_repost = false. NotificationService::current()->Notify( - NotificationType::REPOST_WARNING_SHOWN, + content::NOTIFICATION_REPOST_WARNING_SHOWN, Source<NavigationController>(this), NotificationService::NoDetails()); @@ -270,7 +270,7 @@ void NavigationController::LoadEntry(NavigationEntry* entry) { DiscardNonCommittedEntriesInternal(); pending_entry_ = entry; NotificationService::current()->Notify( - NotificationType::NAV_ENTRY_PENDING, + content::NOTIFICATION_NAV_ENTRY_PENDING, Source<NavigationController>(this), NotificationService::NoDetails()); NavigateToPendingEntry(NO_RELOAD); @@ -1061,7 +1061,7 @@ void NavigationController::NotifyNavigationEntryCommitted( tab_contents_->NotifyNavigationStateChanged(kInvalidateAll); NotificationService::current()->Notify( - NotificationType::NAV_ENTRY_COMMITTED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(this), notification_details); } @@ -1092,7 +1092,8 @@ void NavigationController::NotifyEntryChanged(const NavigationEntry* entry, content::EntryChangedDetails det; det.changed_entry = entry; det.index = index; - NotificationService::current()->Notify(NotificationType::NAV_ENTRY_CHANGED, + NotificationService::current()->Notify( + content::NOTIFICATION_NAV_ENTRY_CHANGED, Source<NavigationController>(this), Details<content::EntryChangedDetails>(&det)); } diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index 08799b4..96335bc 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -43,11 +43,11 @@ class NavigationControllerTest : public RenderViewHostTestHarness { void RegisterForAllNavNotifications(TestNotificationTracker* tracker, NavigationController* controller) { - tracker->ListenFor(NotificationType::NAV_ENTRY_COMMITTED, + tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); - tracker->ListenFor(NotificationType::NAV_LIST_PRUNED, + tracker->ListenFor(content::NOTIFICATION_NAV_LIST_PRUNED, Source<NavigationController>(controller)); - tracker->ListenFor(NotificationType::NAV_ENTRY_CHANGED, + tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_CHANGED, Source<NavigationController>(controller)); } @@ -110,7 +110,7 @@ TEST_F(NavigationControllerTest, LoadURL) { rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. EXPECT_EQ(controller().entry_count(), 1); @@ -141,7 +141,7 @@ TEST_F(NavigationControllerTest, LoadURL) { rvh()->SendShouldCloseACK(true); contents()->pending_rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. EXPECT_EQ(controller().entry_count(), 2); @@ -168,13 +168,13 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().LoadURL(url1, GURL(), PageTransition::TYPED); EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // We should not have produced a new session history entry. EXPECT_EQ(controller().entry_count(), 1); @@ -198,7 +198,7 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) { EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().LoadURL(url2, GURL(), PageTransition::TYPED); controller().DiscardNonCommittedEntries(); @@ -226,7 +226,7 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { PageTransition::TYPED); rvh()->SendNavigate(0, kExistingURL1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Do a new navigation without making a pending one. const GURL kNewURL("http://see"); @@ -235,7 +235,7 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller().pending_entry_index()); EXPECT_EQ(1, controller().last_committed_entry_index()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->url()); @@ -255,7 +255,7 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { PageTransition::TYPED); rvh()->SendNavigate(0, kExistingURL1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Make a pending entry to somewhere new. const GURL kExistingURL2("http://bee"); @@ -271,7 +271,7 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller().pending_entry_index()); EXPECT_EQ(1, controller().last_committed_entry_index()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->url()); @@ -290,14 +290,14 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { PageTransition::TYPED); rvh()->SendNavigate(0, kExistingURL1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL kExistingURL2("http://foo/bee"); controller().LoadURL(kExistingURL2, GURL(), PageTransition::TYPED); rvh()->SendNavigate(1, kExistingURL2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now make a pending back/forward navigation. The zeroth entry should be // pending. @@ -314,7 +314,7 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller().pending_entry_index()); EXPECT_EQ(2, controller().last_committed_entry_index()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->url()); @@ -332,13 +332,13 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { controller().LoadURL(kExistingURL1, GURL(), PageTransition::TYPED); rvh()->SendNavigate(0, kExistingURL1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL kExistingURL2("http://foo/bee"); controller().LoadURL(kExistingURL2, GURL(), PageTransition::TYPED); rvh()->SendNavigate(1, kExistingURL2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now make a pending new navigation. const GURL kNewURL("http://foo/see"); @@ -353,7 +353,7 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { // There should no longer be any pending entry, and the back navigation we // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller().pending_entry_index()); EXPECT_EQ(0, controller().last_committed_entry_index()); EXPECT_EQ(kExistingURL1, controller().GetActiveEntry()->url()); @@ -505,7 +505,7 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().Reload(true); EXPECT_EQ(0U, notifications.size()); @@ -521,7 +521,7 @@ TEST_F(NavigationControllerTest, Reload) { rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. EXPECT_EQ(controller().entry_count(), 1); @@ -544,14 +544,14 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { controller().LoadURL(url1, GURL(), PageTransition::TYPED); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().Reload(true); EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. EXPECT_EQ(controller().entry_count(), 2); @@ -571,12 +571,12 @@ TEST_F(NavigationControllerTest, Back) { const GURL url1("http://foo1"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoBack(); EXPECT_EQ(0U, notifications.size()); @@ -592,7 +592,7 @@ TEST_F(NavigationControllerTest, Back) { rvh()->SendNavigate(0, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The back navigation completed successfully. EXPECT_EQ(controller().entry_count(), 2); @@ -616,12 +616,12 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { controller().LoadURL(url1, GURL(), PageTransition::TYPED); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().LoadURL(url2, GURL(), PageTransition::TYPED); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoBack(); EXPECT_EQ(0U, notifications.size()); @@ -637,7 +637,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { rvh()->SendNavigate(2, url3); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The back navigation resulted in a completely new navigation. // TODO(darin): perhaps this behavior will be confusing to users? @@ -662,12 +662,12 @@ TEST_F(NavigationControllerTest, Back_NewPending) { // First navigate two places so we have some back history. rvh()->SendNavigate(0, kUrl1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // controller().LoadURL(kUrl2, PageTransition::TYPED); rvh()->SendNavigate(1, kUrl2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now start a new pending navigation and go back before it commits. controller().LoadURL(kUrl3, GURL(), PageTransition::TYPED); @@ -738,16 +738,16 @@ TEST_F(NavigationControllerTest, Forward) { rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoBack(); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoForward(); @@ -762,7 +762,7 @@ TEST_F(NavigationControllerTest, Forward) { rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The forward navigation completed successfully. EXPECT_EQ(controller().entry_count(), 2); @@ -785,15 +785,15 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoBack(); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); controller().GoForward(); EXPECT_EQ(0U, notifications.size()); @@ -809,8 +809,8 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { rvh()->SendNavigate(2, url3); EXPECT_TRUE(notifications.Check2AndReset( - NotificationType::NAV_LIST_PRUNED, - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_LIST_PRUNED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(controller().entry_count(), 2); EXPECT_EQ(controller().last_committed_entry_index(), 1); @@ -836,7 +836,7 @@ TEST_F(NavigationControllerTest, Redirect) { EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Second request controller().LoadURL(url1, GURL(), PageTransition::TYPED); @@ -861,7 +861,7 @@ TEST_F(NavigationControllerTest, Redirect) { EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == NavigationType::SAME_PAGE); EXPECT_EQ(controller().entry_count(), 1); @@ -892,7 +892,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { EXPECT_EQ(0U, notifications.size()); rvh()->SendNavigate(0, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Second request controller().LoadURL(url1, GURL(), PageTransition::TYPED); @@ -917,7 +917,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == NavigationType::SAME_PAGE); EXPECT_EQ(controller().entry_count(), 1); @@ -963,7 +963,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == NavigationType::NEW_PAGE); EXPECT_EQ(controller().entry_count(), 1); @@ -986,7 +986,7 @@ TEST_F(NavigationControllerTest, NewSubframe) { const GURL url1("http://foo1"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); ViewHostMsg_FrameNavigate_Params params; @@ -1001,7 +1001,7 @@ TEST_F(NavigationControllerTest, NewSubframe) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(url1, details.previous_url); EXPECT_FALSE(details.is_in_page); EXPECT_FALSE(details.is_main_frame); @@ -1047,7 +1047,7 @@ TEST_F(NavigationControllerTest, AutoSubframe) { const GURL url1("http://foo1"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); ViewHostMsg_FrameNavigate_Params params; @@ -1077,7 +1077,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { const GURL url1("http://foo1"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // First manual subframe navigation. const GURL url2("http://foo2"); @@ -1094,7 +1094,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(2, controller().entry_count()); // Second manual subframe navigation should also make a new entry. @@ -1103,7 +1103,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.url = url3; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller().entry_count()); EXPECT_EQ(2, controller().GetCurrentEntryIndex()); @@ -1113,7 +1113,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.page_id = 1; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller().entry_count()); EXPECT_EQ(1, controller().GetCurrentEntryIndex()); @@ -1123,7 +1123,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.page_id = 0; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller().entry_count()); EXPECT_EQ(0, controller().GetCurrentEntryIndex()); } @@ -1137,11 +1137,11 @@ TEST_F(NavigationControllerTest, LinkClick) { rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Should not have produced a new session history entry. EXPECT_EQ(controller().entry_count(), 2); @@ -1161,7 +1161,7 @@ TEST_F(NavigationControllerTest, InPage) { const GURL url1("http://foo"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // First navigation. const GURL url2("http://foo#a"); @@ -1178,7 +1178,7 @@ TEST_F(NavigationControllerTest, InPage) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_FALSE(details.did_replace_entry); EXPECT_EQ(2, controller().entry_count()); @@ -1190,7 +1190,7 @@ TEST_F(NavigationControllerTest, InPage) { back_params.page_id = 0; EXPECT_TRUE(controller().RendererDidNavigate(back_params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // is_in_page is false in that case but should be true. // See comment in AreURLsInPageNavigation() in navigation_controller.cc // EXPECT_TRUE(details.is_in_page); @@ -1205,7 +1205,7 @@ TEST_F(NavigationControllerTest, InPage) { forward_params.page_id = 1; EXPECT_TRUE(controller().RendererDidNavigate(forward_params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_EQ(2, controller().entry_count()); EXPECT_EQ(1, controller().GetCurrentEntryIndex()); @@ -1230,7 +1230,7 @@ TEST_F(NavigationControllerTest, InPage) { notifications.Reset(); EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_FALSE(details.is_in_page); } @@ -1242,7 +1242,7 @@ TEST_F(NavigationControllerTest, InPage_Replace) { const GURL url1("http://foo"); rvh()->SendNavigate(0, url1); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // First navigation. const GURL url2("http://foo#a"); @@ -1259,8 +1259,8 @@ TEST_F(NavigationControllerTest, InPage_Replace) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check2AndReset( - NotificationType::NAV_LIST_PRUNED, - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_LIST_PRUNED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); EXPECT_EQ(1, controller().entry_count()); @@ -1281,7 +1281,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { const GURL url("http://foo/"); rvh()->SendNavigate(0, url); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); } // Navigate to a new page. @@ -1290,7 +1290,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { rvh()->SendNavigate(1, url); controller().DocumentLoadedInFrame(); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); } // Navigate within the page. @@ -1310,8 +1310,8 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check2AndReset( - NotificationType::NAV_LIST_PRUNED, - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_LIST_PRUNED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); EXPECT_EQ(2, controller().entry_count()); @@ -1335,7 +1335,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { content::LoadCommittedDetails details; EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_FALSE(details.is_in_page); EXPECT_EQ(3, controller().entry_count()); } @@ -1346,25 +1346,25 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { controller().GoBack(); rvh()->SendNavigate(1, url); EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::NAV_ENTRY_COMMITTED)); + content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(url, controller().GetActiveEntry()->url()); } } // NotificationObserver implementation used in verifying we've received the -// NotificationType::NAV_LIST_PRUNED method. +// content::NOTIFICATION_NAV_LIST_PRUNED method. class PrunedListener : public NotificationObserver { public: explicit PrunedListener(NavigationController* controller) : notification_count_(0) { - registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, + registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, Source<NavigationController>(controller)); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NAV_LIST_PRUNED) { + if (type == content::NOTIFICATION_NAV_LIST_PRUNED) { notification_count_++; details_ = *(Details<content::PrunedDetails>(details).ptr()); } diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 1a49d4d..7d2dc58 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -20,7 +20,7 @@ #include "content/common/content_client.h" #include "content/common/content_switches.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "content/common/url_constants.h" #include "content/common/view_messages.h" @@ -69,7 +69,7 @@ void RenderViewHostManager::Init(Profile* profile, GetControllerForRenderManager().session_storage_namespace()); // Keep track of renderer processes as they start to shut down. - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSING, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSING, NotificationService::AllSources()); } @@ -114,7 +114,7 @@ RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { details.new_host = render_view_host_; details.old_host = NULL; NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>( &delegate_->GetControllerForRenderManager()), Details<RenderViewHostSwitchedDetails>(&details)); @@ -314,11 +314,11 @@ void RenderViewHostManager::OnCrossSiteNavigationCanceled() { CancelPending(); } -void RenderViewHostManager::Observe(NotificationType type, +void RenderViewHostManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDERER_PROCESS_CLOSING: + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_CLOSING: RendererProcessClosing(Source<RenderProcessHost>(source).ptr()); break; @@ -621,7 +621,7 @@ void RenderViewHostManager::CommitPending() { details.new_host = render_view_host_; details.old_host = old_render_view_host; NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&delegate_->GetControllerForRenderManager()), Details<RenderViewHostSwitchedDetails>(&details)); @@ -842,7 +842,7 @@ void RenderViewHostManager::SwapInRenderViewHost(RenderViewHost* rvh) { details.new_host = render_view_host_; details.old_host = old_render_view_host; NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&delegate_->GetControllerForRenderManager()), Details<RenderViewHostSwitchedDetails>(&details)); diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h index 6dc4d7d..cd6d865 100644 --- a/content/browser/tab_contents/render_view_host_manager.h +++ b/content/browser/tab_contents/render_view_host_manager.h @@ -174,7 +174,7 @@ class RenderViewHostManager virtual void OnCrossSiteNavigationCanceled(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc index 9b5883b..30e6605 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -185,7 +185,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); TestTabContents tab_contents(profile_.get(), instance); - notifications.ListenFor(NotificationType::RENDER_VIEW_HOST_CHANGED, + notifications.ListenFor(content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&tab_contents.controller())); // Create. @@ -254,7 +254,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // We should observe a notification. EXPECT_TRUE(notifications.Check1AndReset( - NotificationType::RENDER_VIEW_HOST_CHANGED)); + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); } // Tests WebUI creation. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index c2ca82d..6a58976 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -199,7 +199,7 @@ TabContents::TabContents(Profile* profile, view_->CreateView(base_tab_contents ? base_tab_contents->view()->GetContainerSize() : gfx::Size()); - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllSources()); // Can only add observers after render_manager_.Init() is called, since that's @@ -228,7 +228,7 @@ TabContents::~TabContents() { // Notify any observer that have a reference on this tab contents. NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(this), NotificationService::NoDetails()); @@ -454,7 +454,7 @@ void TabContents::WasHidden() { } NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(this), NotificationService::NoDetails()); } @@ -889,7 +889,7 @@ void TabContents::OnDidFailProvisionalLoadWithError( details.set_error_code(error_code); NotificationService::current()->Notify( - NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, + content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, Source<NavigationController>(&controller_), Details<ProvisionalLoadDetails>(&details)); @@ -914,7 +914,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache( cert_id, cert_status); NotificationService::current()->Notify( - NotificationType::LOAD_FROM_MEMORY_CACHE, + content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, Source<NavigationController>(&controller_), Details<LoadFromMemoryCacheDetails>(&details)); } @@ -974,7 +974,7 @@ void TabContents::OnUpdateZoomLimits(int minimum_percent, void TabContents::OnFocusedNodeChanged(bool is_editable_node) { NotificationService::current()->Notify( - NotificationType::FOCUS_CHANGED_IN_PAGE, + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, Source<TabContents>(this), Details<const bool>(&is_editable_node)); } @@ -1002,8 +1002,8 @@ void TabContents::SetIsLoading(bool is_loading, delegate_->LoadingStateChanged(this); NotifyNavigationStateChanged(INVALIDATE_LOAD); - NotificationType type = is_loading ? NotificationType::LOAD_START : - NotificationType::LOAD_STOP; + int type = is_loading ? content::NOTIFICATION_LOAD_START : + content::NOTIFICATION_LOAD_STOP; NotificationDetails det = NotificationService::NoDetails(); if (details) det = Details<LoadNotificationDetails>(details); @@ -1195,7 +1195,7 @@ bool TabContents::UpdateTitleForEntry(NavigationEntry* entry, TitleUpdatedDetails details(entry, explicit_set); NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_TITLE_UPDATED, + content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED, Source<TabContents>(this), Details<TitleUpdatedDetails>(&details)); @@ -1208,7 +1208,7 @@ void TabContents::NotifySwapped() { // pointer. See Bug 1230284. notify_disconnection_ = true; NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_SWAPPED, + content::NOTIFICATION_TAB_CONTENTS_SWAPPED, Source<TabContents>(this), NotificationService::NoDetails()); } @@ -1216,7 +1216,7 @@ void TabContents::NotifySwapped() { void TabContents::NotifyConnected() { notify_disconnection_ = true; NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_CONNECTED, + content::NOTIFICATION_TAB_CONTENTS_CONNECTED, Source<TabContents>(this), NotificationService::NoDetails()); } @@ -1227,7 +1227,7 @@ void TabContents::NotifyDisconnected() { notify_disconnection_ = false; NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_DISCONNECTED, + content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, Source<TabContents>(this), NotificationService::NoDetails()); } @@ -1255,7 +1255,7 @@ ViewType::Type TabContents::GetRenderViewType() const { void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<TabContents>(this), Details<RenderViewHost>(render_view_host)); NavigationEntry* entry = controller_.GetActiveEntry(); @@ -1527,7 +1527,7 @@ void TabContents::DocumentOnLoadCompletedInMainFrame( RenderViewHost* render_view_host, int32 page_id) { NotificationService::current()->Notify( - NotificationType::LOAD_COMPLETED_MAIN_FRAME, + content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, Source<TabContents>(this), Details<int>(&page_id)); } @@ -1790,11 +1790,11 @@ bool TabContents::CreateRenderViewForRenderManager( return true; } -void TabContents::Observe(NotificationType type, +void TabContents::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDER_WIDGET_HOST_DESTROYED: + switch (type) { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: view_->RenderWidgetHostDestroyed(Source<RenderWidgetHost>(source).ptr()); break; default: diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 458d341..9b88ea6 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -700,7 +700,7 @@ class TabContents : public PageNavigator, // NotificationObserver ------------------------------------------------------ - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/content/browser/tab_contents/tab_contents_view.cc b/content/browser/tab_contents/tab_contents_view.cc index 4ea5d9b..13ca172d 100644 --- a/content/browser/tab_contents/tab_contents_view.cc +++ b/content/browser/tab_contents/tab_contents_view.cc @@ -44,7 +44,7 @@ void TabContentsView::CreateNewWindow( if (new_contents) { NotificationService::current()->Notify( - NotificationType::CREATING_NEW_WINDOW, + content::NOTIFICATION_CREATING_NEW_WINDOW, Source<TabContents>(tab_contents_), Details<const ViewHostMsg_CreateWindow_Params>(¶ms)); @@ -52,7 +52,7 @@ void TabContentsView::CreateNewWindow( tab_contents_->delegate()->TabContentsCreated(new_contents); } else { NotificationService::current()->Notify( - NotificationType::CREATING_NEW_WINDOW_CANCELLED, + content::NOTIFICATION_CREATING_NEW_WINDOW_CANCELLED, Source<TabContents>(tab_contents_), Details<const ViewHostMsg_CreateWindow_Params>(¶ms)); } diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc index ceee175..4c8cfb4 100644 --- a/content/browser/user_metrics.cc +++ b/content/browser/user_metrics.cc @@ -24,7 +24,7 @@ void UserMetrics::Record(const char *action) { return; } - NotificationService::current()->Notify(NotificationType::USER_ACTION, + NotificationService::current()->Notify(content::NOTIFICATION_USER_ACTION, NotificationService::AllSources(), Details<const char*>(&action)); } diff --git a/content/common/child_process_host.cc b/content/common/child_process_host.cc index c1dce2e..6a14750 100644 --- a/content/common/child_process_host.cc +++ b/content/common/child_process_host.cc @@ -133,7 +133,7 @@ bool ChildProcessHost::CreateChannel() { } void ChildProcessHost::InstanceCreated() { - Notify(NotificationType::CHILD_INSTANCE_CREATED); + Notify(content::NOTIFICATION_CHILD_INSTANCE_CREATED); } bool ChildProcessHost::OnMessageReceived(const IPC::Message& msg) { @@ -161,7 +161,7 @@ void ChildProcessHost::OnChildDied() { void ChildProcessHost::ShutdownStarted() { } -void ChildProcessHost::Notify(NotificationType type) { +void ChildProcessHost::Notify(int type) { } ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) @@ -209,7 +209,7 @@ void ChildProcessHost::ListenerHook::OnChannelConnected(int32 peer_pid) { host_->opening_channel_ = false; host_->OnChannelConnected(peer_pid); // Notify in the main loop of the connection. - host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED); + host_->Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED); for (size_t i = 0; i < host_->filters_.size(); ++i) host_->filters_[i]->OnChannelConnected(peer_pid); diff --git a/content/common/child_process_host.h b/content/common/child_process_host.h index 8faf0e6..7e00c43 100644 --- a/content/common/child_process_host.h +++ b/content/common/child_process_host.h @@ -17,7 +17,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "ipc/ipc_channel_proxy.h" class CommandLine; @@ -93,7 +93,7 @@ class ChildProcessHost : public IPC::Channel::Listener, // Notifies the derived class that we told the child process to kill itself. virtual void ShutdownStarted(); // Subclasses can implement specific notification methods. - virtual void Notify(NotificationType type); + virtual void Notify(int type); private: // By using an internal class as the IPC::Channel::Listener, we can intercept diff --git a/content/common/content_notification_types.h b/content/common/content_notification_types.h new file mode 100644 index 0000000..76006ad --- /dev/null +++ b/content/common/content_notification_types.h @@ -0,0 +1,449 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_NOTIFICATION_TYPE_H_ +#define CONTENT_COMMON_NOTIFICATION_TYPE_H_ +#pragma once + +// This file describes various types used to describe and filter notifications +// that pass through the NotificationService. +// +namespace content { + +enum { + NOTIFICATION_CONTENT_START = 0, + + // General ----------------------------------------------------------------- + + // Special signal value to represent an interest in all notifications. + // Not valid when posting a notification. + NOTIFICATION_ALL = NOTIFICATION_CONTENT_START, + + // The app is done processing user actions, now is a good time to do + // some background work. + NOTIFICATION_IDLE, + + // Means that the app has just started doing something in response to a + // user action, and that background processes shouldn't run if avoidable. + NOTIFICATION_BUSY, + + // This is sent when the user does a gesture resulting in a noteworthy + // action taking place. This is typically used for logging. The source is + // the profile, and the details is a string identifying the action. + NOTIFICATION_USER_ACTION, + + // NavigationController ---------------------------------------------------- + + // A new pending navigation has been created. Pending entries are created + // when the user requests the navigation. We don't know if it will actually + // happen until it does (at this point, it will be "committed." Note that + // renderer- initiated navigations such as link clicks will never be + // pending. + // + // This notification is called after the pending entry is created, but + // before we actually try to navigate. The source will be the + // NavigationController that owns the pending entry, and there are no + // details. + NOTIFICATION_NAV_ENTRY_PENDING, + + // A new non-pending navigation entry has been created. This will + // correspond to one NavigationController entry being created (in the case + // of new navigations) or renavigated to (for back/forward navigations). + // + // The source will be the navigation controller doing the commit. The + // details will be NavigationController::LoadCommittedDetails. + NOTIFICATION_NAV_ENTRY_COMMITTED, + + // Indicates that the NavigationController given in the Source has + // decreased its back/forward list count by removing entries from either + // the front or back of its list. This is usually the result of going back + // and then doing a new navigation, meaning all the "forward" items are + // deleted. + // + // This normally happens as a result of a new navigation. It will be + // followed by a NAV_ENTRY_COMMITTED message for the new page that + // caused the pruning. It could also be a result of removing an item from + // the list to fix up after interstitials. + // + // The details are NavigationController::PrunedDetails. + NOTIFICATION_NAV_LIST_PRUNED, + + // Indicates that a NavigationEntry has changed. The source will be the + // NavigationController that owns the NavigationEntry. The details will be + // a NavigationController::EntryChangedDetails struct. + // + // This will NOT be sent on navigation, interested parties should also + // listen for NAV_ENTRY_COMMITTED to handle that case. This will be + // sent when the entry is updated outside of navigation (like when a new + // title comes). + NOTIFICATION_NAV_ENTRY_CHANGED, + + // Other load-related (not from NavigationController) ---------------------- + + // Corresponds to ViewHostMsg_DocumentOnLoadCompletedInMainFrame. The source + // is the TabContents and the details the page_id. + NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, + + // A content load is starting. The source will be a + // Source<NavigationController> corresponding to the tab in which the load + // is occurring. No details are expected for this notification. + NOTIFICATION_LOAD_START, + + // A content load has stopped. The source will be a + // Source<NavigationController> corresponding to the tab in which the load + // is occurring. Details in the form of a LoadNotificationDetails object + // are optional. + NOTIFICATION_LOAD_STOP, + + // Content was loaded from an in-memory cache. The source will be a + // Source<NavigationController> corresponding to the tab in which the load + // occurred. Details in the form of a LoadFromMemoryCacheDetails object + // are provided. + NOTIFICATION_LOAD_FROM_MEMORY_CACHE, + + // A provisional content load has failed with an error. The source will be + // a Source<NavigationController> corresponding to the tab in which the + // load occurred. Details in the form of a ProvisionalLoadDetails object + // are provided. + NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, + + // A response has been received for a resource request. The source will be + // a Source<RenderViewHostDelegate> corresponding to the tab in which the + // request was issued. Details in the form of a ResourceRequestDetails + // object are provided. + NOTIFICATION_RESOURCE_RESPONSE_STARTED, + + // A redirect was received while requesting a resource. The source will be + // a Source<RenderViewHostDelegate> corresponding to the tab in which the + // request was issued. Details in the form of a ResourceRedirectDetails + // are provided. + NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, + + // A new window is created in response to a request from a renderer. The + // source will be a Source<TabContents> corresponding to the tab the + // request originates from. Details in the form of a + // ViewHostMsg_CreateWindow_Params object are provided. + NOTIFICATION_CREATING_NEW_WINDOW, + + // A new window was requested but was not created. The source will be a + // Source<TabContents> corresponding to the tab the request originated from. + // Details are the ViewHostMsg_CreateWindow_Params object that were used in + // the request. + NOTIFICATION_CREATING_NEW_WINDOW_CANCELLED, + + // SSL --------------------------------------------------------------------- + + // Updating the SSL security indicators (the lock icon and such) proceeds + // in two phases: + // + // 1) The internal SSL state for a host or tab changes. When this happens, + // the SSLManager broadcasts an SSL_INTERNAL_STATE_CHANGED notification. + // + // 2) The SSLManager for each tab receives this notification and might or + // might not update the navigation entry for its tab, depending on + // whether the change in state affects that tab. If the SSLManager does + // change the navigation entry, then the SSLManager broadcasts an + // SSL_VISIBLE_STATE_CHANGED notification to the user interface can + // redraw properly. + + // The SSL state of a page has changed in some visible way. For example, + // if an insecure resource is loaded on a secure page. Note that a + // toplevel load commit will also update the SSL state (since the + // NavigationEntry is new) and this message won't always be sent in that + // case. Listen to this notification if you need to refresh SSL-related UI + // elements. + // + // There is no source or details. + NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, + + // The SSL state of the browser has changed in some internal way. For + // example, the user might have explicitly allowed some broken certificate + // or a secure origin might have included some insecure content. Listen to + // this notifiation if you need to keep track of our internal SSL state. + // + // The source will be the navigation controller associated with the state + // change. There are no details. + NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, + + // The user accepted or dismissed a SSL client authentication request. + // The source is a Source<SSLClientAuthHandler>. Details is a + // SSLClientAuthNotificationDetails which records specifies which + // SSLCertRequestInfo the request was for and which X509Certificate was + // selected (if any). + NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, + + // Notification that a view was removed from a view hierarchy. The source + // is the view, the details is the parent view. + NOTIFICATION_VIEW_REMOVED, + + // This message is sent when the last window considered to be an + // "application window" has been closed. Dependent/dialog/utility windows + // can use this as a way to know that they should also close. No source or + // details are passed. + NOTIFICATION_ALL_APPWINDOWS_CLOSED, + +#if defined(OS_MACOSX) + // This message is sent when the application is made active (Mac OS X only + // at present). No source or details are passed. + NOTIFICATION_APP_ACTIVATED, +#endif + + // This message is sent when the application is terminating (the last + // browser window has shutdown as part of an explicit user-initiated exit, + // or the user closed the last browser window on Windows/Linux and there are + // no BackgroundContents keeping the browser running). No source or details + // are passed. + NOTIFICATION_APP_TERMINATING, + +#if defined(OS_MACOSX) + // This notification is sent when the app has no key window, such as when + // all windows are closed but the app is still active. No source or details + // are provided. + NOTIFICATION_NO_KEY_WINDOW, +#endif + + // This is sent when the user has chosen to exit the app, but before any + // browsers have closed. This is sent if the user chooses to exit + // (via exit menu item or keyboard shortcut) or to restart the process + // (such as in flags page), not if Chrome exists by some other means + // (such as the user closing the last window). Note that receiving this + // notification does not necessarily mean the process will exit + // because the shutdown process can be cancelled by unload handler. + // Use APP_TERMINATING for such needs. + // The source and details are unspecified. + NOTIFICATION_APP_EXITING, + + // Indicates that a devtools window is closing. The source is the Profile* + // and the details is the inspected RenderViewHost*. + NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, + + // Tabs -------------------------------------------------------------------- + + // Sent when a tab is added to a TabContentsDelegate. The source is the + // TabContentsDelegate and the details is the TabContents. + NOTIFICATION_TAB_ADDED, + + // This notification is sent after a tab has been appended to the tab_strip. + // The source is a Source<TabContentsWrapper> of the tab being added. There + // are no details. + NOTIFICATION_TAB_PARENTED, + + // This message is sent before a tab has been closed. The source is a + // Source<NavigationController> with a pointer to the controller for the + // closed tab. No details are expected. + // + // See also TAB_CLOSED. + NOTIFICATION_TAB_CLOSING, + + // Notification that a tab has been closed. The source is the + // NavigationController with no details. + NOTIFICATION_TAB_CLOSED, + + // This notification is sent when a render view host has connected to a + // renderer process. The source is a Source<TabContents> with a pointer to + // the TabContents. A TAB_CONTENTS_DISCONNECTED notification is + // guaranteed before the source pointer becomes junk. No details are + // expected. + NOTIFICATION_TAB_CONTENTS_CONNECTED, + + // This notification is sent when a TabContents swaps its render view host + // with another one, possibly changing processes. The source is a + // Source<TabContents> with a pointer to the TabContents. A + // TAB_CONTENTS_DISCONNECTED notification is guaranteed before the + // source pointer becomes junk. No details are expected. + NOTIFICATION_TAB_CONTENTS_SWAPPED, + + // This message is sent after a TabContents is disconnected from the + // renderer process. The source is a Source<TabContents> with a pointer to + // the TabContents (the pointer is usable). No details are expected. + NOTIFICATION_TAB_CONTENTS_DISCONNECTED, + + // This notification is sent after TabContents' title is updated. The source + // is a Source<TabContents> with a pointer to the TabContents. The details + // is a Details<TitleUpdatedDetails> that contains more information. + NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED, + + // This notification is sent when a TabContents is being hidden, e.g. due + // to switching away from this tab. The source is a Source<TabContents>. + NOTIFICATION_TAB_CONTENTS_HIDDEN, + + // This notification is sent when a TabContents is being destroyed. Any + // object holding a reference to a TabContents can listen to that + // notification to properly reset the reference. The source is a + // Source<TabContents>. + NOTIFICATION_TAB_CONTENTS_DESTROYED, + + // A RenderViewHost was created for a TabContents. The source is the + // associated TabContents, and the details is the RenderViewHost + // pointer. + NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, + + // Notification than an interstitial has become associated with a tab. The + // source is the TabContents, the details not used. + NOTIFICATION_INTERSTITIAL_ATTACHED, + + // Indicates that a RenderProcessHost was created and its handle is now + // available. The source will be the RenderProcessHost that corresponds to + // the process. + NOTIFICATION_RENDERER_PROCESS_CREATED, + + // Indicates that a RenderProcessHost is destructing. The source will be the + // RenderProcessHost that corresponds to the process. + NOTIFICATION_RENDERER_PROCESS_TERMINATED, + + // Indicates that a render process is starting to exit, such that it should + // not be used for future navigations. The source will be the + // RenderProcessHost that corresponds to the process. + NOTIFICATION_RENDERER_PROCESS_CLOSING, + + // Indicates that a render process was closed (meaning it exited, but the + // RenderProcessHost might be reused). The source will be the corresponding + // RenderProcessHost. The details will be a RendererClosedDetails struct. + // This may get sent along with RENDERER_PROCESS_TERMINATED. + NOTIFICATION_RENDERER_PROCESS_CLOSED, + + // Indicates that a render process has become unresponsive for a period of + // time. The source will be the RenderWidgetHost that corresponds to the + // hung view, and no details are expected. + NOTIFICATION_RENDERER_PROCESS_HANG, + + // This is sent to notify that the RenderViewHost displayed in a + // TabContents has changed. Source is the TabContents for which the change + // happened, details is the previous RenderViewHost (can be NULL when the + // first RenderViewHost is set). + NOTIFICATION_RENDER_VIEW_HOST_CHANGED, + + // Indicates that the render view host has received an accessibility tree + // update, either partial or full, from the render view. The source is the + // RenderViewHost, the details are not used. + NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, + + // This is sent when a RenderWidgetHost is being destroyed. The source is + // the RenderWidgetHost, the details are not used. + NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, + + // Sent when the widget is about to paint. The source is the + // RenderWidgetHost, the details are not used. + NOTIFICATION_RENDER_WIDGET_HOST_WILL_PAINT, + + // Sent after the widget has painted. The source is the RenderWidgetHost, + // the details are not used. + NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, + + // This notifies the observer that a PaintAtSizeACK was received. The source + // is the RenderWidgetHost, the details are an instance of + // RenderWidgetHost::PaintAtSizeAckDetails. + NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + + // This notifies the observer that a HandleInputEventACK was received. The + // source is the RenderWidgetHost, the details are the type of event + // received. + // Note: The RenderWidgetHost may be deallocated at this point. + // Used only in testing. + NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, + + // Sent from RenderViewHost constructor. The source is the RenderViewHost, + // the details unused. + NOTIFICATION_RENDER_VIEW_HOST_CREATED, + + // Sent from ~RenderViewHost. The source is the RenderViewHost, the details + // unused. + NOTIFICATION_RENDER_VIEW_HOST_DELETED, + + // Sent from RenderViewHost::ClosePage. The hosted RenderView has + // processed the onbeforeunload handler and is about to be sent a + // ViewMsg_ClosePage message to complete the tear-down process. The source + // is the RenderViewHost sending the message, and no details are provided. + // Note: This message is not sent in response to RenderView closure + // initiated by window.close(). + NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, + + // This notifies the observer that the drag operation ack in a drag and + // drop operation was received. The source is the RenderViewHost. + // Note: Used only in testing. + NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, + + // Indicates a RenderWidgetHost has been hidden or restored. The source is + // the RWH whose visibility changed, the details is a bool set to true if + // the new state is "visible." + NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, + + // The focused element inside a page has changed. The source is the + // TabContents containing the render view host for the page. The details is + // a Details<const bool> that indicates whether or not an editable node was + // focused. + NOTIFICATION_FOCUS_CHANGED_IN_PAGE, + + // Notification posted from ExecuteJavascriptInWebFrameNotifyResult. The + // source is the RenderViewHost ExecuteJavascriptInWebFrameNotifyResult was + // invoked on. The details are a std::pair<int, Value*> with the int giving + // the id returned from ExecuteJavascriptInWebFrameNotifyResult and the + // Value the results of the javascript expression. The Value is owned by + // RenderViewHost and may be a Null Value. + NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, + + // Child Processes --------------------------------------------------------- + + // This notification is sent when a child process host has connected to a + // child process. There is no usable source, since it is sent from an + // ephemeral task; register for AllSources() to receive this notification. + // The details are in a Details<ChildProcessInfo>. + NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, + + // This message is sent after a ChildProcessHost is disconnected from the + // child process. There is no usable source, since it is sent from an + // ephemeral task; register for AllSources() to receive this notification. + // The details are in a Details<ChildProcessInfo>. + NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, + + // This message is sent when a child process disappears + // unexpectedly as a result of a crash. There is no usable + // source, since it is sent from an ephemeral task; register for + // AllSources() to receive this notification. The details are in + // a Details<ChildProcessInfo>. + NOTIFICATION_CHILD_PROCESS_CRASHED, + + // This message is sent when a child process disappears + // unexpectedly as a result of a termination signal. There is no + // usable source, since it is sent from an ephemeral task; + // register for AllSources() to receive this notification. The + // details are in a Details<ChildProcessInfo>. + NOTIFICATION_CHILD_PROCESS_WAS_KILLED, + + // This message indicates that an instance of a particular child was + // created in a page. (If one page contains several regions rendered by + // the same child, this notification will occur once for each region + // during the page load.) + // + // There is no usable source, since it is sent from an ephemeral task; + // register for AllSources() to receive this notification. The details are + // in a Details<ChildProcessInfo>. + NOTIFICATION_CHILD_INSTANCE_CREATED, + + // Sent by the PluginUpdater when there is a change of plugin + // enable/disable status. + NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, + + // Purge Memory ------------------------------------------------------------ + + // Sent on the IO thread when the system should try to reduce the amount of + // memory in use, no source or details are passed. See memory_purger.h .cc. + NOTIFICATION_PURGE_MEMORY, + + // Sent before the repost form warning is brought up. + // The source is a NavigationController. + NOTIFICATION_REPOST_WARNING_SHOWN, + + // Sent when the zoom level changes. The source is the HostZoomMap. The + // details is a string of the hostname for which the zoom changed. In case + // of a temporary zoom level change, the details is an empty string. + NOTIFICATION_ZOOM_LEVEL_CHANGED, + + // Custom notifications used by the embedder should start from here. + NOTIFICATION_CONTENT_END, +}; + +} // namespace content + +#endif // CONTENT_COMMON_NOTIFICATION_TYPE_H_ diff --git a/content/common/notification_observer.h b/content/common/notification_observer.h index ba32b1d..49f74de 100644 --- a/content/common/notification_observer.h +++ b/content/common/notification_observer.h @@ -8,7 +8,6 @@ class NotificationDetails; class NotificationSource; -class NotificationType; // This is the base class for notification observers. When a matching // notification is posted to the notification service, Observe is called. @@ -17,7 +16,7 @@ class NotificationObserver { NotificationObserver(); virtual ~NotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) = 0; }; diff --git a/content/common/notification_observer_mock.h b/content/common/notification_observer_mock.h index 6131be1..1c6fa4b 100644 --- a/content/common/notification_observer_mock.h +++ b/content/common/notification_observer_mock.h @@ -6,8 +6,8 @@ #define CONTENT_COMMON_NOTIFICATION_OBSERVER_MOCK_H_ #pragma once +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" class NotificationDetails; @@ -18,7 +18,7 @@ class NotificationObserverMock : public NotificationObserver { NotificationObserverMock(); virtual ~NotificationObserverMock(); - MOCK_METHOD3(Observe, void(NotificationType type, + MOCK_METHOD3(Observe, void(int type, const NotificationSource& source, const NotificationDetails& details)); }; diff --git a/content/common/notification_registrar.cc b/content/common/notification_registrar.cc index 0d3308c..eca5054 100644 --- a/content/common/notification_registrar.cc +++ b/content/common/notification_registrar.cc @@ -25,7 +25,7 @@ struct NotificationRegistrar::Record { bool operator==(const Record& other) const; NotificationObserver* observer; - NotificationType type; + int type; NotificationSource source; base::PlatformThreadId thread_id; }; @@ -51,7 +51,7 @@ NotificationRegistrar::~NotificationRegistrar() { } void NotificationRegistrar::Add(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { DCHECK(!IsRegistered(observer, type, source)) << "Duplicate registration."; @@ -62,11 +62,11 @@ void NotificationRegistrar::Add(NotificationObserver* observer, } void NotificationRegistrar::Remove(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { if (!IsRegistered(observer, type, source)) { NOTREACHED() << "Trying to remove unregistered observer of type " << - type.value << " from list of size " << registered_.size() << "."; + type << " from list of size " << registered_.size() << "."; return; } @@ -113,7 +113,7 @@ bool NotificationRegistrar::IsEmpty() const { } bool NotificationRegistrar::IsRegistered(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { Record record = { observer, type, source }; return std::find(registered_.begin(), registered_.end(), record) != diff --git a/content/common/notification_registrar.h b/content/common/notification_registrar.h index f912892..9d054bf 100644 --- a/content/common/notification_registrar.h +++ b/content/common/notification_registrar.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" class NotificationObserver; class NotificationSource; @@ -30,10 +30,10 @@ class NotificationRegistrar { // Wrappers around NotificationService::[Add|Remove]Observer. void Add(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source); void Remove(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source); // Unregisters all notifications. @@ -45,7 +45,7 @@ class NotificationRegistrar { // Returns true if there is already a registered notification with the // specified details. bool IsRegistered(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source); private: diff --git a/content/common/notification_service.cc b/content/common/notification_service.cc index 59d26d6..948fbda 100644 --- a/content/common/notification_service.cc +++ b/content/common/notification_service.cc @@ -24,18 +24,12 @@ bool NotificationService::HasKey(const NotificationSourceMap& map, NotificationService::NotificationService() { DCHECK(current() == NULL); -#ifndef NDEBUG - memset(observer_counts_, 0, sizeof(observer_counts_)); -#endif - lazy_tls_ptr.Pointer()->Set(this); } void NotificationService::AddObserver(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); - // We have gotten some crashes where the observer pointer is NULL. The problem // is that this happens when we actually execute a notification, so have no // way of knowing who the bad observer was. We want to know when this happens @@ -44,81 +38,78 @@ void NotificationService::AddObserver(NotificationObserver* observer, CHECK(observer); NotificationObserverList* observer_list; - if (HasKey(observers_[type.value], source)) { - observer_list = observers_[type.value][source.map_key()]; + if (HasKey(observers_[type], source)) { + observer_list = observers_[type][source.map_key()]; } else { observer_list = new NotificationObserverList; - observers_[type.value][source.map_key()] = observer_list; + observers_[type][source.map_key()] = observer_list; } observer_list->AddObserver(observer); #ifndef NDEBUG - ++observer_counts_[type.value]; + ++observer_counts_[type]; #endif } void NotificationService::RemoveObserver(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); - // This is a very serious bug. An object is most likely being deleted on // the wrong thread, and as a result another thread's NotificationService // has its deleted pointer in its map. A garbge object will be called in the // future. // NOTE: when this check shows crashes, use BrowserThread::DeleteOnIOThread or // other variants as the trait on the object. - CHECK(HasKey(observers_[type.value], source)); + CHECK(HasKey(observers_[type], source)); NotificationObserverList* observer_list = - observers_[type.value][source.map_key()]; + observers_[type][source.map_key()]; if (observer_list) { observer_list->RemoveObserver(observer); #ifndef NDEBUG - --observer_counts_[type.value]; + --observer_counts_[type]; #endif } // TODO(jhughes): Remove observer list from map if empty? } -void NotificationService::Notify(NotificationType type, +void NotificationService::Notify(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value > NotificationType::ALL) << + DCHECK(type > content::NOTIFICATION_ALL) << "Allowed for observing, but not posting."; - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); // There's no particular reason for the order in which the different // classes of observers get notified here. // Notify observers of all types and all sources - if (HasKey(observers_[NotificationType::ALL], AllSources()) && + if (HasKey(observers_[content::NOTIFICATION_ALL], AllSources()) && source != AllSources()) { FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NotificationType::ALL][AllSources().map_key()], + *observers_[content::NOTIFICATION_ALL][AllSources().map_key()], Observe(type, source, details)); } // Notify observers of all types and the given source - if (HasKey(observers_[NotificationType::ALL], source)) { + if (HasKey(observers_[content::NOTIFICATION_ALL], source)) { FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NotificationType::ALL][source.map_key()], + *observers_[content::NOTIFICATION_ALL][source.map_key()], Observe(type, source, details)); } // Notify observers of the given type and all sources - if (HasKey(observers_[type.value], AllSources()) && + if (HasKey(observers_[type], AllSources()) && source != AllSources()) { FOR_EACH_OBSERVER(NotificationObserver, - *observers_[type.value][AllSources().map_key()], + *observers_[type][AllSources().map_key()], Observe(type, source, details)); } // Notify observers of the given type and the given source - if (HasKey(observers_[type.value], source)) { + if (HasKey(observers_[type], source)) { FOR_EACH_OBSERVER(NotificationObserver, - *observers_[type.value][source.map_key()], + *observers_[type][source.map_key()], Observe(type, source, details)); } } @@ -128,7 +119,7 @@ NotificationService::~NotificationService() { lazy_tls_ptr.Pointer()->Set(NULL); #ifndef NDEBUG - for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { + for (size_t i = 0; i < observer_counts_.size(); i++) { if (observer_counts_[i] > 0) { // This may not be completely fixable -- see // http://code.google.com/p/chromium/issues/detail?id=11010 . @@ -138,7 +129,7 @@ NotificationService::~NotificationService() { } #endif - for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { + for (size_t i = 0; i < observers_.size(); i++) { NotificationSourceMap omap = observers_[i]; for (NotificationSourceMap::iterator it = omap.begin(); it != omap.end(); ++it) diff --git a/content/common/notification_service.h b/content/common/notification_service.h index 2b7ace8..c6898f5 100644 --- a/content/common/notification_service.h +++ b/content/common/notification_service.h @@ -13,9 +13,9 @@ #include <map> #include "base/observer_list.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" class NotificationObserver; @@ -38,7 +38,7 @@ class NotificationService { // Details is a reference to an object containing additional data about // the notification. If no additional data is needed, NoDetails() is used. // There is no particular order in which the observers will be notified. - void Notify(NotificationType type, + void Notify(int type, const NotificationSource& source, const NotificationDetails& details); @@ -55,6 +55,8 @@ class NotificationService { typedef ObserverList<NotificationObserver> NotificationObserverList; typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap; + typedef std::map<int, NotificationSourceMap> NotificationObserverMap; + typedef std::map<int, int> NotificationObserverCount; // Convenience function to determine whether a source has a // NotificationObserverList in the given map; @@ -68,7 +70,8 @@ class NotificationService { // notification is posted. Observer is a pointer to an object subclassing // NotificationObserver to be notified when an event matching the other two // parameters is posted to this service. Type is the type of events to be - // notified about (or NotificationType::ALL to receive events of all types). + // notified about (or content::NOTIFICATION_ALL to receive events of all + // types). // Source is a NotificationSource object (created using // "Source<classname>(pointer)"), if this observer only wants to // receive events from that object, or NotificationService::AllSources() @@ -80,7 +83,7 @@ class NotificationService { // // The caller retains ownership of the object pointed to by observer. void AddObserver(NotificationObserver* observer, - NotificationType type, const NotificationSource& source); + int type, const NotificationSource& source); // NOTE: Rather than using this directly, you should use a // NotificationRegistrar. @@ -89,17 +92,17 @@ class NotificationService { // that match type and source. If no object matching the parameters is // currently registered, this method is a no-op. void RemoveObserver(NotificationObserver* observer, - NotificationType type, const NotificationSource& source); + int type, const NotificationSource& source); // Keeps track of the observers for each type of notification. // Until we get a prohibitively large number of notification types, // a simple array is probably the fastest way to dispatch. - NotificationSourceMap observers_[NotificationType::NOTIFICATION_TYPE_COUNT]; + NotificationObserverMap observers_; #ifndef NDEBUG // Used to check to see that AddObserver and RemoveObserver calls are // balanced. - int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT]; + NotificationObserverCount observer_counts_; #endif DISALLOW_COPY_AND_ASSIGN(NotificationService); diff --git a/content/common/notification_service_unittest.cc b/content/common/notification_service_unittest.cc index 9a77cc0..a40e11c 100644 --- a/content/common/notification_service_unittest.cc +++ b/content/common/notification_service_unittest.cc @@ -18,7 +18,7 @@ public: int notification_count() { return notification_count_; } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { ++notification_count_; @@ -53,17 +53,17 @@ TEST_F(NotificationServiceTest, Basic) { // Make sure it doesn't freak out when there are no observers. NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); - registrar_.Add(&all_types_all_sources, NotificationType::ALL, + registrar_.Add(&all_types_all_sources, content::NOTIFICATION_ALL, NotificationService::AllSources()); - registrar_.Add(&idle_all_sources, NotificationType::IDLE, + registrar_.Add(&idle_all_sources, content::NOTIFICATION_IDLE, NotificationService::AllSources()); - registrar_.Add(&all_types_test_source, NotificationType::ALL, + registrar_.Add(&all_types_test_source, content::NOTIFICATION_ALL, Source<TestSource>(&test_source)); - registrar_.Add(&idle_test_source, NotificationType::IDLE, + registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE, Source<TestSource>(&test_source)); EXPECT_EQ(0, all_types_all_sources.notification_count()); @@ -71,7 +71,7 @@ TEST_F(NotificationServiceTest, Basic) { EXPECT_EQ(0, all_types_test_source.notification_count()); EXPECT_EQ(0, idle_test_source.notification_count()); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -80,7 +80,7 @@ TEST_F(NotificationServiceTest, Basic) { EXPECT_EQ(1, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NotificationType::BUSY, + service->Notify(content::NOTIFICATION_BUSY, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -89,7 +89,7 @@ TEST_F(NotificationServiceTest, Basic) { EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&other_source), NotificationService::NoDetails()); @@ -98,7 +98,7 @@ TEST_F(NotificationServiceTest, Basic) { EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NotificationType::BUSY, + service->Notify(content::NOTIFICATION_BUSY, Source<TestSource>(&other_source), NotificationService::NoDetails()); @@ -108,7 +108,7 @@ TEST_F(NotificationServiceTest, Basic) { EXPECT_EQ(1, idle_test_source.notification_count()); // Try send with NULL source. - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, NotificationService::AllSources(), NotificationService::NoDetails()); @@ -119,7 +119,7 @@ TEST_F(NotificationServiceTest, Basic) { registrar_.RemoveAll(); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -136,28 +136,28 @@ TEST_F(NotificationServiceTest, MultipleRegistration) { NotificationService* service = NotificationService::current(); - registrar_.Add(&idle_test_source, NotificationType::IDLE, + registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE, Source<TestSource>(&test_source)); - registrar_.Add(&idle_test_source, NotificationType::ALL, + registrar_.Add(&idle_test_source, content::NOTIFICATION_ALL, Source<TestSource>(&test_source)); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(2, idle_test_source.notification_count()); - registrar_.Remove(&idle_test_source, NotificationType::IDLE, + registrar_.Remove(&idle_test_source, content::NOTIFICATION_IDLE, Source<TestSource>(&test_source)); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); - registrar_.Remove(&idle_test_source, NotificationType::ALL, + registrar_.Remove(&idle_test_source, content::NOTIFICATION_ALL, Source<TestSource>(&test_source)); - service->Notify(NotificationType::IDLE, + service->Notify(content::NOTIFICATION_IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); diff --git a/content/common/notification_type.h b/content/common/notification_type.h deleted file mode 100644 index ec0463a..0000000 --- a/content/common/notification_type.h +++ /dev/null @@ -1,1383 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_NOTIFICATION_TYPE_H_ -#define CONTENT_COMMON_NOTIFICATION_TYPE_H_ -#pragma once - -// This file describes various types used to describe and filter notifications -// that pass through the NotificationService. -// -// It is written as an enum inside a class so that it can be forward declared. -// You're not allowed to forward declare an enum, and we want to forward -// declare this since it's required by NotificationObserver which is included -// by a lot of header files. -// -// Since this class encapsulates an integral value, it should be passed by -// value. -class NotificationType { - public: - enum Type { - // General ----------------------------------------------------------------- - - // Special signal value to represent an interest in all notifications. - // Not valid when posting a notification. - ALL = 0, - - // The app is done processing user actions, now is a good time to do - // some background work. - IDLE, - - // Means that the app has just started doing something in response to a - // user action, and that background processes shouldn't run if avoidable. - BUSY, - - // This is sent when the user does a gesture resulting in a noteworthy - // action taking place. This is typically used for logging. The source is - // the profile, and the details is a string identifying the action. - USER_ACTION, - - // NavigationController ---------------------------------------------------- - - // A new pending navigation has been created. Pending entries are created - // when the user requests the navigation. We don't know if it will actually - // happen until it does (at this point, it will be "committed." Note that - // renderer- initiated navigations such as link clicks will never be - // pending. - // - // This notification is called after the pending entry is created, but - // before we actually try to navigate. The source will be the - // NavigationController that owns the pending entry, and there are no - // details. - NAV_ENTRY_PENDING, - - // A new non-pending navigation entry has been created. This will - // correspond to one NavigationController entry being created (in the case - // of new navigations) or renavigated to (for back/forward navigations). - // - // The source will be the navigation controller doing the commit. The - // details will be NavigationController::LoadCommittedDetails. - NAV_ENTRY_COMMITTED, - - // Indicates that the NavigationController given in the Source has - // decreased its back/forward list count by removing entries from either - // the front or back of its list. This is usually the result of going back - // and then doing a new navigation, meaning all the "forward" items are - // deleted. - // - // This normally happens as a result of a new navigation. It will be - // followed by a NAV_ENTRY_COMMITTED message for the new page that - // caused the pruning. It could also be a result of removing an item from - // the list to fix up after interstitials. - // - // The details are NavigationController::PrunedDetails. - NAV_LIST_PRUNED, - - // Indicates that a NavigationEntry has changed. The source will be the - // NavigationController that owns the NavigationEntry. The details will be - // a NavigationController::EntryChangedDetails struct. - // - // This will NOT be sent on navigation, interested parties should also - // listen for NAV_ENTRY_COMMITTED to handle that case. This will be - // sent when the entry is updated outside of navigation (like when a new - // title comes). - NAV_ENTRY_CHANGED, - - // Other load-related (not from NavigationController) ---------------------- - - // Corresponds to ViewHostMsg_DocumentOnLoadCompletedInMainFrame. The source - // is the TabContents and the details the page_id. - LOAD_COMPLETED_MAIN_FRAME, - - // A content load is starting. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // is occurring. No details are expected for this notification. - LOAD_START, - - // A content load has stopped. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // is occurring. Details in the form of a LoadNotificationDetails object - // are optional. - LOAD_STOP, - - // Content was loaded from an in-memory cache. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // occurred. Details in the form of a LoadFromMemoryCacheDetails object - // are provided. - LOAD_FROM_MEMORY_CACHE, - - // A provisional content load has failed with an error. The source will be - // a Source<NavigationController> corresponding to the tab in which the - // load occurred. Details in the form of a ProvisionalLoadDetails object - // are provided. - FAIL_PROVISIONAL_LOAD_WITH_ERROR, - - // A response has been received for a resource request. The source will be - // a Source<RenderViewHostDelegate> corresponding to the tab in which the - // request was issued. Details in the form of a ResourceRequestDetails - // object are provided. - RESOURCE_RESPONSE_STARTED, - - // A redirect was received while requesting a resource. The source will be - // a Source<RenderViewHostDelegate> corresponding to the tab in which the - // request was issued. Details in the form of a ResourceRedirectDetails - // are provided. - RESOURCE_RECEIVED_REDIRECT, - - // A new window is created in response to a request from a renderer. The - // source will be a Source<TabContents> corresponding to the tab the - // request originates from. Details in the form of a - // ViewHostMsg_CreateWindow_Params object are provided. - CREATING_NEW_WINDOW, - - // A new window was requested but was not created. The source will be a - // Source<TabContents> corresponding to the tab the request originated from. - // Details are the ViewHostMsg_CreateWindow_Params object that were used in - // the request. - CREATING_NEW_WINDOW_CANCELLED, - - // SSL --------------------------------------------------------------------- - - // Updating the SSL security indicators (the lock icon and such) proceeds - // in two phases: - // - // 1) The internal SSL state for a host or tab changes. When this happens, - // the SSLManager broadcasts an SSL_INTERNAL_STATE_CHANGED notification. - // - // 2) The SSLManager for each tab receives this notification and might or - // might not update the navigation entry for its tab, depending on - // whether the change in state affects that tab. If the SSLManager does - // change the navigation entry, then the SSLManager broadcasts an - // SSL_VISIBLE_STATE_CHANGED notification to the user interface can - // redraw properly. - - // The SSL state of a page has changed in some visible way. For example, - // if an insecure resource is loaded on a secure page. Note that a - // toplevel load commit will also update the SSL state (since the - // NavigationEntry is new) and this message won't always be sent in that - // case. Listen to this notification if you need to refresh SSL-related UI - // elements. - // - // There is no source or details. - SSL_VISIBLE_STATE_CHANGED, - - // The SSL state of the browser has changed in some internal way. For - // example, the user might have explicitly allowed some broken certificate - // or a secure origin might have included some insecure content. Listen to - // this notifiation if you need to keep track of our internal SSL state. - // - // The source will be the navigation controller associated with the state - // change. There are no details. - SSL_INTERNAL_STATE_CHANGED, - - // The user accepted or dismissed a SSL client authentication request. - // The source is a Source<SSLClientAuthHandler>. Details is a - // SSLClientAuthNotificationDetails which records specifies which - // SSLCertRequestInfo the request was for and which X509Certificate was - // selected (if any). - SSL_CLIENT_AUTH_CERT_SELECTED, - - // Views ------------------------------------------------------------------- - - // Notification that a view was removed from a view hierarchy. The source - // is the view, the details is the parent view. - VIEW_REMOVED, - - // Browser-window ---------------------------------------------------------- - - // This message is sent after a window has been opened. The source is a - // Source<Browser> containing the affected Browser. No details are - // expected. - BROWSER_OPENED, - - // This message is sent soon after BROWSER_OPENED, and indicates that - // the Browser's |window_| is now non-NULL. The source is a Source<Browser> - // containing the affected Browser. No details are expected. - BROWSER_WINDOW_READY, - - // This message is sent when a browser is closing. The source is a - // Source<Browser> containing the affected Browser. Details is a boolean - // that if true indicates that the application will be closed as a result of - // this browser window closure (i.e. this was the last opened browser - // window on win/linux). This is sent prior to BROWSER_CLOSED, and may be - // sent more than once for a particular browser. - BROWSER_CLOSING, - - // This message is sent after a window has been closed. The source is a - // Source<Browser> containing the affected Browser. Details is a boolean - // that if true indicates that the last browser window has closed - this - // does not indicate that the application is exiting (observers should - // listen for APP_TERMINATING if they want to detect when the application - // will shut down). Note that the boolean pointed to by details is only - // valid for the duration of this call. - BROWSER_CLOSED, - - // This message is sent when the last window considered to be an - // "application window" has been closed. Dependent/dialog/utility windows - // can use this as a way to know that they should also close. No source or - // details are passed. - ALL_APPWINDOWS_CLOSED, - -#if defined(OS_MACOSX) - // This message is sent when the application is made active (Mac OS X only - // at present). No source or details are passed. - APP_ACTIVATED, -#endif - - // This message is sent when the application is terminating (the last - // browser window has shutdown as part of an explicit user-initiated exit, - // or the user closed the last browser window on Windows/Linux and there are - // no BackgroundContents keeping the browser running). No source or details - // are passed. - APP_TERMINATING, - -#if defined(OS_MACOSX) - // This notification is sent when the app has no key window, such as when - // all windows are closed but the app is still active. No source or details - // are provided. - NO_KEY_WINDOW, -#endif - - // This is sent when the user has chosen to exit the app, but before any - // browsers have closed. This is sent if the user chooses to exit - // (via exit menu item or keyboard shortcut) or to restart the process - // (such as in flags page), not if Chrome exists by some other means - // (such as the user closing the last window). Note that receiving this - // notification does not necessarily mean the process will exit - // because the shutdown process can be cancelled by unload handler. - // Use APP_TERMINATING for such needs. - // The source and details are unspecified. - APP_EXITING, - - // Indicates that a top window has been closed. The source is the HWND - // that was closed, no details are expected. - WINDOW_CLOSED, - - // Indicates that a devtools window is closing. The source is the Profile* - // and the details is the inspected RenderViewHost*. - DEVTOOLS_WINDOW_CLOSING, - - // Sent when an info bubble has been created but not yet shown. The source - // is the InfoBubble. - INFO_BUBBLE_CREATED, - - // Sent when the language (English, French...) for a page has been detected. - // The details Details<std::string> contain the ISO 639-1 language code and - // the source is Source<TabContents>. - TAB_LANGUAGE_DETERMINED, - - // Sent when a page has been translated. The source is the tab for that page - // (Source<TabContents>) and the details are the language the page was - // originally in and the language it was translated to - // (std::pair<std::string, std::string>). - PAGE_TRANSLATED, - - // Sent after the renderer returns a snapshot of tab contents. - // The source (Source<TabContentsWrapper>) is the RenderViewHost for which - // the snapshot was generated and the details (Details<const SkBitmap>) is - // the actual snapshot. - TAB_SNAPSHOT_TAKEN, - - // The user has changed the browser theme. The source is a - // Source<ThemeService>. There are no details. - BROWSER_THEME_CHANGED, - - // Sent when the renderer returns focus to the browser, as part of focus - // traversal. The source is the browser, there are no details. - FOCUS_RETURNED_TO_BROWSER, - - // Application-modal dialogs ----------------------------------------------- - - // Sent after an application-modal dialog has been shown. The source - // is the dialog. - APP_MODAL_DIALOG_SHOWN, - - // Tabs -------------------------------------------------------------------- - - // Sent when a tab is added to a TabContentsDelegate. The source is the - // TabContentsDelegate and the details is the TabContents. - TAB_ADDED, - - // This notification is sent after a tab has been appended to the tab_strip. - // The source is a Source<TabContentsWrapper> of the tab being added. There - // are no details. - TAB_PARENTED, - - // This message is sent before a tab has been closed. The source is a - // Source<NavigationController> with a pointer to the controller for the - // closed tab. No details are expected. - // - // See also TAB_CLOSED. - TAB_CLOSING, - - // Notification that a tab has been closed. The source is the - // NavigationController with no details. - TAB_CLOSED, - - // This notification is sent when a render view host has connected to a - // renderer process. The source is a Source<TabContents> with a pointer to - // the TabContents. A TAB_CONTENTS_DISCONNECTED notification is - // guaranteed before the source pointer becomes junk. No details are - // expected. - TAB_CONTENTS_CONNECTED, - - // This notification is sent when a TabContents swaps its render view host - // with another one, possibly changing processes. The source is a - // Source<TabContents> with a pointer to the TabContents. A - // TAB_CONTENTS_DISCONNECTED notification is guaranteed before the - // source pointer becomes junk. No details are expected. - TAB_CONTENTS_SWAPPED, - - // This message is sent after a TabContents is disconnected from the - // renderer process. The source is a Source<TabContents> with a pointer to - // the TabContents (the pointer is usable). No details are expected. - TAB_CONTENTS_DISCONNECTED, - - // This notification is sent after TabContents' title is updated. The source - // is a Source<TabContents> with a pointer to the TabContents. The details - // is a Details<TitleUpdatedDetails> that contains more information. - TAB_CONTENTS_TITLE_UPDATED, - - // This message is sent when a new InfoBar has been added to a - // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a - // pointer to the TabContentsWrapper the InfoBar was added to. The details - // is a Details<InfoBarDelegate> with a pointer to the delegate that was - // added. - TAB_CONTENTS_INFOBAR_ADDED, - - // This message is sent when an InfoBar is about to be removed from a - // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a - // pointer to the TabContentsWrapper the InfoBar was removed from. The - // details is a Details<std::pair<InfoBarDelegate*, bool> > with a pointer - // to the removed delegate and whether the removal should be animated. - TAB_CONTENTS_INFOBAR_REMOVED, - - // This message is sent when an InfoBar is replacing another infobar in a - // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a - // pointer to the TabContentsWrapper the InfoBar was removed from. The - // details is a Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> > with - // pointers to the old and new delegates, respectively. - TAB_CONTENTS_INFOBAR_REPLACED, - - // This is sent when an externally hosted tab is created. The details - // contain the ExternalTabContainer that contains the tab - EXTERNAL_TAB_CREATED, - - // This is sent when an externally hosted tab is closed. No details are - // expected. - EXTERNAL_TAB_CLOSED, - - // Indicates that the new page tab has finished loading. This is used for - // performance testing to see how fast we can load it after startup, and is - // only called once for the lifetime of the browser. The source is unused. - // Details is an integer: the number of milliseconds elapsed between - // starting and finishing all painting. - INITIAL_NEW_TAB_UI_LOAD, - - // Used to fire notifications about how long various events took to - // complete. E.g., this is used to get more fine grained timings from the - // new tab page. Details is a MetricEventDurationDetails. - METRIC_EVENT_DURATION, - - // This notification is sent when a TabContents is being hidden, e.g. due - // to switching away from this tab. The source is a Source<TabContents>. - TAB_CONTENTS_HIDDEN, - - // This notification is sent when a TabContents is being destroyed. Any - // object holding a reference to a TabContents can listen to that - // notification to properly reset the reference. The source is a - // Source<TabContents>. - TAB_CONTENTS_DESTROYED, - - // This notification is sent when TabContents::SetAppExtension is invoked. - // The source is the ExtensionTabHelper SetAppExtension was invoked on. - TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, - - // A RenderViewHost was created for a TabContents. The source is the - // associated TabContents, and the details is the RenderViewHost - // pointer. - RENDER_VIEW_HOST_CREATED_FOR_TAB, - - // Notification than an interstitial has become associated with a tab. The - // source is the TabContents, the details not used. - INTERSTITIAL_ATTACHED, - - // Stuff inside the tabs --------------------------------------------------- - - // This message is sent after a constrained window has been closed. The - // source is a Source<ConstrainedWindow> with a pointer to the closed child - // window. (The pointer isn't usable, except for identification.) No - // details are expected. - CWINDOW_CLOSED, - - // Indicates that a RenderProcessHost was created and its handle is now - // available. The source will be the RenderProcessHost that corresponds to - // the process. - RENDERER_PROCESS_CREATED, - - // Indicates that a RenderProcessHost is destructing. The source will be the - // RenderProcessHost that corresponds to the process. - RENDERER_PROCESS_TERMINATED, - - // Indicates that a render process is starting to exit, such that it should - // not be used for future navigations. The source will be the - // RenderProcessHost that corresponds to the process. - RENDERER_PROCESS_CLOSING, - - // Indicates that a render process was closed (meaning it exited, but the - // RenderProcessHost might be reused). The source will be the corresponding - // RenderProcessHost. The details will be a RendererClosedDetails struct. - // This may get sent along with RENDERER_PROCESS_TERMINATED. - RENDERER_PROCESS_CLOSED, - - // Indicates that a render process has become unresponsive for a period of - // time. The source will be the RenderWidgetHost that corresponds to the - // hung view, and no details are expected. - RENDERER_PROCESS_HANG, - - // This is sent to notify that the RenderViewHost displayed in a - // TabContents has changed. Source is the TabContents for which the change - // happened, details is the previous RenderViewHost (can be NULL when the - // first RenderViewHost is set). - RENDER_VIEW_HOST_CHANGED, - - // Indicates that the render view host has received an accessibility tree - // update, either partial or full, from the render view. The source is the - // RenderViewHost, the details are not used. - RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, - - // This is sent when a RenderWidgetHost is being destroyed. The source is - // the RenderWidgetHost, the details are not used. - RENDER_WIDGET_HOST_DESTROYED, - - // Sent when the widget is about to paint. The source is the - // RenderWidgetHost, the details are not used. - RENDER_WIDGET_HOST_WILL_PAINT, - - // Sent after the widget has painted. The source is the RenderWidgetHost, - // the details are not used. - RENDER_WIDGET_HOST_DID_PAINT, - - // This notifies the observer that a PaintAtSizeACK was received. The source - // is the RenderWidgetHost, the details are an instance of - // RenderWidgetHost::PaintAtSizeAckDetails. - RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, - - // This notifies the observer that a HandleInputEventACK was received. The - // source is the RenderWidgetHost, the details are the type of event - // received. - // Note: The RenderWidgetHost may be deallocated at this point. - // Used only in testing. - RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, - - // Sent from RenderViewHost constructor. The source is the RenderViewHost, - // the details unused. - RENDER_VIEW_HOST_CREATED, - - // Sent from ~RenderViewHost. The source is the RenderViewHost, the details - // unused. - RENDER_VIEW_HOST_DELETED, - - // Sent from RenderViewHost::ClosePage. The hosted RenderView has - // processed the onbeforeunload handler and is about to be sent a - // ViewMsg_ClosePage message to complete the tear-down process. The source - // is the RenderViewHost sending the message, and no details are provided. - // Note: This message is not sent in response to RenderView closure - // initiated by window.close(). - RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, - - // This notifies the observer that the drag operation ack in a drag and - // drop operation was received. The source is the RenderViewHost. - // Note: Used only in testing. - RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, - - // Indicates a RenderWidgetHost has been hidden or restored. The source is - // the RWH whose visibility changed, the details is a bool set to true if - // the new state is "visible." - RENDER_WIDGET_VISIBILITY_CHANGED, - - // Notification from TabContents that we have received a response from the - // renderer in response to a dom automation controller action. - DOM_OPERATION_RESPONSE, - - // Sent when the bookmark bubble hides. The source is the profile, the - // details unused. - BOOKMARK_BUBBLE_HIDDEN, - - // This notification is sent when the result of a find-in-page search is - // available with the browser process. The source is a Source<TabContents> - // with a pointer to the TabContents. Details encompass a - // FindNotificationDetail object that tells whether the match was found or - // not found. - FIND_RESULT_AVAILABLE, - - // This is sent when the users preference for when the bookmark bar should - // be shown changes. The source is the profile, and the details are - // NoDetails. - BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, - - // Sent just before the installation confirm dialog is shown. The source - // is the ExtensionInstallUI, the details are NoDetails. - EXTENSION_WILL_SHOW_CONFIRM_DIALOG, - - // Used to monitor web cache usage by notifying whenever the - // CacheManagerHost observes new UsageStats. The source will be the - // RenderProcessHost that corresponds to the new statistics. Details are a - // UsageStats object sent by the renderer, and should be copied - ptr not - // guaranteed to be valid after the notification. - WEB_CACHE_STATS_OBSERVED, - - // The focused element inside a page has changed. The source is the - // TabContents containing the render view host for the page. The details is - // a Details<const bool> that indicates whether or not an editable node was - // focused. - FOCUS_CHANGED_IN_PAGE, - - // Notification posted from ExecuteJavascriptInWebFrameNotifyResult. The - // source is the RenderViewHost ExecuteJavascriptInWebFrameNotifyResult was - // invoked on. The details are a std::pair<int, Value*> with the int giving - // the id returned from ExecuteJavascriptInWebFrameNotifyResult and the - // Value the results of the javascript expression. The Value is owned by - // RenderViewHost and may be a Null Value. - EXECUTE_JAVASCRIPT_RESULT, - - // BackgroundContents ------------------------------------------------------ - - // A new background contents was opened by script. The source is the parent - // profile and the details are BackgroundContentsOpenedDetails. - BACKGROUND_CONTENTS_OPENED, - - // The background contents navigated to a new location. The source is the - // parent Profile, and the details are the BackgroundContents that was - // navigated. - BACKGROUND_CONTENTS_NAVIGATED, - - // The background contents were closed by someone invoking window.close() - // or the parent application was uninstalled. - // The source is the parent profile, and the details are the - // BackgroundContents. - BACKGROUND_CONTENTS_CLOSED, - - // The background contents is being deleted. The source is the - // parent Profile, and the details are the BackgroundContents being deleted. - BACKGROUND_CONTENTS_DELETED, - - // The background contents has crashed. The source is the parent Profile, - // and the details are the BackgroundContents. - BACKGROUND_CONTENTS_TERMINATED, - - // Child Processes --------------------------------------------------------- - - // This notification is sent when a child process host has connected to a - // child process. There is no usable source, since it is sent from an - // ephemeral task; register for AllSources() to receive this notification. - // The details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_HOST_CONNECTED, - - // This message is sent after a ChildProcessHost is disconnected from the - // child process. There is no usable source, since it is sent from an - // ephemeral task; register for AllSources() to receive this notification. - // The details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_HOST_DISCONNECTED, - - // This message is sent when a child process disappears - // unexpectedly as a result of a crash. There is no usable - // source, since it is sent from an ephemeral task; register for - // AllSources() to receive this notification. The details are in - // a Details<ChildProcessInfo>. - CHILD_PROCESS_CRASHED, - - // This message is sent when a child process disappears - // unexpectedly as a result of a termination signal. There is no - // usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The - // details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_WAS_KILLED, - - // This message indicates that an instance of a particular child was - // created in a page. (If one page contains several regions rendered by - // the same child, this notification will occur once for each region - // during the page load.) - // - // There is no usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The details are - // in a Details<ChildProcessInfo>. - CHILD_INSTANCE_CREATED, - - // This is sent when network interception is disabled for a plugin, or the - // plugin is unloaded. This should only be sent/received on the browser IO - // thread or the plugin thread. The source is the plugin that is disabling - // interception. No details are expected. - CHROME_PLUGIN_UNLOADED, - - // Sent by the PluginUpdater when there is a change of plugin - // enable/disable status. - PLUGIN_ENABLE_STATUS_CHANGED, - - // This is sent when a login prompt is shown. The source is the - // Source<NavigationController> for the tab in which the prompt is shown. - // Details are a LoginNotificationDetails which provide the LoginHandler - // that should be given authentication. - AUTH_NEEDED, - - // This is sent when authentication credentials have been supplied (either - // by the user or by an automation service), but before we've actually - // received another response from the server. The source is the - // Source<NavigationController> for the tab in which the prompt was shown. - // Details are an AuthSuppliedLoginNotificationDetails which provide the - // LoginHandler that should be given authentication as well as the supplied - // username and password. - AUTH_SUPPLIED, - - // This is sent when an authentication request has been dismissed without - // supplying credentials (either by the user or by an automation service). - // The source is the Source<NavigationController> for the tab in which the - // prompt was shown. Details are a LoginNotificationDetails which provide - // the LoginHandler that should be cancelled. - AUTH_CANCELLED, - - // Saved Pages ------------------------------------------------------------- - - // Sent when a SavePackage finishes successfully. The source is the - // SavePackage, and Details are a GURL containing address of downloaded - // page. - SAVE_PACKAGE_SUCCESSFULLY_FINISHED, - - // History ----------------------------------------------------------------- - - // Sent when a history service is created on the main thread. This is sent - // after history is created, but before it has finished loading. Use - // HISTORY_LOADED is you need to know when loading has completed. - // The source is the profile that the history service belongs to, and the - // details is the pointer to the newly created HistoryService object. - HISTORY_CREATED, - - // Sent when a history service has finished loading. The source is the - // profile that the history service belongs to, and the details is the - // HistoryService. - HISTORY_LOADED, - - // Sent when a URL that has been typed has been added or modified. This is - // used by the in-memory URL database (used by autocomplete) to track - // changes to the main history system. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLsModifiedDetails that lists the modified or - // added URLs. - HISTORY_TYPED_URLS_MODIFIED, - - // Sent when the user visits a URL. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLVisitedDetails. - HISTORY_URL_VISITED, - - // Sent when one or more URLs are deleted. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLsDeletedDetails that lists the deleted URLs. - HISTORY_URLS_DELETED, - - // Sent when a keyword search term is updated. The source is the Profile and - // the details are history::KeywordSearchTermDetails - HISTORY_KEYWORD_SEARCH_TERM_UPDATED, - - // Sent by history when the favicon of a URL changes. The source is the - // profile, and the details is history::FaviconChangeDetails (see - // history_notifications.h). - FAVICON_CHANGED, - - // Sent by FaviconTabHelper when a tab's favicon has been successfully - // updated. - FAVICON_UPDATED, - - // Sent after an incognito profile has been created. The details are none - // and the source is the new profile. - OTR_PROFILE_CREATED, - - // Sent before a Profile is destroyed. The details are - // none and the source is a Profile*. - PROFILE_DESTROYED, - - // TopSites ---------------------------------------------------------------- - - // Sent by TopSites when it finishes loading. The source is the profile the - // details the TopSites. - TOP_SITES_LOADED, - - // Sent by TopSites when it has finished updating its most visited URLs - // cache after querying the history service. The source is the TopSites and - // the details a CancelableRequestProvider::Handle from the history service - // query. - // Used only in testing. - TOP_SITES_UPDATED, - - // Sent by TopSites when the either one of the most visited urls changed, or - // one of the images changes. The source is the TopSites, the details not - // used. - TOP_SITES_CHANGED, - - // Thumbnails--------------------------------------------------------------- - - // Sent by the ThumbnailGenerator whenever a render widget host - // updates its backing store. The source is the - // ThumbnailGenerator, and the details are the RenderWidgetHost - // that notified the ThumbnailGenerator that its backing store was - // updated. - THUMBNAIL_GENERATOR_SNAPSHOT_CHANGED, - - // Bookmarks --------------------------------------------------------------- - - // Sent when the starred state of a URL changes. A URL is starred if there - // is at least one bookmark for it. The source is a Profile and the details - // is history::URLsStarredDetails that contains the list of URLs and - // whether they were starred or unstarred. - URLS_STARRED, - - // Sent when the bookmark bar model finishes loading. This source is the - // Profile, and the details aren't used. - BOOKMARK_MODEL_LOADED, - - // Sent when the bookmark bubble is shown for a particular URL. The source - // is the profile, the details the URL. - BOOKMARK_BUBBLE_SHOWN, - - // Non-history storage services -------------------------------------------- - - // Notification that the TemplateURLService has finished loading from the - // database. The source is the TemplateURLService, and the details are - // NoDetails. - TEMPLATE_URL_SERVICE_LOADED, - - // Sent when a TemplateURL is removed from the model. The source is the - // Profile, and the details the id of the TemplateURL being removed. - TEMPLATE_URL_REMOVED, - - // Notification triggered when a web application has been installed or - // uninstalled. Any application view should reload its data. The source is - // the profile. No details are provided. - WEB_APP_INSTALL_CHANGED, - - // This is sent to a pref observer when a pref is changed. The source is the - // PrefService and the details a std::string of the changed path. - PREF_CHANGED, - - // This is broadcast after the preference subsystem has completed - // asynchronous initalization of a PrefService. - PREF_INITIALIZATION_COMPLETED, - - // Sent when a default request context has been created, so calling - // Profile::GetDefaultRequestContext() will not return NULL. This is sent - // on the thread where Profile::GetRequestContext() is first called, which - // should be the UI thread. - DEFAULT_REQUEST_CONTEXT_AVAILABLE, - - // The state of a web resource has been changed. A resource may have been - // added, removed, or altered. Source is WebResourceService, and the - // details are NoDetails. - PROMO_RESOURCE_STATE_CHANGED, - - // Autocomplete ------------------------------------------------------------ - - // Sent by the autocomplete controller when done. The source is the - // AutocompleteController, the details not used. - AUTOCOMPLETE_CONTROLLER_RESULT_READY, - - // This is sent when an item of the Omnibox popup is selected. The source - // is the profile. - OMNIBOX_OPENED_URL, - - // Sent by the omnibox when it is destroyed. - OMNIBOX_DESTROYED, - - // Sent by the omnibox when it is focused. - OMNIBOX_FOCUSED, - - // Sent when the main Google URL has been updated. Some services cache - // this value and need to update themselves when it changes. See - // google_util::GetGoogleURLAndUpdateIfNecessary(). - GOOGLE_URL_UPDATED, - - // Printing ---------------------------------------------------------------- - - // Notification from PrintJob that an event occurred. It can be that a page - // finished printing or that the print job failed. Details is - // PrintJob::EventDetails. Source is a PrintJob. - PRINT_JOB_EVENT, - - // Sent when a PrintJob has been released. - // Source is the TabContentsWrapper that holds the print job. - PRINT_JOB_RELEASED, - - // Shutdown ---------------------------------------------------------------- - - // Sent on the browser IO thread when an net::URLRequestContext is released - // by its owning Profile. The source is a pointer to the - // net::URLRequestContext. - URL_REQUEST_CONTEXT_RELEASED, - - // Sent when WM_ENDSESSION has been received, after the browsers have been - // closed but before browser process has been shutdown. The source/details - // are all source and no details. - SESSION_END, - - // User Scripts ------------------------------------------------------------ - - // Sent when there are new user scripts available. The details are a - // pointer to SharedMemory containing the new scripts. - USER_SCRIPTS_UPDATED, - - // User Style Sheet -------------------------------------------------------- - - // Sent when the user style sheet has changed. - USER_STYLE_SHEET_UPDATED, - - // Extensions -------------------------------------------------------------- - - // Sent when a CrxInstaller finishes. Source is the CrxInstaller that - // finished. No details. - 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. - EXTENSIONS_READY, - - // Sent when a new extension is loaded. The details are an Extension, and - // the source is a Profile. - EXTENSION_LOADED, - - // Sent when attempting to load a new extension, but they are disabled. The - // details are an Extension*, and the source is a Profile*. - EXTENSION_UPDATE_DISABLED, - - // Sent when an extension is about to be installed so we can (in the case of - // themes) alert the user with a loading dialog. The source is the download - // manager and the details are the download url. - EXTENSION_READY_FOR_INSTALL, - - // Sent when an extension install turns out to not be a theme. - NO_THEME_DETECTED, - - // Sent when new extensions are installed. The details are an Extension, and - // the source is a Profile. - EXTENSION_INSTALLED, - - // An error occured during extension install. The details are a string with - // details about why the install failed. - EXTENSION_INSTALL_ERROR, - - // Sent when an extension install is not allowed, as indicated by - // PendingExtensionInfo::ShouldAllowInstall. The details are an Extension, - // and the source is a Profile. - EXTENSION_INSTALL_NOT_ALLOWED, - - // Sent when an extension has been uninstalled. The details are - // an UninstalledExtensionInfo struct and the source is a Profile. - EXTENSION_UNINSTALLED, - - // 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. - 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 Profile. - // - // Note that when this notification is sent, ExtensionService has already - // removed the extension from its internal state. - EXTENSION_UNLOADED, - - // Sent after a new ExtensionHost is created. The details are - // an ExtensionHost* and the source is an ExtensionProcessManager*. - EXTENSION_HOST_CREATED, - - // Sent before an ExtensionHost is destroyed. The details are - // an ExtensionHost* and the source is a Profile*. - EXTENSION_HOST_DESTROYED, - - // Sent by an ExtensionHost when it finished its initial page load. - // The details are an ExtensionHost* and the source is a Profile*. - 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*. - EXTENSION_HOST_VIEW_SHOULD_CLOSE, - - // Sent after an extension render process is created and fully functional. - // The details are an ExtensionHost*. - EXTENSION_PROCESS_CREATED, - - // 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. - EXTENSION_PROCESS_TERMINATED, - - // Sent when a background page is ready so other components can load. - EXTENSION_BACKGROUND_PAGE_READY, - - // Sent when a pop-up extension view is ready, so that notification may - // be sent to pending callbacks. Note that this notification is sent - // after all onload callbacks have been invoked in the main frame. - // The details is the ExtensionHost* hosted within the popup, and the source - // is a Profile*. - EXTENSION_POPUP_VIEW_READY, - - // Sent when a browser action's state has changed. The source is the - // ExtensionAction* that changed. There are no details. - 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. - EXTENSION_PAGE_ACTION_COUNT_CHANGED, - - // Sent when a browser action's visibility has changed. The source is the - // ExtensionPrefs* that changed. The details are a Extension*. - 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 TabContents*. - EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, - - // Sent by an extension to notify the browser about the results of a unit - // test. - EXTENSION_TEST_PASSED, - 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. - 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. - EXTENSION_BOOKMARKS_API_INVOKED, - - // Sent when an omnibox extension has sent back omnibox suggestions. The - // source is the profile, and the details are an ExtensionOmniboxSuggestions - // object. - EXTENSION_OMNIBOX_SUGGESTIONS_READY, - - // Sent when the user accepts the input in an extension omnibox keyword - // session. The source is the profile. - EXTENSION_OMNIBOX_INPUT_ENTERED, - - // Sent when an omnibox extension has updated the default suggestion. The - // source is the profile. - EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, - - // Sent when an extension changes a preference value. The source is the - // profile, and the details are an ExtensionPrefStore::ExtensionPrefDetails - // object. - EXTENSION_PREF_CHANGED, - - // Sent when the extension updater starts checking for updates to installed - // extensions. The source is a Profile, and there are no details. - EXTENSION_UPDATING_STARTED, - - // Sent when the extension updater is finished checking for updates to - // installed extensions. The source is a Profile, and there are no details. - // NOTE: It's possible that there are extension updates still being - // installed by the extension service at the time this notification fires. - EXTENSION_UPDATING_FINISHED, - - // The extension updater found an update and will attempt to download and - // install it. The source is a Profile, and the details are an extension id - // (const std::string). - EXTENSION_UPDATE_FOUND, - - // An installed app changed notification state (added or removed - // notifications). The source is a Profile, and the details are a string - // with the extension id of the app. - APP_NOTIFICATION_STATE_CHANGED, - - // Desktop Notifications --------------------------------------------------- - - // This notification is sent when a balloon is connected to a renderer - // process to render the balloon contents. The source is a - // Source<BalloonHost> with a pointer to the the balloon. A - // NOTIFY_BALLOON_DISCONNECTED is guaranteed before the source pointer - // becomes junk. No details expected. - NOTIFY_BALLOON_CONNECTED, - - // This message is sent after a balloon is disconnected from the renderer - // process. The source is a Source<BalloonHost> with a pointer to the - // balloon host (the pointer is usable). No details are expected. - NOTIFY_BALLOON_DISCONNECTED, - - // Web Database Service ---------------------------------------------------- - - // This notification is sent whenever autofill entries are - // changed. The detail of this notification is a list of changes - // represented by a vector of AutofillChange. Each change - // includes a change type (add, update, or remove) as well as the - // key of the entry that was affected. - AUTOFILL_ENTRIES_CHANGED, - - // Sent when an AutofillProfile has been added/removed/updated in the - // WebDatabase. The detail is an AutofillProfileChange. - AUTOFILL_PROFILE_CHANGED, - - // Sent when an Autofill CreditCard has been added/removed/updated in the - // WebDatabase. The detail is an AutofillCreditCardChange. - AUTOFILL_CREDIT_CARD_CHANGED, - - // This notification is sent whenever the web database service has finished - // loading the web database. No details are expected. - WEB_DATABASE_LOADED, - - // Purge Memory ------------------------------------------------------------ - - // Sent on the IO thread when the system should try to reduce the amount of - // memory in use, no source or details are passed. See memory_purger.h .cc. - PURGE_MEMORY, - - // Upgrade notifications --------------------------------------------------- - - // Sent when Chrome detects that it has been upgraded behind the scenes. - // NOTE: The detection mechanism is asynchronous, so this event may arrive - // quite some time after the upgrade actually happened. No details are - // expected. - UPGRADE_DETECTED, - - // Sent when Chrome believes an update has been installed and available for - // long enough with the user shutting down to let it take effect. See - // upgrade_detector.cc for details on how long it waits. No details are - // expected. - UPGRADE_RECOMMENDED, - - // Software incompatibility notifications ---------------------------------- - - // Sent when Chrome has finished compiling the list of loaded modules (and - // other modules of interest). No details are expected. - MODULE_LIST_ENUMERATED, - - // Sent when Chrome is done scanning the module list and when the user has - // acknowledged the module incompatibility. No details are expected. - MODULE_INCOMPATIBILITY_BADGE_CHANGE, - - // Accessibility Notifications --------------------------------------------- - - // Notification that a window in the browser UI (not the web content) - // was opened, for propagating to an accessibility extension. - // Details will be an AccessibilityWindowInfo. - ACCESSIBILITY_WINDOW_OPENED, - - // Notification that a window in the browser UI was closed. - // Details will be an AccessibilityWindowInfo. - ACCESSIBILITY_WINDOW_CLOSED, - - // Notification that a control in the browser UI was focused. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_CONTROL_FOCUSED, - - // Notification that a control in the browser UI had its action taken, - // like pressing a button or toggling a checkbox. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_CONTROL_ACTION, - - // Notification that text box in the browser UI had text change. - // Details will be an AccessibilityControlInfo. - ACCESSIBILITY_TEXT_CHANGED, - - // Notification that a pop-down menu was opened, for propagating - // to an accessibility extension. - // Details will be an AccessibilityMenuInfo. - ACCESSIBILITY_MENU_OPENED, - - // Notification that a pop-down menu was closed, for propagating - // to an accessibility extension. - // Details will be an AccessibilityMenuInfo. - ACCESSIBILITY_MENU_CLOSED, - - // Content Settings -------------------------------------------------------- - - // Sent when content settings change. The source is a HostContentSettings - // object, the details are ContentSettingsNotificationsDetails. - CONTENT_SETTINGS_CHANGED, - - // Sent when the collect cookies dialog is shown. The source is a - // TabSpecificContentSettings object, there are no details. - COLLECTED_COOKIES_SHOWN, - - // Sent when the default setting for desktop notifications has changed. - // The source is the DesktopNotificationService, the details are None. - DESKTOP_NOTIFICATION_DEFAULT_CHANGED, - - // Sent when a non-default setting in the the notification content settings - // map has changed. The source is the DesktopNotificationService, the - // details are None. - DESKTOP_NOTIFICATION_SETTINGS_CHANGED, - - // Sent when the geolocation settings change. The source is the - // GeolocationContentSettingsMap object, the details are - // ContentSettingsNotificationsDetails. - GEOLOCATION_SETTINGS_CHANGED, - - // Sent when content settings change for a tab. The source is a TabContents - // object, the details are None. - TAB_CONTENT_SETTINGS_CHANGED, - - // Sync -------------------------------------------------------------------- - - // Sent when the syncer is blocked configuring. - SYNC_CONFIGURE_BLOCKED, - - // The sync service has started the configuration process. - SYNC_CONFIGURE_START, - - // The sync service is finished the configuration process. - SYNC_CONFIGURE_DONE, - - // The session service has been saved. This notification type is only sent - // if there were new SessionService commands to save, and not for no-op save - // operations. - SESSION_SERVICE_SAVED, - - // A foreign session has been updated. If a new tab page is open, the - // foreign session handler needs to update the new tab page's foreign - // session data. - FOREIGN_SESSION_UPDATED, - - // Foreign sessions has been disabled. New tabs should not display foreign - // session data. - FOREIGN_SESSION_DISABLED, - - // Cookies ----------------------------------------------------------------- - - // Sent when a cookie changes. The source is a Profile object, the details - // are a ChromeCookieDetails object. - COOKIE_CHANGED, - - // Sidebar ----------------------------------------------------------------- - - // Sent when the sidebar state is changed. - // The source is a SidebarManager instance, the details are the changed - // SidebarContainer object. - SIDEBAR_CHANGED, - - // Token Service ----------------------------------------------------------- - - // When the token service has a new token available for a service, one of - // these notifications is issued per new token. - // The source is a TokenService on the Profile. The details are a - // TokenAvailableDetails object. - TOKEN_AVAILABLE, - - // When there aren't any additional tokens left to load, this notification - // is sent. - // The source is a TokenService on the profile. There are no details. - TOKEN_LOADING_FINISHED, - - // If a token request failed, one of these is issued per failed request. - // The source is a TokenService on the Profile. The details are a - // TokenRequestFailedDetails object. - TOKEN_REQUEST_FAILED, - - // When a service has a new token they got from a frontend that the - // TokenService should know about, fire this notification. The details - // are a TokenAvailableDetails object. - TOKEN_UPDATED, - - // Sent when a user signs into Google services such as sync. - // The source is the Profile. The details are a GoogleServiceSignin object. - GOOGLE_SIGNIN_SUCCESSFUL, - - // Sent when a user fails to sign into Google services such as sync. - // The source is the Profile. The details are a GoogleServiceAuthError - // object. - GOOGLE_SIGNIN_FAILED, - - // Autofill Notifications -------------------------------------------------- - - // Sent when a popup with Autofill suggestions is shown in the renderer. - // The source is the corresponding RenderViewHost. There are not details. - AUTOFILL_DID_SHOW_SUGGESTIONS, - - // Sent when a form is previewed or filled with Autofill suggestions. - // The source is the corresponding RenderViewHost. There are not details. - AUTOFILL_DID_FILL_FORM_DATA, - - // Download Notifications -------------------------------------------------- - - // Sent when a download is initiated. It is possible that the download will - // not actually begin due to the DownloadRequestLimiter cancelling it - // prematurely. - // The source is the corresponding RenderViewHost. There are no details. - DOWNLOAD_INITIATED, - - // Sent when a page generation to MHTML has finished. - // The source is the corresponding RenderViewHost. The details is a - // MHTMLGenerationManager::NotificationDetails. - MHTML_GENERATED, - - // Misc -------------------------------------------------------------------- - -#if defined(OS_CHROMEOS) - // Sent when a chromium os user logs in. - LOGIN_USER_CHANGED, - - // Sent when user image is updated. - LOGIN_USER_IMAGE_CHANGED, - - // Sent when a chromium os user attempts to log in. The source is - // all and the details are AuthenticationNotificationDetails. - LOGIN_AUTHENTICATION, - - // Sent when a panel state changed. - PANEL_STATE_CHANGED, - - // Sent when the window manager's layout mode has changed. - LAYOUT_MODE_CHANGED, - - // Sent when the wizard's content view is destroyed. The source and details - // are not used. - WIZARD_CONTENT_VIEW_DESTROYED, - - // Sent when the screen lock state has changed. The source is - // ScreenLocker and the details is a bool specifing that the - // screen is locked. When details is a false, the source object - // is being deleted, so the receiver shouldn't use the screen locker - // object. - SCREEN_LOCK_STATE_CHANGED, - - // Sent when the network state has changed on UI thread. - // The source is AllSources and the details is NetworkStateDetails defined - // in chrome/browser/chromeos/network_state_notifier.h. - // TODO(oshima): Port this to all platforms. - NETWORK_STATE_CHANGED, - - // Sent when an attempt to acquire the public key of the owner of a chromium - // os device has succeeded. - OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, - - // Sent when an attempt to acquire the public key of the owner of a chromium - // os device has failed. - OWNER_KEY_FETCH_ATTEMPT_FAILED, - - // Sent after UserManager checked ownership status of logged in user. - OWNERSHIP_CHECKED, - - // This is sent to a ChromeOS settings observer when a system setting is - // changed. The source is the CrosSettings and the details a std::string of - // the changed setting. - SYSTEM_SETTING_CHANGED, - - // Sent by SIM unlock dialog when it has finished with the process of - // updating RequirePin setting. RequirePin setting might have been changed - // to a new value or update might have been canceled. - // In either case notification is sent and details contain a bool - // that represents current value. - REQUIRE_PIN_SETTING_CHANGE_ENDED, - - // Sent by SIM unlock dialog when it has finished the EnterPin or - // EnterPuk dialog, either because the user cancelled, or entered a - // PIN or PUK. - ENTER_PIN_ENDED, - -#endif - - // Sent before the repost form warning is brought up. - // The source is a NavigationController. - REPOST_WARNING_SHOWN, - -#if defined(TOOLKIT_VIEWS) - // Sent when a bookmark's context menu is shown. Used to notify - // tests that the context menu has been created and shown. - BOOKMARK_CONTEXT_MENU_SHOWN, -#endif - - // Sent when the zoom level changes. The source is the HostZoomMap. The - // details is a string of the hostname for which the zoom changed. In case - // of a temporary zoom level change, the details is an empty string. - ZOOM_LEVEL_CHANGED, - - // Sent when the tab's closeable state has changed due to increase/decrease - // in number of tabs in browser or increase/decrease in number of browsers. - // Details<bool> contain the closeable flag while source is AllSources. - // This is only sent from ChromeOS's TabCloseableStateWatcher. - TAB_CLOSEABLE_STATE_CHANGED, - - // Sent each time the InstantController is updated. - INSTANT_CONTROLLER_UPDATED, - - // Sent each time the InstantController shows the InstantLoader. - INSTANT_CONTROLLER_SHOWN, - - // Sent when the instant loader determines whether the page supports the - // instant API or not. The details is a boolean indicating if the page - // supports instant. The source is not used. - INSTANT_SUPPORT_DETERMINED, - - // Password Store ---------------------------------------------------------- - // This notification is sent whenenever login entries stored in the password - // store are changed. The detail of this notification is a list of changes - // represented by a vector of PasswordStoreChange. Each change includes a - // change type (ADD, UPDATE, or REMOVE) as well as the - // |webkit_glue::PasswordForm|s that were affected. - LOGINS_CHANGED, - - // Sent when the applications in the NTP app launcher have been reordered. - EXTENSION_LAUNCHER_REORDERED, - -#if defined(OS_CHROMEOS) - // Sent when WebSocketProxy started accepting connections. - WEB_SOCKET_PROXY_STARTED, -#endif - - // Sent when a new web store promo has been loaded. - WEB_STORE_PROMO_LOADED, - -#if defined(TOUCH_UI) - // Sent when an API for hiding the keyboard is invoked from JavaScript code. - HIDE_KEYBOARD_INVOKED, - - // Sent when an API for set height of the keyboard is invoked from - // JavaScript code. - SET_KEYBOARD_HEIGHT_INVOKED, - - // Sent when an editable element is touched, such as text box, password - // field, and omnibox. - EDITABLE_ELEMENT_TOUCHED, -#endif - - // Protocol Handler Registry ----------------------------------------------- - // Sent when a ProtocolHandlerRegistry is changed. - PROTOCOL_HANDLER_REGISTRY_CHANGED, - - // Sent when the cached profile info has changed. - PROFILE_CACHED_INFO_CHANGED, - - // Count (must be last) ---------------------------------------------------- - // Used to determine the number of notification types. Not valid as - // a type parameter when registering for or posting notifications. - NOTIFICATION_TYPE_COUNT - }; - - // TODO(erg): Our notification system relies on implicit conversion. - NotificationType(Type v) : value(v) {} // NOLINT - - bool operator==(NotificationType t) const { return value == t.value; } - bool operator!=(NotificationType t) const { return value != t.value; } - - // Comparison to explicit enum values. - bool operator==(Type v) const { return value == v; } - bool operator!=(Type v) const { return value != v; } - - Type value; -}; - -inline bool operator==(NotificationType::Type a, NotificationType b) { - return a == b.value; -} -inline bool operator!=(NotificationType::Type a, NotificationType b) { - return a != b.value; -} - -#endif // CONTENT_COMMON_NOTIFICATION_TYPE_H_ |