OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/metrics/stats_table.h" | 9 #include "base/metrics/stats_table.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/memory_purger.h" | 13 #include "chrome/browser/memory_purger.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 15 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/views/browser_dialogs.h" | 18 #include "chrome/browser/ui/views/browser_dialogs.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/models/accelerator.h" |
25 #include "ui/base/models/table_model_observer.h" | 26 #include "ui/base/models/table_model_observer.h" |
26 #include "views/accelerator.h" | |
27 #include "views/background.h" | 27 #include "views/background.h" |
28 #include "views/context_menu_controller.h" | 28 #include "views/context_menu_controller.h" |
29 #include "views/controls/button/text_button.h" | 29 #include "views/controls/button/text_button.h" |
30 #include "views/controls/link.h" | 30 #include "views/controls/link.h" |
31 #include "views/controls/link_listener.h" | 31 #include "views/controls/link_listener.h" |
32 #include "views/controls/menu/menu.h" | 32 #include "views/controls/menu/menu.h" |
33 #include "views/controls/table/group_table_view.h" | 33 #include "views/controls/table/group_table_view.h" |
34 #include "views/controls/table/table_view_observer.h" | 34 #include "views/controls/table/table_view_observer.h" |
35 #include "views/layout/layout_constants.h" | 35 #include "views/layout/layout_constants.h" |
36 #include "views/widget/widget.h" | 36 #include "views/widget/widget.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 tab_table_->set_context_menu_controller(this); | 456 tab_table_->set_context_menu_controller(this); |
457 set_context_menu_controller(this); | 457 set_context_menu_controller(this); |
458 // If we're running with --purge-memory-button, add a "Purge memory" button. | 458 // If we're running with --purge-memory-button, add a "Purge memory" button. |
459 if (CommandLine::ForCurrentProcess()->HasSwitch( | 459 if (CommandLine::ForCurrentProcess()->HasSwitch( |
460 switches::kPurgeMemoryButton)) { | 460 switches::kPurgeMemoryButton)) { |
461 purge_memory_button_ = new views::NativeTextButton(this, | 461 purge_memory_button_ = new views::NativeTextButton(this, |
462 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_PURGE_MEMORY))); | 462 UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_PURGE_MEMORY))); |
463 } | 463 } |
464 kill_button_ = new views::NativeTextButton( | 464 kill_button_ = new views::NativeTextButton( |
465 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL))); | 465 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL))); |
466 kill_button_->AddAccelerator(views::Accelerator(ui::VKEY_E, | 466 kill_button_->AddAccelerator(ui::Accelerator(ui::VKEY_E, false, false, |
467 false, false, false)); | 467 false)); |
468 kill_button_->SetAccessibleKeyboardShortcut(L"E"); | 468 kill_button_->SetAccessibleKeyboardShortcut(L"E"); |
469 kill_button_->set_prefix_type(views::TextButtonBase::PREFIX_SHOW); | 469 kill_button_->set_prefix_type(views::TextButtonBase::PREFIX_SHOW); |
470 about_memory_link_ = new views::Link( | 470 about_memory_link_ = new views::Link( |
471 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); | 471 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); |
472 about_memory_link_->set_listener(this); | 472 about_memory_link_->set_listener(this); |
473 | 473 |
474 // Makes sure our state is consistent. | 474 // Makes sure our state is consistent. |
475 OnSelectionChanged(); | 475 OnSelectionChanged(); |
476 } | 476 } |
477 | 477 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // Declared in browser_dialogs.h so others don't need to depend on our header. | 795 // Declared in browser_dialogs.h so others don't need to depend on our header. |
796 void ShowTaskManager() { | 796 void ShowTaskManager() { |
797 TaskManagerView::Show(false); | 797 TaskManagerView::Show(false); |
798 } | 798 } |
799 | 799 |
800 void ShowBackgroundPages() { | 800 void ShowBackgroundPages() { |
801 TaskManagerView::Show(true); | 801 TaskManagerView::Show(true); |
802 } | 802 } |
803 | 803 |
804 } // namespace browser | 804 } // namespace browser |
OLD | NEW |