| Index: chrome/browser/task_manager/task_manager_resource_providers.cc
|
| ===================================================================
|
| --- chrome/browser/task_manager/task_manager_resource_providers.cc (revision 91968)
|
| +++ chrome/browser/task_manager/task_manager_resource_providers.cc (working copy)
|
| @@ -27,6 +27,7 @@
|
| #include "chrome/browser/tab_contents/tab_util.h"
|
| #include "chrome/browser/ui/browser_list.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/extensions/extension.h"
|
| #include "chrome/common/render_messages.h"
|
| @@ -325,17 +326,17 @@
|
| Add(*iterator);
|
|
|
| // Then we register for notifications to get new tabs.
|
| - registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED,
|
| + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED,
|
| + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
|
| + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED,
|
| NotificationService::AllSources());
|
| // TAB_CONTENTS_DISCONNECTED should be enough to know when to remove a
|
| // resource. This is an attempt at mitigating a crasher that seem to
|
| // indicate a resource is still referencing a deleted TabContents
|
| // (http://crbug.com/7321).
|
| - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
|
| + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
|
| NotificationService::AllSources());
|
| }
|
|
|
| @@ -344,13 +345,13 @@
|
| updating_ = false;
|
|
|
| // Then we unregister for notifications to get new tabs.
|
| - registrar_.Remove(this, NotificationType::TAB_CONTENTS_CONNECTED,
|
| + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::TAB_CONTENTS_SWAPPED,
|
| + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
|
| + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED,
|
| + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
|
| NotificationService::AllSources());
|
|
|
| // Delete all the resources.
|
| @@ -413,7 +414,7 @@
|
| delete resource;
|
| }
|
|
|
| -void TaskManagerTabContentsResourceProvider::Observe(NotificationType type,
|
| +void TaskManagerTabContentsResourceProvider::Observe(int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) {
|
| TabContentsWrapper* tab_contents =
|
| @@ -422,21 +423,21 @@
|
| // A background page does not have a TabContentsWrapper.
|
| if (!tab_contents)
|
| return;
|
| - switch (type.value) {
|
| - case NotificationType::TAB_CONTENTS_CONNECTED:
|
| + switch (type) {
|
| + case content::NOTIFICATION_TAB_CONTENTS_CONNECTED:
|
| Add(tab_contents);
|
| break;
|
| - case NotificationType::TAB_CONTENTS_SWAPPED:
|
| + case content::NOTIFICATION_TAB_CONTENTS_SWAPPED:
|
| Remove(tab_contents);
|
| Add(tab_contents);
|
| break;
|
| - case NotificationType::TAB_CONTENTS_DESTROYED:
|
| + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED:
|
| // If this DCHECK is triggered, it could explain http://crbug.com/7321 .
|
| DCHECK(resources_.find(tab_contents) ==
|
| resources_.end()) << "TAB_CONTENTS_DESTROYED with no associated "
|
| "TAB_CONTENTS_DISCONNECTED";
|
| // Fall through.
|
| - case NotificationType::TAB_CONTENTS_DISCONNECTED:
|
| + case content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED:
|
| Remove(tab_contents);
|
| break;
|
| default:
|
| @@ -565,11 +566,11 @@
|
| }
|
|
|
| // Then we register for notifications to get new BackgroundContents.
|
| - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_OPENED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_DELETED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
|
| NotificationService::AllSources());
|
| }
|
|
|
| @@ -578,11 +579,11 @@
|
| updating_ = false;
|
|
|
| // Unregister for notifications
|
| - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_OPENED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_DELETED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
|
| NotificationService::AllSources());
|
|
|
| // Delete all the resources.
|
| @@ -634,11 +635,11 @@
|
| }
|
|
|
| void TaskManagerBackgroundContentsResourceProvider::Observe(
|
| - NotificationType type,
|
| + int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) {
|
| - switch (type.value) {
|
| - case NotificationType::BACKGROUND_CONTENTS_OPENED: {
|
| + switch (type) {
|
| + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED: {
|
| // Get the name from the parent application. If no parent application is
|
| // found, just pass an empty string - BackgroundContentsResource::GetTitle
|
| // will display the URL instead in this case. This should never happen
|
| @@ -663,7 +664,7 @@
|
| task_manager_->ModelChanged();
|
| break;
|
| }
|
| - case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: {
|
| + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: {
|
| BackgroundContents* contents = Details<BackgroundContents>(details).ptr();
|
| // Should never get a NAVIGATED before OPENED.
|
| DCHECK(resources_.find(contents) != resources_.end());
|
| @@ -674,7 +675,7 @@
|
| Add(contents, application_name);
|
| break;
|
| }
|
| - case NotificationType::BACKGROUND_CONTENTS_DELETED:
|
| + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED:
|
| Remove(Details<BackgroundContents>(details).ptr());
|
| // Closing a BackgroundContents needs to force the display to refresh
|
| // (applications may now be considered "foreground" that weren't before).
|
| @@ -849,9 +850,9 @@
|
| updating_ = true;
|
|
|
| // Register for notifications to get new child processes.
|
| - registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED,
|
| + registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_DISCONNECTED,
|
| + registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED,
|
| NotificationService::AllSources());
|
|
|
| // Get the existing child processes.
|
| @@ -867,10 +868,10 @@
|
| updating_ = false;
|
|
|
| // Unregister for notifications to get new plugin processes.
|
| - registrar_.Remove(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED,
|
| + registrar_.Remove(this, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED,
|
| NotificationService::AllSources());
|
| registrar_.Remove(this,
|
| - NotificationType::CHILD_PROCESS_HOST_DISCONNECTED,
|
| + content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED,
|
| NotificationService::AllSources());
|
|
|
| // Delete all the resources.
|
| @@ -882,14 +883,14 @@
|
| }
|
|
|
| void TaskManagerChildProcessResourceProvider::Observe(
|
| - NotificationType type,
|
| + int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) {
|
| - switch (type.value) {
|
| - case NotificationType::CHILD_PROCESS_HOST_CONNECTED:
|
| + switch (type) {
|
| + case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED:
|
| Add(*Details<ChildProcessInfo>(details).ptr());
|
| break;
|
| - case NotificationType::CHILD_PROCESS_HOST_DISCONNECTED:
|
| + case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED:
|
| Remove(*Details<ChildProcessInfo>(details).ptr());
|
| break;
|
| default:
|
| @@ -1092,11 +1093,11 @@
|
| }
|
|
|
| // Register for notifications about extension process changes.
|
| - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
|
| NotificationService::AllSources());
|
| - registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED,
|
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
|
| NotificationService::AllSources());
|
| }
|
|
|
| @@ -1105,11 +1106,11 @@
|
| updating_ = false;
|
|
|
| // Unregister for notifications about extension process changes.
|
| - registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_CREATED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_TERMINATED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
|
| NotificationService::AllSources());
|
| - registrar_.Remove(this, NotificationType::EXTENSION_HOST_DESTROYED,
|
| + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
|
| NotificationService::AllSources());
|
|
|
| // Delete all the resources.
|
| @@ -1120,15 +1121,15 @@
|
| }
|
|
|
| void TaskManagerExtensionProcessResourceProvider::Observe(
|
| - NotificationType type,
|
| + int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) {
|
| - switch (type.value) {
|
| - case NotificationType::EXTENSION_PROCESS_CREATED:
|
| + switch (type) {
|
| + case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED:
|
| AddToTaskManager(Details<ExtensionHost>(details).ptr());
|
| break;
|
| - case NotificationType::EXTENSION_PROCESS_TERMINATED:
|
| - case NotificationType::EXTENSION_HOST_DESTROYED:
|
| + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED:
|
| + case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED:
|
| RemoveFromTaskManager(Details<ExtensionHost>(details).ptr());
|
| break;
|
| default:
|
|
|