| 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/task_manager_view.h" | 5 #include "chrome/browser/ui/views/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 ui::win::SetAppIdForWindow( | 94 ui::win::SetAppIdForWindow( |
| 95 shell_integration::win::GetChromiumModelIdForProfile( | 95 shell_integration::win::GetChromiumModelIdForProfile( |
| 96 browser->profile()->GetPath()), | 96 browser->profile()->GetPath()), |
| 97 views::HWNDForWidget(g_task_manager_view->GetWidget())); | 97 views::HWNDForWidget(g_task_manager_view->GetWidget())); |
| 98 } | 98 } |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 g_task_manager_view->SelectTaskOfActiveTab(browser); | 101 g_task_manager_view->SelectTaskOfActiveTab(browser); |
| 102 g_task_manager_view->GetWidget()->Show(); | 102 g_task_manager_view->GetWidget()->Show(); |
| 103 | 103 |
| 104 // Set the initial focus to the list of tasks. | |
| 105 views::FocusManager* focus_manager = g_task_manager_view->GetFocusManager(); | |
| 106 if (focus_manager) | |
| 107 focus_manager->SetFocusedView(g_task_manager_view->tab_table_); | |
| 108 | |
| 109 #if defined(USE_ASH) | 104 #if defined(USE_ASH) |
| 110 aura::Window* window = g_task_manager_view->GetWidget()->GetNativeWindow(); | 105 aura::Window* window = g_task_manager_view->GetWidget()->GetNativeWindow(); |
| 111 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); | 106 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); |
| 112 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 107 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 113 gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_TASK_MANAGER); | 108 gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_TASK_MANAGER); |
| 114 // The new gfx::ImageSkia instance is owned by the window itself. | 109 // The new gfx::ImageSkia instance is owned by the window itself. |
| 115 window->SetProperty(aura::client::kWindowIconKey, new gfx::ImageSkia(*icon)); | 110 window->SetProperty(aura::client::kWindowIconKey, new gfx::ImageSkia(*icon)); |
| 116 #endif | 111 #endif |
| 117 return g_task_manager_view->table_model_.get(); | 112 return g_task_manager_view->table_model_.get(); |
| 118 } | 113 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return gfx::Size(460, 270); | 154 return gfx::Size(460, 270); |
| 160 } | 155 } |
| 161 | 156 |
| 162 bool TaskManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 157 bool TaskManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 163 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); | 158 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); |
| 164 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); | 159 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); |
| 165 GetWidget()->Close(); | 160 GetWidget()->Close(); |
| 166 return true; | 161 return true; |
| 167 } | 162 } |
| 168 | 163 |
| 164 views::View* TaskManagerView::GetInitiallyFocusedView() { |
| 165 return tab_table_; |
| 166 } |
| 167 |
| 169 bool TaskManagerView::CanResize() const { | 168 bool TaskManagerView::CanResize() const { |
| 170 return true; | 169 return true; |
| 171 } | 170 } |
| 172 | 171 |
| 173 bool TaskManagerView::CanMaximize() const { | 172 bool TaskManagerView::CanMaximize() const { |
| 174 return true; | 173 return true; |
| 175 } | 174 } |
| 176 | 175 |
| 177 bool TaskManagerView::CanMinimize() const { | 176 bool TaskManagerView::CanMinimize() const { |
| 178 return true; | 177 return true; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 if (!g_browser_process->local_state()) | 366 if (!g_browser_process->local_state()) |
| 368 return; | 367 return; |
| 369 | 368 |
| 370 const base::DictionaryValue* dictionary = | 369 const base::DictionaryValue* dictionary = |
| 371 g_browser_process->local_state()->GetDictionary(GetWindowName()); | 370 g_browser_process->local_state()->GetDictionary(GetWindowName()); |
| 372 if (dictionary) | 371 if (dictionary) |
| 373 dictionary->GetBoolean("always_on_top", &is_always_on_top_); | 372 dictionary->GetBoolean("always_on_top", &is_always_on_top_); |
| 374 } | 373 } |
| 375 | 374 |
| 376 } // namespace task_manager | 375 } // namespace task_manager |
| OLD | NEW |