OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/task_manager.h" |
6 | 6 |
7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
8 #include "base/stats_table.h" | 8 #include "base/stats_table.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 UpdateStatsCounters(); | 777 UpdateStatsCounters(); |
778 views::TableColumn col(kGoatsTeleportedColumn, L"Goats Teleported", | 778 views::TableColumn col(kGoatsTeleportedColumn, L"Goats Teleported", |
779 views::TableColumn::RIGHT, -1, 0); | 779 views::TableColumn::RIGHT, -1, 0); |
780 col.sortable = true; | 780 col.sortable = true; |
781 columns_.push_back(col); | 781 columns_.push_back(col); |
782 tab_table_->AddColumn(col); | 782 tab_table_->AddColumn(col); |
783 tab_table_->SetObserver(this); | 783 tab_table_->SetObserver(this); |
784 SetContextMenuController(this); | 784 SetContextMenuController(this); |
785 kill_button_.reset(new views::NativeButton( | 785 kill_button_.reset(new views::NativeButton( |
786 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL))); | 786 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL))); |
787 // TODO(hamaji): Use accelerator once the bug in FocusManager fixed. | 787 kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); |
788 // http://crbug.com/11073 | |
789 // kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); | |
790 kill_button_->SetAccessibleKeyboardShortcut(L"E"); | 788 kill_button_->SetAccessibleKeyboardShortcut(L"E"); |
791 about_memory_link_.reset(new views::Link( | 789 about_memory_link_.reset(new views::Link( |
792 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK))); | 790 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK))); |
793 about_memory_link_->SetController(this); | 791 about_memory_link_->SetController(this); |
794 | 792 |
795 AddChildView(tab_table_); | 793 AddChildView(tab_table_); |
796 | 794 |
797 // Makes sure our state is consistent. | 795 // Makes sure our state is consistent. |
798 OnSelectionChanged(); | 796 OnSelectionChanged(); |
799 } | 797 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 tab_table_->SelectedRowCount() > 0); | 911 tab_table_->SelectedRowCount() > 0); |
914 } | 912 } |
915 | 913 |
916 void TaskManagerContents::OnDoubleClick() { | 914 void TaskManagerContents::OnDoubleClick() { |
917 task_manager_->ActivateFocusedTab(); | 915 task_manager_->ActivateFocusedTab(); |
918 } | 916 } |
919 | 917 |
920 void TaskManagerContents::OnKeyDown(unsigned short virtual_keycode) { | 918 void TaskManagerContents::OnKeyDown(unsigned short virtual_keycode) { |
921 if (virtual_keycode == VK_RETURN) | 919 if (virtual_keycode == VK_RETURN) |
922 task_manager_->ActivateFocusedTab(); | 920 task_manager_->ActivateFocusedTab(); |
923 else if (virtual_keycode == 'E') | |
924 task_manager_->KillSelectedProcesses(); | |
925 } | 921 } |
926 | 922 |
927 // views::LinkController implementation | 923 // views::LinkController implementation |
928 void TaskManagerContents::LinkActivated(views::Link* source, | 924 void TaskManagerContents::LinkActivated(views::Link* source, |
929 int event_flags) { | 925 int event_flags) { |
930 DCHECK(source == about_memory_link_); | 926 DCHECK(source == about_memory_link_); |
931 Browser* browser = BrowserList::GetLastActive(); | 927 Browser* browser = BrowserList::GetLastActive(); |
932 DCHECK(browser); | 928 DCHECK(browser); |
933 browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB, | 929 browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB, |
934 PageTransition::LINK); | 930 PageTransition::LINK); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } | 1103 } |
1108 | 1104 |
1109 views::View* TaskManager::GetContentsView() { | 1105 views::View* TaskManager::GetContentsView() { |
1110 return contents_.get(); | 1106 return contents_.get(); |
1111 } | 1107 } |
1112 | 1108 |
1113 // static | 1109 // static |
1114 TaskManager* TaskManager::GetInstance() { | 1110 TaskManager* TaskManager::GetInstance() { |
1115 return Singleton<TaskManager>::get(); | 1111 return Singleton<TaskManager>::get(); |
1116 } | 1112 } |
OLD | NEW |