diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 22:14:39 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 22:14:39 +0000 |
commit | d19ee3444d4c8042a97bd653e57c775206a04bed (patch) | |
tree | 89f0e3822bab8f163ec99ff4dde6a48cd529d54b /chrome/browser/task_manager_resource_providers.h | |
parent | 4cb6dca5bcdabfa14f067f741243ca4fcda0b833 (diff) | |
download | chromium_src-d19ee3444d4c8042a97bd653e57c775206a04bed.zip chromium_src-d19ee3444d4c8042a97bd653e57c775206a04bed.tar.gz chromium_src-d19ee3444d4c8042a97bd653e57c775206a04bed.tar.bz2 |
Add notification processes to the task manager.
BUG=29332
TEST=notifications in task manager
Review URL: http://codereview.chromium.org/1610006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager_resource_providers.h')
-rw-r--r-- | chrome/browser/task_manager_resource_providers.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/chrome/browser/task_manager_resource_providers.h b/chrome/browser/task_manager_resource_providers.h index 65209f4..8de984d 100644 --- a/chrome/browser/task_manager_resource_providers.h +++ b/chrome/browser/task_manager_resource_providers.h @@ -16,6 +16,7 @@ #include "chrome/common/notification_registrar.h" #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" +class BalloonHost; class Extension; class ExtensionHost; class TabContents; @@ -271,6 +272,70 @@ class TaskManagerExtensionProcessResourceProvider DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResourceProvider); }; +class TaskManagerNotificationResource : public TaskManager::Resource { + public: + explicit TaskManagerNotificationResource(BalloonHost* balloon_host); + ~TaskManagerNotificationResource(); + + // TaskManager::Resource interface + std::wstring GetTitle() const { return title_; } + SkBitmap GetIcon() const; + base::ProcessHandle GetProcess() const; + virtual bool SupportNetworkUsage() const { return false; } + virtual void SetSupportNetworkUsage() { } + + private: + // The icon painted for notifications. . + static SkBitmap* default_icon_; + + // Non-owned pointer to the balloon host. + BalloonHost* balloon_host_; + + // Cached data about the balloon host. + base::ProcessHandle process_handle_; + int pid_; + std::wstring title_; + + DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResource); +}; + +class TaskManagerNotificationResourceProvider + : public TaskManager::ResourceProvider, + public NotificationObserver { + public: + explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); + + // TaskManager::ResourceProvider interface + virtual TaskManager::Resource* GetResource(int origin_pid, + int render_process_host_id, + int routing_id); + virtual void StartUpdating(); + virtual void StopUpdating(); + + // NotificationObserver interface + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + private: + virtual ~TaskManagerNotificationResourceProvider(); + + void AddToTaskManager(BalloonHost* balloon_host); + void RemoveFromTaskManager(BalloonHost* balloon_host); + + TaskManager* task_manager_; + + // Maps the actual resources (BalloonHost*) to the Task Manager resources. + std::map<BalloonHost*, TaskManagerNotificationResource*> resources_; + + // A scoped container for notification registries. + NotificationRegistrar registrar_; + + bool updating_; + + DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResourceProvider); +}; + class TaskManagerBrowserProcessResource : public TaskManager::Resource { public: TaskManagerBrowserProcessResource(); |