| OLD | NEW |
| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/metrics/stats_table.h" | 8 #include "base/metrics/stats_table.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
| 44 #include "ash/wm/window_util.h" | 44 #include "ash/wm/window_util.h" |
| 45 #include "chrome/browser/ui/ash/launcher/launcher_item_util.h" | 45 #include "chrome/browser/ui/ash/launcher/launcher_item_util.h" |
| 46 #include "grit/ash_resources.h" | 46 #include "grit/ash_resources.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 50 #include "chrome/browser/shell_integration.h" | 50 #include "chrome/browser/shell_integration.h" |
| 51 #include "ui/base/win/shell.h" | 51 #include "ui/base/win/shell.h" |
| 52 #include "ui/views/win/hwnd_util.h" | 52 #include "ui/views/win/hwnd_util.h" |
| 53 #include "win8/util/win8_util.h" | |
| 54 #endif | 53 #endif |
| 55 | 54 |
| 56 namespace { | 55 namespace { |
| 57 | 56 |
| 58 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// |
| 59 // TaskManagerTableModel class | 58 // TaskManagerTableModel class |
| 60 //////////////////////////////////////////////////////////////////////////////// | 59 //////////////////////////////////////////////////////////////////////////////// |
| 61 | 60 |
| 62 class TaskManagerTableModel | 61 class TaskManagerTableModel |
| 63 : public ui::TableModel, | 62 : public ui::TableModel, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 453 |
| 455 bool TaskManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 454 bool TaskManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 456 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); | 455 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); |
| 457 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); | 456 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); |
| 458 GetWidget()->Close(); | 457 GetWidget()->Close(); |
| 459 return true; | 458 return true; |
| 460 } | 459 } |
| 461 | 460 |
| 462 // static | 461 // static |
| 463 void TaskManagerView::Show(Browser* browser) { | 462 void TaskManagerView::Show(Browser* browser) { |
| 464 #if defined(OS_WIN) | |
| 465 // In Windows Metro it's not good to open this native window. | |
| 466 DCHECK(!win8::IsSingleWindowMetroMode()); | |
| 467 #endif | |
| 468 // In ash we can come here through the ChromeShellDelegate. If there is no | 463 // In ash we can come here through the ChromeShellDelegate. If there is no |
| 469 // browser window at that time of the call, browser could be passed as NULL. | 464 // browser window at that time of the call, browser could be passed as NULL. |
| 470 const chrome::HostDesktopType desktop_type = | 465 const chrome::HostDesktopType desktop_type = |
| 471 browser ? browser->host_desktop_type() : chrome::HOST_DESKTOP_TYPE_ASH; | 466 browser ? browser->host_desktop_type() : chrome::HOST_DESKTOP_TYPE_ASH; |
| 472 | 467 |
| 473 if (instance_) { | 468 if (instance_) { |
| 474 // If there's a Task manager window open already, just activate it. | 469 // If there's a Task manager window open already, just activate it. |
| 475 instance_->GetWidget()->Activate(); | 470 instance_->GetWidget()->Activate(); |
| 476 return; | 471 return; |
| 477 } | 472 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 } // namespace | 644 } // namespace |
| 650 | 645 |
| 651 namespace chrome { | 646 namespace chrome { |
| 652 | 647 |
| 653 // Declared in browser_dialogs.h so others don't need to depend on our header. | 648 // Declared in browser_dialogs.h so others don't need to depend on our header. |
| 654 void ShowTaskManager(Browser* browser) { | 649 void ShowTaskManager(Browser* browser) { |
| 655 TaskManagerView::Show(browser); | 650 TaskManagerView::Show(browser); |
| 656 } | 651 } |
| 657 | 652 |
| 658 } // namespace chrome | 653 } // namespace chrome |
| OLD | NEW |