| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/task_manager/background_information.h" | 25 #include "chrome/browser/task_manager/background_information.h" |
| 26 #include "chrome/browser/task_manager/browser_process_resource_provider.h" | 26 #include "chrome/browser/task_manager/browser_process_resource_provider.h" |
| 27 #include "chrome/browser/task_manager/child_process_resource_provider.h" | 27 #include "chrome/browser/task_manager/child_process_resource_provider.h" |
| 28 #include "chrome/browser/task_manager/extension_information.h" | 28 #include "chrome/browser/task_manager/extension_information.h" |
| 29 #include "chrome/browser/task_manager/guest_information.h" | 29 #include "chrome/browser/task_manager/guest_information.h" |
| 30 #include "chrome/browser/task_manager/panel_information.h" | 30 #include "chrome/browser/task_manager/panel_information.h" |
| 31 #include "chrome/browser/task_manager/printing_information.h" | 31 #include "chrome/browser/task_manager/printing_information.h" |
| 32 #include "chrome/browser/task_manager/resource_provider.h" | 32 #include "chrome/browser/task_manager/resource_provider.h" |
| 33 #include "chrome/browser/task_manager/tab_contents_information.h" | 33 #include "chrome/browser/task_manager/tab_contents_information.h" |
| 34 #include "chrome/browser/task_manager/web_contents_resource_provider.h" | 34 #include "chrome/browser/task_manager/web_contents_resource_provider.h" |
| 35 #include "chrome/browser/ui/browser_dialogs.h" |
| 35 #include "chrome/browser/ui/browser_navigator.h" | 36 #include "chrome/browser/ui/browser_navigator.h" |
| 36 #include "chrome/browser/ui/browser_navigator_params.h" | 37 #include "chrome/browser/ui/browser_navigator_params.h" |
| 37 #include "chrome/browser/ui/user_manager.h" | 38 #include "chrome/browser/ui/user_manager.h" |
| 38 #include "chrome/common/pref_names.h" | |
| 39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
| 40 #include "chrome/grit/generated_resources.h" | 40 #include "chrome/grit/generated_resources.h" |
| 41 #include "components/nacl/browser/nacl_browser.h" | 41 #include "components/nacl/browser/nacl_browser.h" |
| 42 #include "components/prefs/pref_registry_simple.h" | 42 #include "content/public/browser/browser_child_process_host.h" |
| 43 #include "components/prefs/pref_service.h" | |
| 44 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
| 45 #include "content/public/browser/gpu_data_manager.h" | 44 #include "content/public/browser/gpu_data_manager.h" |
| 46 #include "content/public/browser/gpu_data_manager_observer.h" | 45 #include "content/public/browser/gpu_data_manager_observer.h" |
| 47 #include "content/public/browser/resource_request_info.h" | 46 #include "content/public/browser/resource_request_info.h" |
| 48 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/browser/web_contents_delegate.h" | 48 #include "content/public/browser/web_contents_delegate.h" |
| 50 #include "content/public/browser/worker_service.h" | 49 #include "content/public/browser/worker_service.h" |
| 51 #include "content/public/common/result_codes.h" | 50 #include "content/public/common/result_codes.h" |
| 52 #include "extensions/browser/extension_system.h" | 51 #include "extensions/browser/extension_system.h" |
| 53 #include "third_party/icu/source/i18n/unicode/coll.h" | 52 #include "third_party/icu/source/i18n/unicode/coll.h" |
| 54 #include "ui/base/l10n/l10n_util.h" | 53 #include "ui/base/l10n/l10n_util.h" |
| 55 #include "ui/base/resource/resource_bundle.h" | 54 #include "ui/base/resource/resource_bundle.h" |
| 56 #include "ui/base/text/bytes_formatting.h" | 55 #include "ui/base/text/bytes_formatting.h" |
| 57 #include "ui/gfx/image/image_skia.h" | 56 #include "ui/gfx/image/image_skia.h" |
| 58 #include "ui/resources/grit/ui_resources.h" | 57 #include "ui/resources/grit/ui_resources.h" |
| 59 | 58 |
| 60 #if defined(OS_MACOSX) | |
| 61 #include "content/public/browser/browser_child_process_host.h" | |
| 62 #endif | |
| 63 | |
| 64 using content::BrowserThread; | 59 using content::BrowserThread; |
| 65 using content::ResourceRequestInfo; | 60 using content::ResourceRequestInfo; |
| 66 using content::WebContents; | 61 using content::WebContents; |
| 67 using task_manager::Resource; | 62 using task_manager::Resource; |
| 68 using task_manager::ResourceProvider; | 63 using task_manager::ResourceProvider; |
| 69 using task_manager::WebContentsInformation; | 64 using task_manager::WebContentsInformation; |
| 70 | 65 |
| 71 class Profile; | 66 class Profile; |
| 72 | 67 |
| 73 namespace { | 68 namespace { |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 | 1491 |
| 1497 Resource* TaskManagerModel::GetResource(int index) const { | 1492 Resource* TaskManagerModel::GetResource(int index) const { |
| 1498 CHECK_GE(index, 0); | 1493 CHECK_GE(index, 0); |
| 1499 CHECK_LT(index, static_cast<int>(resources_.size())); | 1494 CHECK_LT(index, static_cast<int>(resources_.size())); |
| 1500 return resources_[index]; | 1495 return resources_[index]; |
| 1501 } | 1496 } |
| 1502 | 1497 |
| 1503 //////////////////////////////////////////////////////////////////////////////// | 1498 //////////////////////////////////////////////////////////////////////////////// |
| 1504 // TaskManager class | 1499 // TaskManager class |
| 1505 //////////////////////////////////////////////////////////////////////////////// | 1500 //////////////////////////////////////////////////////////////////////////////// |
| 1506 // static | |
| 1507 void TaskManager::RegisterPrefs(PrefRegistrySimple* registry) { | |
| 1508 registry->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement); | |
| 1509 registry->RegisterDictionaryPref(prefs::kTaskManagerColumnVisibility); | |
| 1510 registry->RegisterBooleanPref(prefs::kTaskManagerEndProcessEnabled, true); | |
| 1511 } | |
| 1512 | 1501 |
| 1513 // static | 1502 // static |
| 1514 bool TaskManager::IsEndProcessEnabled() { | 1503 bool TaskManager::NewTaskManagerEnabled() { |
| 1515 if (g_browser_process->local_state()) { | 1504 return chrome::ToolkitViewsDialogsEnabled(); |
| 1516 return g_browser_process->local_state()->GetBoolean( | |
| 1517 prefs::kTaskManagerEndProcessEnabled); | |
| 1518 } | |
| 1519 return true; | |
| 1520 } | 1505 } |
| 1521 | 1506 |
| 1522 bool TaskManager::IsBrowserProcess(int index) const { | 1507 bool TaskManager::IsBrowserProcess(int index) const { |
| 1523 // If some of the selection is out of bounds, ignore. This may happen when | 1508 // If some of the selection is out of bounds, ignore. This may happen when |
| 1524 // killing a process that manages several pages. | 1509 // killing a process that manages several pages. |
| 1525 return index < model_->ResourceCount() && | 1510 return index < model_->ResourceCount() && |
| 1526 model_->GetProcess(index) == base::GetCurrentProcessHandle(); | 1511 model_->GetProcess(index) == base::GetCurrentProcessHandle(); |
| 1527 } | 1512 } |
| 1528 | 1513 |
| 1529 void TaskManager::KillProcess(int index) { | 1514 void TaskManager::KillProcess(int index) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 TaskManager* TaskManager::GetInstance() { | 1551 TaskManager* TaskManager::GetInstance() { |
| 1567 return base::Singleton<TaskManager>::get(); | 1552 return base::Singleton<TaskManager>::get(); |
| 1568 } | 1553 } |
| 1569 | 1554 |
| 1570 TaskManager::TaskManager() | 1555 TaskManager::TaskManager() |
| 1571 : model_(new TaskManagerModel(this)) { | 1556 : model_(new TaskManagerModel(this)) { |
| 1572 } | 1557 } |
| 1573 | 1558 |
| 1574 TaskManager::~TaskManager() { | 1559 TaskManager::~TaskManager() { |
| 1575 } | 1560 } |
| OLD | NEW |