OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stats_table.h" | 10 #include "base/stats_table.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 virtual bool ExecuteWindowsCommand(int command_id); | 215 virtual bool ExecuteWindowsCommand(int command_id); |
216 virtual std::wstring GetWindowTitle() const; | 216 virtual std::wstring GetWindowTitle() const; |
217 virtual std::wstring GetWindowName() const; | 217 virtual std::wstring GetWindowName() const; |
218 virtual int GetDialogButtons() const; | 218 virtual int GetDialogButtons() const; |
219 virtual void WindowClosing(); | 219 virtual void WindowClosing(); |
220 virtual views::View* GetContentsView(); | 220 virtual views::View* GetContentsView(); |
221 | 221 |
222 // views::TableViewObserver implementation. | 222 // views::TableViewObserver implementation. |
223 virtual void OnSelectionChanged(); | 223 virtual void OnSelectionChanged(); |
224 virtual void OnDoubleClick(); | 224 virtual void OnDoubleClick(); |
225 virtual void OnKeyDown(base::KeyboardCode keycode); | 225 virtual void OnKeyDown(app::KeyboardCode keycode); |
226 | 226 |
227 // views::LinkController implementation. | 227 // views::LinkController implementation. |
228 virtual void LinkActivated(views::Link* source, int event_flags); | 228 virtual void LinkActivated(views::Link* source, int event_flags); |
229 | 229 |
230 // Called by the column picker to pick up any new stat counters that | 230 // Called by the column picker to pick up any new stat counters that |
231 // may have appeared since last time. | 231 // may have appeared since last time. |
232 void UpdateStatsCounters(); | 232 void UpdateStatsCounters(); |
233 | 233 |
234 // Menu::Delegate | 234 // Menu::Delegate |
235 virtual void ShowContextMenu(views::View* source, | 235 virtual void ShowContextMenu(views::View* source, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 tab_table_->SetContextMenuController(this); | 365 tab_table_->SetContextMenuController(this); |
366 SetContextMenuController(this); | 366 SetContextMenuController(this); |
367 // If we're running with --purge-memory-button, add a "Purge memory" button. | 367 // If we're running with --purge-memory-button, add a "Purge memory" button. |
368 if (CommandLine::ForCurrentProcess()->HasSwitch( | 368 if (CommandLine::ForCurrentProcess()->HasSwitch( |
369 switches::kPurgeMemoryButton)) { | 369 switches::kPurgeMemoryButton)) { |
370 purge_memory_button_ = new views::NativeButton(this, | 370 purge_memory_button_ = new views::NativeButton(this, |
371 l10n_util::GetString(IDS_TASK_MANAGER_PURGE_MEMORY)); | 371 l10n_util::GetString(IDS_TASK_MANAGER_PURGE_MEMORY)); |
372 } | 372 } |
373 kill_button_ = new views::NativeButton( | 373 kill_button_ = new views::NativeButton( |
374 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL)); | 374 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL)); |
375 kill_button_->AddAccelerator(views::Accelerator(base::VKEY_E, | 375 kill_button_->AddAccelerator(views::Accelerator(app::VKEY_E, |
376 false, false, false)); | 376 false, false, false)); |
377 kill_button_->SetAccessibleKeyboardShortcut(L"E"); | 377 kill_button_->SetAccessibleKeyboardShortcut(L"E"); |
378 about_memory_link_ = new views::Link( | 378 about_memory_link_ = new views::Link( |
379 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); | 379 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); |
380 about_memory_link_->SetController(this); | 380 about_memory_link_->SetController(this); |
381 | 381 |
382 // Makes sure our state is consistent. | 382 // Makes sure our state is consistent. |
383 OnSelectionChanged(); | 383 OnSelectionChanged(); |
384 } | 384 } |
385 | 385 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 581 } |
582 } | 582 } |
583 kill_button_->SetEnabled(!selection_contains_browser_process && | 583 kill_button_->SetEnabled(!selection_contains_browser_process && |
584 tab_table_->SelectedRowCount() > 0); | 584 tab_table_->SelectedRowCount() > 0); |
585 } | 585 } |
586 | 586 |
587 void TaskManagerView::OnDoubleClick() { | 587 void TaskManagerView::OnDoubleClick() { |
588 ActivateFocusedTab(); | 588 ActivateFocusedTab(); |
589 } | 589 } |
590 | 590 |
591 void TaskManagerView::OnKeyDown(base::KeyboardCode keycode) { | 591 void TaskManagerView::OnKeyDown(app::KeyboardCode keycode) { |
592 if (keycode == base::VKEY_RETURN) | 592 if (keycode == app::VKEY_RETURN) |
593 ActivateFocusedTab(); | 593 ActivateFocusedTab(); |
594 } | 594 } |
595 | 595 |
596 // views::LinkController implementation | 596 // views::LinkController implementation |
597 void TaskManagerView::LinkActivated(views::Link* source, int event_flags) { | 597 void TaskManagerView::LinkActivated(views::Link* source, int event_flags) { |
598 DCHECK(source == about_memory_link_); | 598 DCHECK(source == about_memory_link_); |
599 task_manager_->OpenAboutMemory(); | 599 task_manager_->OpenAboutMemory(); |
600 } | 600 } |
601 | 601 |
602 void TaskManagerView::ShowContextMenu(views::View* source, | 602 void TaskManagerView::ShowContextMenu(views::View* source, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } // namespace | 682 } // namespace |
683 | 683 |
684 namespace browser { | 684 namespace browser { |
685 | 685 |
686 // Declared in browser_dialogs.h so others don't need to depend on our header. | 686 // Declared in browser_dialogs.h so others don't need to depend on our header. |
687 void ShowTaskManager() { | 687 void ShowTaskManager() { |
688 TaskManagerView::Show(); | 688 TaskManagerView::Show(); |
689 } | 689 } |
690 | 690 |
691 } // namespace browser | 691 } // namespace browser |
OLD | NEW |