| 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> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/lock.h" | 11 #include "base/lock.h" |
| 9 #include "base/singleton.h" | 12 #include "base/singleton.h" |
| 10 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 11 #include "base/timer.h" | 14 #include "base/timer.h" |
| 12 #include "chrome/views/dialog_delegate.h" | 15 #include "chrome/views/dialog_delegate.h" |
| 13 #include "chrome/views/group_table_view.h" | 16 #include "chrome/views/group_table_view.h" |
| 14 #include "chrome/browser/cache_manager_host.h" | 17 #include "chrome/browser/cache_manager_host.h" |
| 18 #include "chrome/browser/tab_contents.h" |
| 15 #include "net/url_request/url_request_job_tracker.h" | 19 #include "net/url_request/url_request_job_tracker.h" |
| 16 | 20 |
| 17 class MessageLoop; | 21 class MessageLoop; |
| 18 class ModelEntry; | 22 class ModelEntry; |
| 19 class PrefService; | 23 class PrefService; |
| 20 class SkBitmap; | 24 class SkBitmap; |
| 21 class Task; | 25 class Task; |
| 22 class TaskManager; | 26 class TaskManager; |
| 23 class TaskManagerContents; | 27 class TaskManagerContents; |
| 24 class TaskManagerTableModel; | 28 class TaskManagerTableModel; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 class ProcessMetrics; | 39 class ProcessMetrics; |
| 36 } | 40 } |
| 37 | 41 |
| 38 // This class is a singleton. | 42 // This class is a singleton. |
| 39 class TaskManager : public ChromeViews::DialogDelegate { | 43 class TaskManager : public ChromeViews::DialogDelegate { |
| 40 public: | 44 public: |
| 41 // A resource represents one row in the task manager. | 45 // A resource represents one row in the task manager. |
| 42 // Resources from similar processes are grouped together by the task manager. | 46 // Resources from similar processes are grouped together by the task manager. |
| 43 class Resource { | 47 class Resource { |
| 44 public: | 48 public: |
| 49 virtual ~Resource() {} |
| 50 |
| 45 virtual std::wstring GetTitle() const = 0; | 51 virtual std::wstring GetTitle() const = 0; |
| 46 virtual SkBitmap GetIcon() const = 0; | 52 virtual SkBitmap GetIcon() const = 0; |
| 47 virtual HANDLE GetProcess() const = 0; | 53 virtual HANDLE GetProcess() const = 0; |
| 48 | 54 |
| 55 // A helper function for ActivateFocusedTab. Returns NULL by default |
| 56 // because not all resources have an assoiciated tab. |
| 57 virtual TabContents* GetTabContents() const {return NULL;} |
| 58 |
| 49 // Whether this resource does report the network usage accurately. | 59 // Whether this resource does report the network usage accurately. |
| 50 // This controls whether 0 or N/A is displayed when no bytes have been | 60 // This controls whether 0 or N/A is displayed when no bytes have been |
| 51 // reported as being read. This is because some plugins do not report the | 61 // reported as being read. This is because some plugins do not report the |
| 52 // bytes read and we don't want to display a misleading 0 value in that | 62 // bytes read and we don't want to display a misleading 0 value in that |
| 53 // case. | 63 // case. |
| 54 virtual bool SupportNetworkUsage() const = 0; | 64 virtual bool SupportNetworkUsage() const = 0; |
| 55 | 65 |
| 56 // Called when some bytes have been read and support_network_usage returns | 66 // Called when some bytes have been read and support_network_usage returns |
| 57 // false(meaning we do have network usage support). | 67 // false(meaning we do have network usage support). |
| 58 virtual void SetSupportNetworkUsage() = 0; | 68 virtual void SetSupportNetworkUsage() = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 102 |
| 93 // Close the task manager. | 103 // Close the task manager. |
| 94 void Close(); | 104 void Close(); |
| 95 | 105 |
| 96 // Returns true if the current selection includes the browser process. | 106 // Returns true if the current selection includes the browser process. |
| 97 bool BrowserProcessIsSelected(); | 107 bool BrowserProcessIsSelected(); |
| 98 | 108 |
| 99 // Terminates the selected tab(s) in the list. | 109 // Terminates the selected tab(s) in the list. |
| 100 void KillSelectedProcesses(); | 110 void KillSelectedProcesses(); |
| 101 | 111 |
| 112 // Activates the browser tab associated with the focused row in the task |
| 113 // manager table. This happens when the user double clicks or hits return. |
| 114 void ActivateFocusedTab(); |
| 115 |
| 102 void AddResourceProvider(ResourceProvider* provider); | 116 void AddResourceProvider(ResourceProvider* provider); |
| 103 void RemoveResourceProvider(ResourceProvider* provider); | 117 void RemoveResourceProvider(ResourceProvider* provider); |
| 104 | 118 |
| 105 // These methods are invoked by the resource providers to add/remove resources | 119 // These methods are invoked by the resource providers to add/remove resources |
| 106 // to the Task Manager. Note that the resources are owned by the | 120 // to the Task Manager. Note that the resources are owned by the |
| 107 // ResourceProviders and are not valid after StopUpdating() has been called | 121 // ResourceProviders and are not valid after StopUpdating() has been called |
| 108 // on the ResourceProviders. | 122 // on the ResourceProviders. |
| 109 void AddResource(Resource* resource); | 123 void AddResource(Resource* resource); |
| 110 void RemoveResource(Resource* resource); | 124 void RemoveResource(Resource* resource); |
| 111 | 125 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 280 |
| 267 // See design doc at http://go/at-teleporter for more information. | 281 // See design doc at http://go/at-teleporter for more information. |
| 268 static int goats_teleported_; | 282 static int goats_teleported_; |
| 269 | 283 |
| 270 DISALLOW_EVIL_CONSTRUCTORS(TaskManagerTableModel); | 284 DISALLOW_EVIL_CONSTRUCTORS(TaskManagerTableModel); |
| 271 }; | 285 }; |
| 272 | 286 |
| 273 #endif // CHROME_BROWSER_TASK_MANAGER_H__ | 287 #endif // CHROME_BROWSER_TASK_MANAGER_H__ |
| 274 | 288 |
| 275 | 289 |
| OLD | NEW |