summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager_resource_providers.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
commitbfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch)
tree70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/task_manager_resource_providers.cc
parenta814d863440f0a154a7299f2d8b440f405c7700e (diff)
downloadchromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the notification service to derive from the notification observer. This splits that out, so much less of the project should end up including notification_types.h ---Paths modified but not in any changelist: Review URL: http://codereview.chromium.org/19744 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager_resource_providers.cc')
-rw-r--r--chrome/browser/task_manager_resource_providers.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 8576471..c0e94c9 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/resource_message_filter.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/stl_util-inl.h"
#include "chrome/common/gfx/icon_util.h"
@@ -139,11 +140,11 @@ void TaskManagerWebContentsResourceProvider::StartUpdating() {
}
// Then we register for notifications to get new tabs.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_CONNECTED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_CONNECTED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_SWAPPED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_SWAPPED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
NotificationService::AllSources());
}
@@ -153,11 +154,11 @@ void TaskManagerWebContentsResourceProvider::StopUpdating() {
// Then we unregister for notifications to get new tabs.
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_CONNECTED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_CONNECTED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_SWAPPED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_SWAPPED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
NotificationService::AllSources());
// Delete all the resources.
@@ -221,15 +222,15 @@ void TaskManagerWebContentsResourceProvider::Remove(WebContents* web_contents) {
void TaskManagerWebContentsResourceProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_WEB_CONTENTS_CONNECTED:
+ switch (type.value) {
+ case NotificationType::WEB_CONTENTS_CONNECTED:
Add(Source<WebContents>(source).ptr());
break;
- case NOTIFY_WEB_CONTENTS_SWAPPED:
+ case NotificationType::WEB_CONTENTS_SWAPPED:
Remove(Source<WebContents>(source).ptr());
Add(Source<WebContents>(source).ptr());
break;
- case NOTIFY_WEB_CONTENTS_DISCONNECTED:
+ case NotificationType::WEB_CONTENTS_DISCONNECTED:
Remove(Source<WebContents>(source).ptr());
break;
default:
@@ -320,9 +321,9 @@ void TaskManagerPluginProcessResourceProvider::StartUpdating() {
// Register for notifications to get new plugin processes.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
+ service->AddObserver(this, NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
+ service->AddObserver(this, NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED,
NotificationService::AllSources());
// Get the existing plugins
@@ -337,9 +338,10 @@ void TaskManagerPluginProcessResourceProvider::StopUpdating() {
// Unregister for notifications to get new plugin processes.
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
+ service->RemoveObserver(this, NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
+ service->RemoveObserver(this,
+ NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED,
NotificationService::AllSources());
// Delete all the resources.
@@ -354,11 +356,11 @@ void TaskManagerPluginProcessResourceProvider::Observe(
NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED:
+ switch (type.value) {
+ case NotificationType::PLUGIN_PROCESS_HOST_CONNECTED:
Add(*Details<PluginProcessInfo>(details).ptr());
break;
- case NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED:
+ case NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED:
Remove(*Details<PluginProcessInfo>(details).ptr());
break;
default: