Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: chrome/browser/task_manager/task_manager.cc

Issue 1861383002: Add TaskManagerEndProcessEnabled policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update supported_on to 52 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 return resources_[index]; 1506 return resources_[index];
1507 } 1507 }
1508 1508
1509 //////////////////////////////////////////////////////////////////////////////// 1509 ////////////////////////////////////////////////////////////////////////////////
1510 // TaskManager class 1510 // TaskManager class
1511 //////////////////////////////////////////////////////////////////////////////// 1511 ////////////////////////////////////////////////////////////////////////////////
1512 // static 1512 // static
1513 void TaskManager::RegisterPrefs(PrefRegistrySimple* registry) { 1513 void TaskManager::RegisterPrefs(PrefRegistrySimple* registry) {
1514 registry->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement); 1514 registry->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement);
1515 registry->RegisterDictionaryPref(prefs::kTaskManagerColumnVisibility); 1515 registry->RegisterDictionaryPref(prefs::kTaskManagerColumnVisibility);
1516 registry->RegisterBooleanPref(prefs::kTaskManagerEndProcessEnabled, true);
1517 }
1518
1519 // static
1520 bool TaskManager::IsEndProcessEnabled() {
1521 if (g_browser_process->local_state()) {
1522 return g_browser_process->local_state()->GetBoolean(
1523 prefs::kTaskManagerEndProcessEnabled);
1524 }
1525 return true;
1516 } 1526 }
1517 1527
1518 bool TaskManager::IsBrowserProcess(int index) const { 1528 bool TaskManager::IsBrowserProcess(int index) const {
1519 // If some of the selection is out of bounds, ignore. This may happen when 1529 // If some of the selection is out of bounds, ignore. This may happen when
1520 // killing a process that manages several pages. 1530 // killing a process that manages several pages.
1521 return index < model_->ResourceCount() && 1531 return index < model_->ResourceCount() &&
1522 model_->GetProcess(index) == base::GetCurrentProcessHandle(); 1532 model_->GetProcess(index) == base::GetCurrentProcessHandle();
1523 } 1533 }
1524 1534
1525 void TaskManager::KillProcess(int index) { 1535 void TaskManager::KillProcess(int index) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 TaskManager* TaskManager::GetInstance() { 1572 TaskManager* TaskManager::GetInstance() {
1563 return base::Singleton<TaskManager>::get(); 1573 return base::Singleton<TaskManager>::get();
1564 } 1574 }
1565 1575
1566 TaskManager::TaskManager() 1576 TaskManager::TaskManager()
1567 : model_(new TaskManagerModel(this)) { 1577 : model_(new TaskManagerModel(this)) {
1568 } 1578 }
1569 1579
1570 TaskManager::~TaskManager() { 1580 TaskManager::~TaskManager() {
1571 } 1581 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698