OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_RESOURCE_PROVIDERS_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/process_util.h" |
9 #include "chrome/browser/task_manager.h" | 10 #include "chrome/browser/task_manager.h" |
10 #include "chrome/common/child_process_info.h" | 11 #include "chrome/common/child_process_info.h" |
11 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_observer.h" |
12 | 13 |
13 class WebContents; | 14 class WebContents; |
14 | 15 |
15 // These file contains the resource providers used in the task manager. | 16 // These file contains the resource providers used in the task manager. |
16 | 17 |
17 class TaskManagerWebContentsResource : public TaskManager::Resource { | 18 class TaskManagerWebContentsResource : public TaskManager::Resource { |
18 public: | 19 public: |
19 explicit TaskManagerWebContentsResource(WebContents* web_contents); | 20 explicit TaskManagerWebContentsResource(WebContents* web_contents); |
20 ~TaskManagerWebContentsResource(); | 21 ~TaskManagerWebContentsResource(); |
21 | 22 |
22 // TaskManagerResource methods: | 23 // TaskManagerResource methods: |
23 std::wstring GetTitle() const; | 24 std::wstring GetTitle() const; |
24 SkBitmap GetIcon() const; | 25 SkBitmap GetIcon() const; |
25 HANDLE GetProcess() const; | 26 base::ProcessHandle GetProcess() const; |
26 TabContents* GetTabContents() const; | 27 TabContents* GetTabContents() const; |
27 | 28 |
28 // WebContents always provide the network usage. | 29 // WebContents always provide the network usage. |
29 bool SupportNetworkUsage() const { return true; } | 30 bool SupportNetworkUsage() const { return true; } |
30 void SetSupportNetworkUsage() { }; | 31 void SetSupportNetworkUsage() { }; |
31 | 32 |
32 private: | 33 private: |
33 WebContents* web_contents_; | 34 WebContents* web_contents_; |
34 HANDLE process_; | 35 base::ProcessHandle process_; |
35 int pid_; | 36 int pid_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResource); | 38 DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResource); |
38 }; | 39 }; |
39 | 40 |
40 class TaskManagerWebContentsResourceProvider | 41 class TaskManagerWebContentsResourceProvider |
41 : public TaskManager::ResourceProvider, | 42 : public TaskManager::ResourceProvider, |
42 public NotificationObserver { | 43 public NotificationObserver { |
43 public: | 44 public: |
44 explicit TaskManagerWebContentsResourceProvider(TaskManager* task_manager); | 45 explicit TaskManagerWebContentsResourceProvider(TaskManager* task_manager); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 }; | 79 }; |
79 | 80 |
80 class TaskManagerChildProcessResource : public TaskManager::Resource { | 81 class TaskManagerChildProcessResource : public TaskManager::Resource { |
81 public: | 82 public: |
82 explicit TaskManagerChildProcessResource(ChildProcessInfo child_proc); | 83 explicit TaskManagerChildProcessResource(ChildProcessInfo child_proc); |
83 ~TaskManagerChildProcessResource(); | 84 ~TaskManagerChildProcessResource(); |
84 | 85 |
85 // TaskManagerResource methods: | 86 // TaskManagerResource methods: |
86 std::wstring GetTitle() const; | 87 std::wstring GetTitle() const; |
87 SkBitmap GetIcon() const; | 88 SkBitmap GetIcon() const; |
88 HANDLE GetProcess() const; | 89 base::ProcessHandle GetProcess() const; |
89 | 90 |
90 bool SupportNetworkUsage() const { | 91 bool SupportNetworkUsage() const { |
91 return network_usage_support_; | 92 return network_usage_support_; |
92 } | 93 } |
93 | 94 |
94 void SetSupportNetworkUsage() { | 95 void SetSupportNetworkUsage() { |
95 network_usage_support_ = true; | 96 network_usage_support_ = true; |
96 } | 97 } |
97 | 98 |
98 // Returns the pid of the child process. | 99 // Returns the pid of the child process. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 }; | 169 }; |
169 | 170 |
170 class TaskManagerBrowserProcessResource : public TaskManager::Resource { | 171 class TaskManagerBrowserProcessResource : public TaskManager::Resource { |
171 public: | 172 public: |
172 TaskManagerBrowserProcessResource(); | 173 TaskManagerBrowserProcessResource(); |
173 ~TaskManagerBrowserProcessResource(); | 174 ~TaskManagerBrowserProcessResource(); |
174 | 175 |
175 // TaskManagerResource methods: | 176 // TaskManagerResource methods: |
176 std::wstring GetTitle() const; | 177 std::wstring GetTitle() const; |
177 SkBitmap GetIcon() const; | 178 SkBitmap GetIcon() const; |
178 HANDLE GetProcess() const; | 179 base::ProcessHandle GetProcess() const; |
179 | 180 |
180 bool SupportNetworkUsage() const { | 181 bool SupportNetworkUsage() const { |
181 return network_usage_support_; | 182 return network_usage_support_; |
182 } | 183 } |
183 | 184 |
184 void SetSupportNetworkUsage() { | 185 void SetSupportNetworkUsage() { |
185 network_usage_support_ = true; | 186 network_usage_support_ = true; |
186 } | 187 } |
187 | 188 |
188 // Returns the pid of the browser process. | 189 // Returns the pid of the browser process. |
189 int process_id() const { return pid_; } | 190 int process_id() const { return pid_; } |
190 | 191 |
191 private: | 192 private: |
192 HANDLE process_; | 193 base::ProcessHandle process_; |
193 int pid_; | 194 int pid_; |
194 bool network_usage_support_; | 195 bool network_usage_support_; |
195 mutable std::wstring title_; | 196 mutable std::wstring title_; |
196 | 197 |
197 static SkBitmap* default_icon_; | 198 static SkBitmap* default_icon_; |
198 | 199 |
199 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); | 200 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); |
200 }; | 201 }; |
201 | 202 |
202 class TaskManagerBrowserProcessResourceProvider | 203 class TaskManagerBrowserProcessResourceProvider |
(...skipping 16 matching lines...) Expand all Loading... |
219 private: | 220 private: |
220 void AddToTaskManager(ChildProcessInfo child_process_info); | 221 void AddToTaskManager(ChildProcessInfo child_process_info); |
221 | 222 |
222 TaskManager* task_manager_; | 223 TaskManager* task_manager_; |
223 TaskManagerBrowserProcessResource resource_; | 224 TaskManagerBrowserProcessResource resource_; |
224 | 225 |
225 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 226 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
226 }; | 227 }; |
227 | 228 |
228 #endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 229 #endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |