| 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/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" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 // views::LinkListener implementation. | 305 // views::LinkListener implementation. |
| 306 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 306 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 307 | 307 |
| 308 // Called by the column picker to pick up any new stat counters that | 308 // Called by the column picker to pick up any new stat counters that |
| 309 // may have appeared since last time. | 309 // may have appeared since last time. |
| 310 void UpdateStatsCounters(); | 310 void UpdateStatsCounters(); |
| 311 | 311 |
| 312 // views::ContextMenuController | 312 // views::ContextMenuController |
| 313 virtual void ShowContextMenuForView(views::View* source, | 313 virtual void ShowContextMenuForView(views::View* source, |
| 314 const gfx::Point& p, | 314 const gfx::Point& point, |
| 315 bool is_mouse_gesture) OVERRIDE; | 315 views::GestureType gesture_type) OVERRIDE; |
| 316 | 316 |
| 317 // views::Menu::Delegate | 317 // views::Menu::Delegate |
| 318 virtual bool IsItemChecked(int id) const OVERRIDE; | 318 virtual bool IsItemChecked(int id) const OVERRIDE; |
| 319 virtual void ExecuteCommand(int id) OVERRIDE; | 319 virtual void ExecuteCommand(int id) OVERRIDE; |
| 320 | 320 |
| 321 private: | 321 private: |
| 322 // Creates the child controls. | 322 // Creates the child controls. |
| 323 void Init(); | 323 void Init(); |
| 324 | 324 |
| 325 // Initializes the state of the always-on-top setting as the window is shown. | 325 // Initializes the state of the always-on-top setting as the window is shown. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 if (keycode == ui::VKEY_RETURN) | 701 if (keycode == ui::VKEY_RETURN) |
| 702 ActivateFocusedTab(); | 702 ActivateFocusedTab(); |
| 703 } | 703 } |
| 704 | 704 |
| 705 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) { | 705 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) { |
| 706 DCHECK(source == about_memory_link_); | 706 DCHECK(source == about_memory_link_); |
| 707 task_manager_->OpenAboutMemory(); | 707 task_manager_->OpenAboutMemory(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 void TaskManagerView::ShowContextMenuForView(views::View* source, | 710 void TaskManagerView::ShowContextMenuForView(views::View* source, |
| 711 const gfx::Point& p, | 711 const gfx::Point& point, |
| 712 bool is_mouse_gesture) { | 712 views::GestureType gesture_type) { |
| 713 UpdateStatsCounters(); | 713 UpdateStatsCounters(); |
| 714 scoped_ptr<views::Menu> menu(views::Menu::Create( | 714 scoped_ptr<views::Menu> menu(views::Menu::Create( |
| 715 this, views::Menu::TOPLEFT, source->GetWidget()->GetNativeView())); | 715 this, views::Menu::TOPLEFT, source->GetWidget()->GetNativeView())); |
| 716 for (std::vector<ui::TableColumn>::iterator i = | 716 for (std::vector<ui::TableColumn>::iterator i = |
| 717 columns_.begin(); i != columns_.end(); ++i) { | 717 columns_.begin(); i != columns_.end(); ++i) { |
| 718 menu->AppendMenuItem(i->id, l10n_util::GetStringUTF16(i->id), | 718 menu->AppendMenuItem(i->id, l10n_util::GetStringUTF16(i->id), |
| 719 views::Menu::CHECKBOX); | 719 views::Menu::CHECKBOX); |
| 720 } | 720 } |
| 721 menu->RunMenuAt(p.x(), p.y()); | 721 menu->RunMenuAt(point.x(), point.y()); |
| 722 } | 722 } |
| 723 | 723 |
| 724 bool TaskManagerView::IsItemChecked(int id) const { | 724 bool TaskManagerView::IsItemChecked(int id) const { |
| 725 return tab_table_->IsColumnVisible(id); | 725 return tab_table_->IsColumnVisible(id); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void TaskManagerView::ExecuteCommand(int id) { | 728 void TaskManagerView::ExecuteCommand(int id) { |
| 729 tab_table_->SetColumnVisibility(id, !tab_table_->IsColumnVisible(id)); | 729 tab_table_->SetColumnVisibility(id, !tab_table_->IsColumnVisible(id)); |
| 730 } | 730 } |
| 731 | 731 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 // Declared in browser_dialogs.h so others don't need to depend on our header. | 797 // Declared in browser_dialogs.h so others don't need to depend on our header. |
| 798 void ShowTaskManager() { | 798 void ShowTaskManager() { |
| 799 TaskManagerView::Show(false); | 799 TaskManagerView::Show(false); |
| 800 } | 800 } |
| 801 | 801 |
| 802 void ShowBackgroundPages() { | 802 void ShowBackgroundPages() { |
| 803 TaskManagerView::Show(true); | 803 TaskManagerView::Show(true); |
| 804 } | 804 } |
| 805 | 805 |
| 806 } // namespace browser | 806 } // namespace browser |
| OLD | NEW |