| 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_PANEL_RESOURCE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.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 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 16 | 16 |
| 17 class Panel; | 17 class Panel; |
| 18 class TaskManager; | 18 class TaskManager; |
| 19 class TaskManagerPanelResource; | |
| 20 | 19 |
| 21 class TaskManagerPanelResourceProvider | 20 namespace task_manager { |
| 22 : public TaskManager::ResourceProvider, | 21 |
| 23 public content::NotificationObserver { | 22 class PanelResource; |
| 23 |
| 24 class PanelResourceProvider : public TaskManager::ResourceProvider, |
| 25 public content::NotificationObserver { |
| 24 public: | 26 public: |
| 25 explicit TaskManagerPanelResourceProvider(TaskManager* task_manager); | 27 explicit PanelResourceProvider(TaskManager* task_manager); |
| 26 | 28 |
| 27 // TaskManager::ResourceProvider methods: | 29 // TaskManager::ResourceProvider methods: |
| 28 virtual TaskManager::Resource* GetResource(int origin_pid, | 30 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 29 int render_process_host_id, | 31 int render_process_host_id, |
| 30 int routing_id) OVERRIDE; | 32 int routing_id) OVERRIDE; |
| 31 virtual void StartUpdating() OVERRIDE; | 33 virtual void StartUpdating() OVERRIDE; |
| 32 virtual void StopUpdating() OVERRIDE; | 34 virtual void StopUpdating() OVERRIDE; |
| 33 | 35 |
| 34 // content::NotificationObserver method: | 36 // content::NotificationObserver method: |
| 35 virtual void Observe(int type, | 37 virtual void Observe(int type, |
| 36 const content::NotificationSource& source, | 38 const content::NotificationSource& source, |
| 37 const content::NotificationDetails& details) OVERRIDE; | 39 const content::NotificationDetails& details) OVERRIDE; |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 virtual ~TaskManagerPanelResourceProvider(); | 42 virtual ~PanelResourceProvider(); |
| 41 | 43 |
| 42 void Add(Panel* panel); | 44 void Add(Panel* panel); |
| 43 void Remove(Panel* panel); | 45 void Remove(Panel* panel); |
| 44 | 46 |
| 45 // Whether we are currently reporting to the task manager. Used to ignore | 47 // Whether we are currently reporting to the task manager. Used to ignore |
| 46 // notifications sent after StopUpdating(). | 48 // notifications sent after StopUpdating(). |
| 47 bool updating_; | 49 bool updating_; |
| 48 | 50 |
| 49 TaskManager* task_manager_; | 51 TaskManager* task_manager_; |
| 50 | 52 |
| 51 // Maps the actual resources (the Panels) to the Task Manager resources. | 53 // Maps the actual resources (the Panels) to the Task Manager resources. |
| 52 typedef std::map<Panel*, TaskManagerPanelResource*> PanelResourceMap; | 54 typedef std::map<Panel*, PanelResource*> PanelResourceMap; |
| 53 PanelResourceMap resources_; | 55 PanelResourceMap resources_; |
| 54 | 56 |
| 55 // A scoped container for notification registries. | 57 // A scoped container for notification registries. |
| 56 content::NotificationRegistrar registrar_; | 58 content::NotificationRegistrar registrar_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResourceProvider); | 60 DISALLOW_COPY_AND_ASSIGN(PanelResourceProvider); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_ | 63 } // namespace task_manager |
| 64 |
| 65 #endif // CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_ |
| OLD | NEW |