| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/views/new_task_manager_view.h" | 5 #include "chrome/browser/ui/views/new_task_manager_view.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: | 81 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: |
| 82 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: | 82 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: |
| 83 case IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN: | 83 case IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN: |
| 84 return true; | 84 return true; |
| 85 default: | 85 default: |
| 86 return false; | 86 return false; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Opens the "about:memory" for the "stats for nerds" link. | 90 // Opens the "about:memory" for the "stats for nerds" link. |
| 91 void OpenAboutMemory(chrome::HostDesktopType desktop_type) { | 91 void OpenAboutMemory(ui::HostDesktopType desktop_type) { |
| 92 Profile* profile = ProfileManager::GetLastUsedProfileAllowedByPolicy(); | 92 Profile* profile = ProfileManager::GetLastUsedProfileAllowedByPolicy(); |
| 93 if (profile->IsGuestSession() && | 93 if (profile->IsGuestSession() && |
| 94 !g_browser_process->local_state()->GetBoolean( | 94 !g_browser_process->local_state()->GetBoolean( |
| 95 prefs::kBrowserGuestModeEnabled)) { | 95 prefs::kBrowserGuestModeEnabled)) { |
| 96 UserManager::Show(base::FilePath(), | 96 UserManager::Show(base::FilePath(), |
| 97 profiles::USER_MANAGER_NO_TUTORIAL, | 97 profiles::USER_MANAGER_NO_TUTORIAL, |
| 98 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY); | 98 profiles::USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY); |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // static | 833 // static |
| 834 void NewTaskManagerView::Show(Browser* browser) { | 834 void NewTaskManagerView::Show(Browser* browser) { |
| 835 if (g_task_manager_view) { | 835 if (g_task_manager_view) { |
| 836 // If there's a Task manager window open already, just activate it. | 836 // If there's a Task manager window open already, just activate it. |
| 837 g_task_manager_view->GetWidget()->Activate(); | 837 g_task_manager_view->GetWidget()->Activate(); |
| 838 return; | 838 return; |
| 839 } | 839 } |
| 840 | 840 |
| 841 // In ash we can come here through the ChromeShellDelegate. If there is no | 841 // In ash we can come here through the ChromeShellDelegate. If there is no |
| 842 // browser window at that time of the call, browser could be passed as NULL. | 842 // browser window at that time of the call, browser could be passed as NULL. |
| 843 const chrome::HostDesktopType desktop_type = | 843 const ui::HostDesktopType desktop_type = |
| 844 browser ? browser->host_desktop_type() : chrome::HOST_DESKTOP_TYPE_ASH; | 844 browser ? browser->host_desktop_type() : ui::HOST_DESKTOP_TYPE_ASH; |
| 845 | 845 |
| 846 g_task_manager_view = new NewTaskManagerView(desktop_type); | 846 g_task_manager_view = new NewTaskManagerView(desktop_type); |
| 847 | 847 |
| 848 gfx::NativeWindow window = browser ? browser->window()->GetNativeWindow() | 848 gfx::NativeWindow window = browser ? browser->window()->GetNativeWindow() |
| 849 : nullptr; | 849 : nullptr; |
| 850 #if defined(USE_ASH) | 850 #if defined(USE_ASH) |
| 851 if (!window) | 851 if (!window) |
| 852 window = ash::wm::GetActiveWindow(); | 852 window = ash::wm::GetActiveWindow(); |
| 853 #endif | 853 #endif |
| 854 | 854 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 bool NewTaskManagerView::GetAcceleratorForCommandId( | 1069 bool NewTaskManagerView::GetAcceleratorForCommandId( |
| 1070 int command_id, | 1070 int command_id, |
| 1071 ui::Accelerator* accelerator) { | 1071 ui::Accelerator* accelerator) { |
| 1072 return false; | 1072 return false; |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 void NewTaskManagerView::ExecuteCommand(int id, int event_flags) { | 1075 void NewTaskManagerView::ExecuteCommand(int id, int event_flags) { |
| 1076 ToggleColumnVisibility(id); | 1076 ToggleColumnVisibility(id); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 NewTaskManagerView::NewTaskManagerView(chrome::HostDesktopType desktop_type) | 1079 NewTaskManagerView::NewTaskManagerView(ui::HostDesktopType desktop_type) |
| 1080 : table_model_( | 1080 : table_model_(new NewTaskManagerView::TableModel( |
| 1081 new NewTaskManagerView::TableModel(REFRESH_TYPE_CPU | | 1081 REFRESH_TYPE_CPU | REFRESH_TYPE_MEMORY | REFRESH_TYPE_NETWORK_USAGE)), |
| 1082 REFRESH_TYPE_MEMORY | | |
| 1083 REFRESH_TYPE_NETWORK_USAGE)), | |
| 1084 kill_button_(nullptr), | 1082 kill_button_(nullptr), |
| 1085 about_memory_link_(nullptr), | 1083 about_memory_link_(nullptr), |
| 1086 tab_table_(nullptr), | 1084 tab_table_(nullptr), |
| 1087 tab_table_parent_(nullptr), | 1085 tab_table_parent_(nullptr), |
| 1088 desktop_type_(desktop_type), | 1086 desktop_type_(desktop_type), |
| 1089 is_always_on_top_(false) { | 1087 is_always_on_top_(false) { |
| 1090 Init(); | 1088 Init(); |
| 1091 } | 1089 } |
| 1092 | 1090 |
| 1093 // static | 1091 // static |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 | 1235 |
| 1238 void NewTaskManagerView::ToggleColumnVisibility(int column_id) { | 1236 void NewTaskManagerView::ToggleColumnVisibility(int column_id) { |
| 1239 bool new_visibility = !tab_table_->IsColumnVisible(column_id); | 1237 bool new_visibility = !tab_table_->IsColumnVisible(column_id); |
| 1240 tab_table_->SetColumnVisibility(column_id, new_visibility); | 1238 tab_table_->SetColumnVisibility(column_id, new_visibility); |
| 1241 columns_settings_->SetBoolean(GetColumnIdAsString(column_id), new_visibility); | 1239 columns_settings_->SetBoolean(GetColumnIdAsString(column_id), new_visibility); |
| 1242 table_model_->UpdateRefreshTypes(tab_table_, column_id, new_visibility); | 1240 table_model_->UpdateRefreshTypes(tab_table_, column_id, new_visibility); |
| 1243 } | 1241 } |
| 1244 | 1242 |
| 1245 } // namespace task_management | 1243 } // namespace task_management |
| 1246 | 1244 |
| OLD | NEW |