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 17 matching lines...) Expand all Loading... |
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_navigator.h" | 35 #include "chrome/browser/ui/browser_navigator.h" |
36 #include "chrome/browser/ui/browser_navigator_params.h" | 36 #include "chrome/browser/ui/browser_navigator_params.h" |
37 #include "chrome/browser/ui/user_manager.h" | 37 #include "chrome/browser/ui/user_manager.h" |
38 #include "chrome/common/pref_names.h" | |
39 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
40 #include "chrome/grit/generated_resources.h" | 39 #include "chrome/grit/generated_resources.h" |
41 #include "components/nacl/browser/nacl_browser.h" | 40 #include "components/nacl/browser/nacl_browser.h" |
42 #include "components/prefs/pref_registry_simple.h" | |
43 #include "components/prefs/pref_service.h" | |
44 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/gpu_data_manager.h" | 42 #include "content/public/browser/gpu_data_manager.h" |
46 #include "content/public/browser/gpu_data_manager_observer.h" | 43 #include "content/public/browser/gpu_data_manager_observer.h" |
47 #include "content/public/browser/resource_request_info.h" | 44 #include "content/public/browser/resource_request_info.h" |
48 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
49 #include "content/public/browser/web_contents_delegate.h" | 46 #include "content/public/browser/web_contents_delegate.h" |
50 #include "content/public/browser/worker_service.h" | 47 #include "content/public/browser/worker_service.h" |
51 #include "content/public/common/result_codes.h" | 48 #include "content/public/common/result_codes.h" |
52 #include "extensions/browser/extension_system.h" | 49 #include "extensions/browser/extension_system.h" |
53 #include "third_party/icu/source/i18n/unicode/coll.h" | 50 #include "third_party/icu/source/i18n/unicode/coll.h" |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 | 1493 |
1497 Resource* TaskManagerModel::GetResource(int index) const { | 1494 Resource* TaskManagerModel::GetResource(int index) const { |
1498 CHECK_GE(index, 0); | 1495 CHECK_GE(index, 0); |
1499 CHECK_LT(index, static_cast<int>(resources_.size())); | 1496 CHECK_LT(index, static_cast<int>(resources_.size())); |
1500 return resources_[index]; | 1497 return resources_[index]; |
1501 } | 1498 } |
1502 | 1499 |
1503 //////////////////////////////////////////////////////////////////////////////// | 1500 //////////////////////////////////////////////////////////////////////////////// |
1504 // TaskManager class | 1501 // TaskManager class |
1505 //////////////////////////////////////////////////////////////////////////////// | 1502 //////////////////////////////////////////////////////////////////////////////// |
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 | |
1513 // static | |
1514 bool TaskManager::IsEndProcessEnabled() { | |
1515 if (g_browser_process->local_state()) { | |
1516 return g_browser_process->local_state()->GetBoolean( | |
1517 prefs::kTaskManagerEndProcessEnabled); | |
1518 } | |
1519 return true; | |
1520 } | |
1521 | 1503 |
1522 bool TaskManager::IsBrowserProcess(int index) const { | 1504 bool TaskManager::IsBrowserProcess(int index) const { |
1523 // If some of the selection is out of bounds, ignore. This may happen when | 1505 // If some of the selection is out of bounds, ignore. This may happen when |
1524 // killing a process that manages several pages. | 1506 // killing a process that manages several pages. |
1525 return index < model_->ResourceCount() && | 1507 return index < model_->ResourceCount() && |
1526 model_->GetProcess(index) == base::GetCurrentProcessHandle(); | 1508 model_->GetProcess(index) == base::GetCurrentProcessHandle(); |
1527 } | 1509 } |
1528 | 1510 |
1529 void TaskManager::KillProcess(int index) { | 1511 void TaskManager::KillProcess(int index) { |
1530 base::ProcessHandle process_handle = model_->GetProcess(index); | 1512 base::ProcessHandle process_handle = model_->GetProcess(index); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 TaskManager* TaskManager::GetInstance() { | 1548 TaskManager* TaskManager::GetInstance() { |
1567 return base::Singleton<TaskManager>::get(); | 1549 return base::Singleton<TaskManager>::get(); |
1568 } | 1550 } |
1569 | 1551 |
1570 TaskManager::TaskManager() | 1552 TaskManager::TaskManager() |
1571 : model_(new TaskManagerModel(this)) { | 1553 : model_(new TaskManagerModel(this)) { |
1572 } | 1554 } |
1573 | 1555 |
1574 TaskManager::~TaskManager() { | 1556 TaskManager::~TaskManager() { |
1575 } | 1557 } |
OLD | NEW |