| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 NewTaskManagerView* g_task_manager_view = nullptr; | 46 NewTaskManagerView* g_task_manager_view = nullptr; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 NewTaskManagerView::~NewTaskManagerView() { | 50 NewTaskManagerView::~NewTaskManagerView() { |
| 51 // Delete child views now, while our table model still exists. | 51 // Delete child views now, while our table model still exists. |
| 52 RemoveAllChildViews(true); | 52 RemoveAllChildViews(true); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 void NewTaskManagerView::Show(Browser* browser) { | 56 task_management::TaskManagerTableModel* NewTaskManagerView::Show( |
| 57 Browser* browser) { |
| 57 if (g_task_manager_view) { | 58 if (g_task_manager_view) { |
| 58 // If there's a Task manager window open already, just activate it. | 59 // If there's a Task manager window open already, just activate it. |
| 59 g_task_manager_view->GetWidget()->Activate(); | 60 g_task_manager_view->GetWidget()->Activate(); |
| 60 return; | 61 return g_task_manager_view->table_model_.get(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 g_task_manager_view = new NewTaskManagerView(); | 64 g_task_manager_view = new NewTaskManagerView(); |
| 64 | 65 |
| 65 gfx::NativeWindow window = browser ? browser->window()->GetNativeWindow() | 66 gfx::NativeWindow window = browser ? browser->window()->GetNativeWindow() |
| 66 : nullptr; | 67 : nullptr; |
| 67 #if defined(USE_ASH) | 68 #if defined(USE_ASH) |
| 68 if (!window) | 69 if (!window) |
| 69 window = ash::wm::GetActiveWindow(); | 70 window = ash::wm::GetActiveWindow(); |
| 70 #endif | 71 #endif |
| (...skipping 23 matching lines...) Expand all Loading... |
| 94 if (focus_manager) | 95 if (focus_manager) |
| 95 focus_manager->SetFocusedView(g_task_manager_view->tab_table_); | 96 focus_manager->SetFocusedView(g_task_manager_view->tab_table_); |
| 96 | 97 |
| 97 #if defined(USE_ASH) | 98 #if defined(USE_ASH) |
| 98 gfx::NativeWindow native_window = | 99 gfx::NativeWindow native_window = |
| 99 g_task_manager_view->GetWidget()->GetNativeWindow(); | 100 g_task_manager_view->GetWidget()->GetNativeWindow(); |
| 100 ash::SetShelfItemDetailsForDialogWindow(native_window, | 101 ash::SetShelfItemDetailsForDialogWindow(native_window, |
| 101 IDR_ASH_SHELF_ICON_TASK_MANAGER, | 102 IDR_ASH_SHELF_ICON_TASK_MANAGER, |
| 102 native_window->title()); | 103 native_window->title()); |
| 103 #endif | 104 #endif |
| 105 return g_task_manager_view->table_model_.get(); |
| 104 } | 106 } |
| 105 | 107 |
| 106 // static | 108 // static |
| 107 void NewTaskManagerView::Hide() { | 109 void NewTaskManagerView::Hide() { |
| 108 if (g_task_manager_view) | 110 if (g_task_manager_view) |
| 109 g_task_manager_view->GetWidget()->Close(); | 111 g_task_manager_view->GetWidget()->Close(); |
| 110 } | 112 } |
| 111 | 113 |
| 112 bool NewTaskManagerView::IsColumnVisible(int column_id) const { | 114 bool NewTaskManagerView::IsColumnVisible(int column_id) const { |
| 113 return tab_table_->IsColumnVisible(column_id); | 115 return tab_table_->IsColumnVisible(column_id); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (!g_browser_process->local_state()) | 376 if (!g_browser_process->local_state()) |
| 375 return; | 377 return; |
| 376 | 378 |
| 377 const base::DictionaryValue* dictionary = | 379 const base::DictionaryValue* dictionary = |
| 378 g_browser_process->local_state()->GetDictionary(GetWindowName()); | 380 g_browser_process->local_state()->GetDictionary(GetWindowName()); |
| 379 if (dictionary) | 381 if (dictionary) |
| 380 dictionary->GetBoolean("always_on_top", &is_always_on_top_); | 382 dictionary->GetBoolean("always_on_top", &is_always_on_top_); |
| 381 } | 383 } |
| 382 | 384 |
| 383 } // namespace task_management | 385 } // namespace task_management |
| OLD | NEW |