| 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 <utility> | 10 #include <utility> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 static void RegisterPrefs(PrefService* prefs); | 90 static void RegisterPrefs(PrefService* prefs); |
| 91 | 91 |
| 92 // Call this method to show the Task Manager. | 92 // Call this method to show the Task Manager. |
| 93 // Only one instance of Task Manager is created, so if the Task Manager has | 93 // Only one instance of Task Manager is created, so if the Task Manager has |
| 94 // already be opened, it is reopened. If it is currently opened, then it is | 94 // already be opened, it is reopened. If it is currently opened, then it is |
| 95 // moved to the front. | 95 // moved to the front. |
| 96 static void Open(); | 96 static void Open(); |
| 97 | 97 |
| 98 // Close the task manager. | 98 // Close the task manager if it's currently opened. |
| 99 void Close(); | 99 static void Close(); |
| 100 | 100 |
| 101 // Do the cleanup that can't be done during singleton destruction by | 101 // Do the cleanup that can't be done during singleton destruction by |
| 102 // AtExitManager. Does nothing if the TaskManager hasn't been initialized. | 102 // AtExitManager. Does nothing if the TaskManager hasn't been initialized. |
| 103 static void EnsureShutdown(); | 103 static void EnsureShutdown(); |
| 104 | 104 |
| 105 // Returns true if the current selection includes the browser process. | 105 // Returns true if the current selection includes the browser process. |
| 106 bool BrowserProcessIsSelected(); | 106 bool BrowserProcessIsSelected(); |
| 107 | 107 |
| 108 // Terminates the selected tab(s) in the list. | 108 // Terminates the selected tab(s) in the list. |
| 109 void KillSelectedProcesses(); | 109 void KillSelectedProcesses(); |
| 110 | 110 |
| 111 // Activates the browser tab associated with the focused row in the task | 111 // Activates the browser tab associated with the focused row in the task |
| 112 // manager table. This happens when the user double clicks or hits return. | 112 // manager table. This happens when the user double clicks or hits return. |
| 113 void ActivateFocusedTab(); | 113 void ActivateFocusedTab(); |
| 114 | 114 |
| 115 void AddResourceProvider(ResourceProvider* provider); | 115 void AddResourceProvider(ResourceProvider* provider); |
| 116 void RemoveResourceProvider(ResourceProvider* provider); | 116 void RemoveResourceProvider(ResourceProvider* provider); |
| 117 | 117 |
| 118 // These methods are invoked by the resource providers to add/remove resources | 118 // These methods are invoked by the resource providers to add/remove resources |
| 119 // to the Task Manager. Note that the resources are owned by the | 119 // to the Task Manager. Note that the resources are owned by the |
| 120 // ResourceProviders and are not valid after StopUpdating() has been called | 120 // ResourceProviders and are not valid after StopUpdating() has been called |
| 121 // on the ResourceProviders. | 121 // on the ResourceProviders. |
| 122 void AddResource(Resource* resource); | 122 void AddResource(Resource* resource); |
| 123 void RemoveResource(Resource* resource); | 123 void RemoveResource(Resource* resource); |
| 124 | 124 |
| 125 void OnWindowClosed(); |
| 126 |
| 125 private: | 127 private: |
| 126 FRIEND_TEST(TaskManagerTest, Basic); | 128 FRIEND_TEST(TaskManagerTest, Basic); |
| 127 FRIEND_TEST(TaskManagerTest, Resources); | 129 FRIEND_TEST(TaskManagerTest, Resources); |
| 128 | 130 |
| 129 // Obtain an instance via GetInstance(). | 131 // Obtain an instance via GetInstance(). |
| 130 TaskManager(); | 132 TaskManager(); |
| 131 friend struct DefaultSingletonTraits<TaskManager>; | 133 friend struct DefaultSingletonTraits<TaskManager>; |
| 132 | 134 |
| 133 ~TaskManager(); | 135 ~TaskManager(); |
| 134 | 136 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 }; | 356 }; |
| 355 | 357 |
| 356 class TaskManagerView { | 358 class TaskManagerView { |
| 357 public: | 359 public: |
| 358 virtual ~TaskManagerView() {} | 360 virtual ~TaskManagerView() {} |
| 359 | 361 |
| 360 virtual void GetSelection(std::vector<int>* selection) = 0; | 362 virtual void GetSelection(std::vector<int>* selection) = 0; |
| 361 virtual void GetFocused(std::vector<int>* focused) = 0; | 363 virtual void GetFocused(std::vector<int>* focused) = 0; |
| 362 | 364 |
| 363 virtual void OpenWindow() = 0; | 365 virtual void OpenWindow() = 0; |
| 366 virtual void CloseWindow() = 0; |
| 364 }; | 367 }; |
| 365 | 368 |
| 366 #endif // CHROME_BROWSER_TASK_MANAGER_H_ | 369 #endif // CHROME_BROWSER_TASK_MANAGER_H_ |
| OLD | NEW |