Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/profiles/profile_window.h" | 12 #include "chrome/browser/profiles/profile_window.h" |
| 13 #include "chrome/browser/task_management/task_manager_interface.h" | |
| 13 #include "chrome/browser/task_management/task_manager_observer.h" | 14 #include "chrome/browser/task_management/task_manager_observer.h" |
| 14 #include "chrome/browser/task_manager/task_manager.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 15 #include "chrome/browser/ui/browser_navigator_params.h" | 16 #include "chrome/browser/ui/browser_navigator_params.h" |
| 16 #include "chrome/browser/ui/task_manager/task_manager_columns.h" | 17 #include "chrome/browser/ui/task_manager/task_manager_columns.h" |
| 17 #include "chrome/browser/ui/user_manager.h" | 18 #include "chrome/browser/ui/user_manager.h" |
| 18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 21 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/prefs/pref_service.h" | 23 #include "components/prefs/pref_service.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/models/table_model_observer.h" | 25 #include "ui/base/models/table_model_observer.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 } | 204 } |
| 204 | 205 |
| 205 bool NewTaskManagerView::IsDialogButtonEnabled(ui::DialogButton button) const { | 206 bool NewTaskManagerView::IsDialogButtonEnabled(ui::DialogButton button) const { |
| 206 const ui::ListSelectionModel::SelectedIndices& selections( | 207 const ui::ListSelectionModel::SelectedIndices& selections( |
| 207 tab_table_->selection_model().selected_indices()); | 208 tab_table_->selection_model().selected_indices()); |
| 208 for (const auto& selection : selections) { | 209 for (const auto& selection : selections) { |
| 209 if (table_model_->IsBrowserProcess(selection)) | 210 if (table_model_->IsBrowserProcess(selection)) |
| 210 return false; | 211 return false; |
| 211 } | 212 } |
| 212 | 213 |
| 213 return !selections.empty() && TaskManager::IsEndProcessEnabled(); | 214 return !selections.empty() && TaskManagerInterface::IsEndProcessEnabled(); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void NewTaskManagerView::WindowClosing() { | 217 void NewTaskManagerView::WindowClosing() { |
| 217 // Now that the window is closed, we can allow a new one to be opened. | 218 // Now that the window is closed, we can allow a new one to be opened. |
| 218 // (WindowClosing comes in asynchronously from the call to Close() and we | 219 // (WindowClosing comes in asynchronously from the call to Close() and we |
| 219 // may have already opened a new instance). | 220 // may have already opened a new instance). |
| 220 if (g_task_manager_view == this) { | 221 if (g_task_manager_view == this) { |
| 221 // We don't have to delete |g_task_manager_view| as we don't own it. It's | 222 // We don't have to delete |g_task_manager_view| as we don't own it. It's |
| 222 // owned by the Views hierarchy. | 223 // owned by the Views hierarchy. |
| 223 g_task_manager_view = nullptr; | 224 g_task_manager_view = nullptr; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 if (!g_browser_process->local_state()) | 355 if (!g_browser_process->local_state()) |
| 355 return; | 356 return; |
| 356 | 357 |
| 357 const base::DictionaryValue* dictionary = | 358 const base::DictionaryValue* dictionary = |
| 358 g_browser_process->local_state()->GetDictionary(GetWindowName()); | 359 g_browser_process->local_state()->GetDictionary(GetWindowName()); |
| 359 if (dictionary) | 360 if (dictionary) |
| 360 dictionary->GetBoolean("always_on_top", &is_always_on_top_); | 361 dictionary->GetBoolean("always_on_top", &is_always_on_top_); |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace task_management | 364 } // namespace task_management |
| 365 | |
| 366 #if !defined(OS_MACOSX) | |
| 367 | |
| 368 namespace chrome { | |
| 369 | |
| 370 // Declared in browser_dialogs.h so others don't need to depend on our header. | |
| 371 ui::TableModel* ShowTaskManager(Browser* browser) { | |
|
tapted
2016/05/20 00:08:45
These need to go in browser_dialogs_views.cc this
afakhry
2016/05/20 02:32:50
Done.
| |
| 372 return task_management::NewTaskManagerView::Show(browser); | |
| 373 } | |
| 374 | |
| 375 void HideTaskManager() { | |
| 376 task_management::NewTaskManagerView::Hide(); | |
| 377 } | |
| 378 | |
| 379 } // namespace chrome | |
| 380 | |
| 381 #endif // !defined(OS_MACOSX) | |
| OLD | NEW |