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_EXTENSION_PROCESS_RESOURCE_PROV
IDER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_EXTENSION_PROCESS_RESOURCE_PROVIDER_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_EXTENSION_PROCESS_RESOURCE_PROV
IDER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_EXTENSION_PROCESS_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 "chrome/browser/task_manager/task_manager.h" | 11 #include "chrome/browser/task_manager/task_manager.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class TaskManagerExtensionProcessResource; | |
16 | |
17 namespace content { | 15 namespace content { |
18 class RenderViewHost; | 16 class RenderViewHost; |
19 } | 17 } |
20 | 18 |
21 class TaskManagerExtensionProcessResourceProvider | 19 namespace task_manager { |
| 20 |
| 21 class ExtensionProcessResource; |
| 22 |
| 23 class ExtensionProcessResourceProvider |
22 : public TaskManager::ResourceProvider, | 24 : public TaskManager::ResourceProvider, |
23 public content::NotificationObserver { | 25 public content::NotificationObserver { |
24 public: | 26 public: |
25 explicit TaskManagerExtensionProcessResourceProvider( | 27 explicit ExtensionProcessResourceProvider(TaskManager* task_manager); |
26 TaskManager* task_manager); | |
27 | 28 |
28 virtual TaskManager::Resource* GetResource(int origin_pid, | 29 virtual TaskManager::Resource* GetResource(int origin_pid, |
29 int render_process_host_id, | 30 int render_process_host_id, |
30 int routing_id) OVERRIDE; | 31 int routing_id) OVERRIDE; |
31 virtual void StartUpdating() OVERRIDE; | 32 virtual void StartUpdating() OVERRIDE; |
32 virtual void StopUpdating() OVERRIDE; | 33 virtual void StopUpdating() OVERRIDE; |
33 | 34 |
34 // content::NotificationObserver method: | 35 // content::NotificationObserver method: |
35 virtual void Observe(int type, | 36 virtual void Observe(int type, |
36 const content::NotificationSource& source, | 37 const content::NotificationSource& source, |
37 const content::NotificationDetails& details) OVERRIDE; | 38 const content::NotificationDetails& details) OVERRIDE; |
38 | 39 |
39 private: | 40 private: |
40 virtual ~TaskManagerExtensionProcessResourceProvider(); | 41 virtual ~ExtensionProcessResourceProvider(); |
41 | 42 |
42 bool IsHandledByThisProvider(content::RenderViewHost* render_view_host); | 43 bool IsHandledByThisProvider(content::RenderViewHost* render_view_host); |
43 void AddToTaskManager(content::RenderViewHost* render_view_host); | 44 void AddToTaskManager(content::RenderViewHost* render_view_host); |
44 void RemoveFromTaskManager(content::RenderViewHost* render_view_host); | 45 void RemoveFromTaskManager(content::RenderViewHost* render_view_host); |
45 | 46 |
46 TaskManager* task_manager_; | 47 TaskManager* task_manager_; |
47 | 48 |
48 // Maps the actual resources (content::RenderViewHost*) to the Task Manager | 49 // Maps the actual resources (content::RenderViewHost*) to the Task Manager |
49 // resources. | 50 // resources. |
50 typedef std::map<content::RenderViewHost*, | 51 typedef std::map<content::RenderViewHost*, ExtensionProcessResource*> |
51 TaskManagerExtensionProcessResource*> ExtensionRenderViewHostMap; | 52 ExtensionRenderViewHostMap; |
52 ExtensionRenderViewHostMap resources_; | 53 ExtensionRenderViewHostMap resources_; |
53 | 54 |
54 // A scoped container for notification registries. | 55 // A scoped container for notification registries. |
55 content::NotificationRegistrar registrar_; | 56 content::NotificationRegistrar registrar_; |
56 | 57 |
57 bool updating_; | 58 bool updating_; |
58 | 59 |
59 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResourceProvider); | 60 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessResourceProvider); |
60 }; | 61 }; |
61 | 62 |
62 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_EXTENSION_PROCESS_RESOURCE_P
ROVIDER_H_ | 63 } // namespace task_manager |
| 64 |
| 65 #endif // CHROME_BROWSER_TASK_MANAGER_EXTENSION_PROCESS_RESOURCE_PROVIDER_H_ |
OLD | NEW |