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_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/basictypes.h" |
12 #include "base/lock.h" | 13 #include "base/lock.h" |
| 14 #include "base/process_util.h" |
| 15 #include "base/ref_counted.h" |
13 #include "base/singleton.h" | 16 #include "base/singleton.h" |
14 #include "base/ref_counted.h" | |
15 #include "base/timer.h" | 17 #include "base/timer.h" |
16 #include "chrome/browser/renderer_host/web_cache_manager.h" | 18 #include "chrome/browser/renderer_host/web_cache_manager.h" |
17 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 20 #if defined(OS_WIN) |
| 21 // TODO(port): Port or produce equivalent. |
18 #include "chrome/views/controls/table/group_table_view.h" | 22 #include "chrome/views/controls/table/group_table_view.h" |
| 23 #endif // defined(OS_WIN) |
19 #include "chrome/views/window/dialog_delegate.h" | 24 #include "chrome/views/window/dialog_delegate.h" |
20 #include "net/url_request/url_request_job_tracker.h" | 25 #include "net/url_request/url_request_job_tracker.h" |
21 #include "testing/gtest/include/gtest/gtest_prod.h" | 26 #include "testing/gtest/include/gtest/gtest_prod.h" |
22 | 27 |
23 class MessageLoop; | 28 class MessageLoop; |
24 class ModelEntry; | 29 class ModelEntry; |
25 class PrefService; | 30 class PrefService; |
26 class SkBitmap; | 31 class SkBitmap; |
27 class Task; | 32 class Task; |
28 class TaskManager; | 33 class TaskManager; |
(...skipping 16 matching lines...) Expand all Loading... |
45 class TaskManager : public views::DialogDelegate { | 50 class TaskManager : public views::DialogDelegate { |
46 public: | 51 public: |
47 // A resource represents one row in the task manager. | 52 // A resource represents one row in the task manager. |
48 // Resources from similar processes are grouped together by the task manager. | 53 // Resources from similar processes are grouped together by the task manager. |
49 class Resource { | 54 class Resource { |
50 public: | 55 public: |
51 virtual ~Resource() {} | 56 virtual ~Resource() {} |
52 | 57 |
53 virtual std::wstring GetTitle() const = 0; | 58 virtual std::wstring GetTitle() const = 0; |
54 virtual SkBitmap GetIcon() const = 0; | 59 virtual SkBitmap GetIcon() const = 0; |
55 virtual HANDLE GetProcess() const = 0; | 60 virtual base::ProcessHandle GetProcess() const = 0; |
56 | 61 |
57 // A helper function for ActivateFocusedTab. Returns NULL by default | 62 // A helper function for ActivateFocusedTab. Returns NULL by default |
58 // because not all resources have an assoiciated tab. | 63 // because not all resources have an assoiciated tab. |
59 virtual TabContents* GetTabContents() const {return NULL;} | 64 virtual TabContents* GetTabContents() const {return NULL;} |
60 | 65 |
61 // Whether this resource does report the network usage accurately. | 66 // Whether this resource does report the network usage accurately. |
62 // This controls whether 0 or N/A is displayed when no bytes have been | 67 // This controls whether 0 or N/A is displayed when no bytes have been |
63 // reported as being read. This is because some plugins do not report the | 68 // reported as being read. This is because some plugins do not report the |
64 // bytes read and we don't want to display a misleading 0 value in that | 69 // bytes read and we don't want to display a misleading 0 value in that |
65 // case. | 70 // case. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 virtual void WindowClosing(); | 140 virtual void WindowClosing(); |
136 virtual void DeleteDelegate(); | 141 virtual void DeleteDelegate(); |
137 virtual views::View* GetContentsView(); | 142 virtual views::View* GetContentsView(); |
138 | 143 |
139 private: | 144 private: |
140 FRIEND_TEST(TaskManagerTest, Basic); | 145 FRIEND_TEST(TaskManagerTest, Basic); |
141 FRIEND_TEST(TaskManagerTest, Resources); | 146 FRIEND_TEST(TaskManagerTest, Resources); |
142 | 147 |
143 // Obtain an instance via GetInstance(). | 148 // Obtain an instance via GetInstance(). |
144 TaskManager(); | 149 TaskManager(); |
145 friend DefaultSingletonTraits<TaskManager>; | 150 friend struct DefaultSingletonTraits<TaskManager>; |
146 | 151 |
147 ~TaskManager(); | 152 ~TaskManager(); |
148 | 153 |
149 void Init(); | 154 void Init(); |
150 | 155 |
151 // Returns the singleton instance (and initializes it if necessary). | 156 // Returns the singleton instance (and initializes it if necessary). |
152 static TaskManager* GetInstance(); | 157 static TaskManager* GetInstance(); |
153 | 158 |
154 // The model used for the list in the table that displays the list of tab | 159 // The model used for the list in the table that displays the list of tab |
155 // processes. It is ref counted because it is passed as a parameter to | 160 // processes. It is ref counted because it is passed as a parameter to |
156 // MessageLoop::InvokeLater(). | 161 // MessageLoop::InvokeLater(). |
157 scoped_refptr<TaskManagerTableModel> table_model_; | 162 scoped_refptr<TaskManagerTableModel> table_model_; |
158 | 163 |
159 // A container containing the buttons and table. | 164 // A container containing the buttons and table. |
160 scoped_ptr<TaskManagerContents> contents_; | 165 scoped_ptr<TaskManagerContents> contents_; |
161 | 166 |
162 DISALLOW_COPY_AND_ASSIGN(TaskManager); | 167 DISALLOW_COPY_AND_ASSIGN(TaskManager); |
163 }; | 168 }; |
164 | 169 |
| 170 #if defined(OS_WIN) |
| 171 // TODO(port): Port or produce equivalent. |
| 172 |
165 // The model that the table is using. | 173 // The model that the table is using. |
166 class TaskManagerTableModel : public views::GroupTableModel, | 174 class TaskManagerTableModel : public views::GroupTableModel, |
167 public URLRequestJobTracker::JobObserver, | 175 public URLRequestJobTracker::JobObserver, |
168 public base::RefCounted<TaskManagerTableModel> { | 176 public base::RefCounted<TaskManagerTableModel> { |
169 public: | 177 public: |
170 explicit TaskManagerTableModel(TaskManager* task_manager); | 178 explicit TaskManagerTableModel(TaskManager* task_manager); |
171 ~TaskManagerTableModel(); | 179 ~TaskManagerTableModel(); |
172 | 180 |
173 // GroupTableModel methods: | 181 // GroupTableModel methods: |
174 int RowCount(); | 182 int RowCount(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 MessageLoop* ui_loop_; | 324 MessageLoop* ui_loop_; |
317 | 325 |
318 // Whether we are currently in the process of updating. | 326 // Whether we are currently in the process of updating. |
319 UpdateState update_state_; | 327 UpdateState update_state_; |
320 | 328 |
321 // See design doc at http://go/at-teleporter for more information. | 329 // See design doc at http://go/at-teleporter for more information. |
322 static int goats_teleported_; | 330 static int goats_teleported_; |
323 | 331 |
324 DISALLOW_COPY_AND_ASSIGN(TaskManagerTableModel); | 332 DISALLOW_COPY_AND_ASSIGN(TaskManagerTableModel); |
325 }; | 333 }; |
| 334 #endif // defined(OS_WIN) |
326 | 335 |
327 #endif // CHROME_BROWSER_TASK_MANAGER_H_ | 336 #endif // CHROME_BROWSER_TASK_MANAGER_H_ |
OLD | NEW |