| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_
H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_
H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/browser/task_manager/task_manager.h" | 12 #include "chrome/browser/task_manager/task_manager.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 | 15 |
| 16 class BalloonHost; | 16 class BalloonHost; |
| 17 class TaskManagerNotificationResource; | |
| 18 | 17 |
| 19 class TaskManagerNotificationResourceProvider | 18 namespace task_manager { |
| 20 : public TaskManager::ResourceProvider, | 19 |
| 21 public content::NotificationObserver { | 20 class NotificationResource; |
| 21 |
| 22 class NotificationResourceProvider : public TaskManager::ResourceProvider, |
| 23 public content::NotificationObserver { |
| 22 public: | 24 public: |
| 23 static TaskManagerNotificationResourceProvider* Create( | 25 static NotificationResourceProvider* Create(TaskManager* task_manager); |
| 24 TaskManager* task_manager); | |
| 25 | 26 |
| 26 // TaskManager::ResourceProvider interface | 27 // TaskManager::ResourceProvider interface |
| 27 virtual TaskManager::Resource* GetResource(int origin_pid, | 28 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 28 int render_process_host_id, | 29 int render_process_host_id, |
| 29 int routing_id) OVERRIDE; | 30 int routing_id) OVERRIDE; |
| 30 virtual void StartUpdating() OVERRIDE; | 31 virtual void StartUpdating() OVERRIDE; |
| 31 virtual void StopUpdating() OVERRIDE; | 32 virtual void StopUpdating() OVERRIDE; |
| 32 | 33 |
| 33 // content::NotificationObserver interface | 34 // content::NotificationObserver interface |
| 34 virtual void Observe(int type, | 35 virtual void Observe(int type, |
| 35 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
| 36 const content::NotificationDetails& details) OVERRIDE; | 37 const content::NotificationDetails& details) OVERRIDE; |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); | 40 explicit NotificationResourceProvider(TaskManager* task_manager); |
| 40 virtual ~TaskManagerNotificationResourceProvider(); | 41 virtual ~NotificationResourceProvider(); |
| 41 | 42 |
| 42 void AddToTaskManager(BalloonHost* balloon_host); | 43 void AddToTaskManager(BalloonHost* balloon_host); |
| 43 void RemoveFromTaskManager(BalloonHost* balloon_host); | 44 void RemoveFromTaskManager(BalloonHost* balloon_host); |
| 44 | 45 |
| 45 TaskManager* task_manager_; | 46 TaskManager* task_manager_; |
| 46 | 47 |
| 47 // Maps the actual resources (BalloonHost*) to the Task Manager resources. | 48 // Maps the actual resources (BalloonHost*) to the Task Manager resources. |
| 48 std::map<BalloonHost*, TaskManagerNotificationResource*> resources_; | 49 std::map<BalloonHost*, NotificationResource*> resources_; |
| 49 | 50 |
| 50 // A scoped container for notification registries. | 51 // A scoped container for notification registries. |
| 51 content::NotificationRegistrar registrar_; | 52 content::NotificationRegistrar registrar_; |
| 52 | 53 |
| 53 bool updating_; | 54 bool updating_; |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResourceProvider); | 56 DISALLOW_COPY_AND_ASSIGN(NotificationResourceProvider); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVID
ER_H_ | 59 } // namespace task_manager |
| 60 |
| 61 #endif // CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
| OLD | NEW |