Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/ui/views/task_manager_view.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 virtual void OnKeyDown(ui::KeyboardCode keycode) OVERRIDE; 235 virtual void OnKeyDown(ui::KeyboardCode keycode) OVERRIDE;
236 236
237 // views::LinkListener: 237 // views::LinkListener:
238 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 238 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
239 239
240 // Called by the column picker to pick up any new stat counters that 240 // Called by the column picker to pick up any new stat counters that
241 // may have appeared since last time. 241 // may have appeared since last time.
242 void UpdateStatsCounters(); 242 void UpdateStatsCounters();
243 243
244 // views::ContextMenuController: 244 // views::ContextMenuController:
245 virtual void ShowContextMenuForView(views::View* source, 245 virtual void ShowContextMenuForView(
246 const gfx::Point& point) OVERRIDE; 246 views::View* source,
247 const gfx::Point& point,
248 ui::ContextMenuSourceType source_type) OVERRIDE;
247 249
248 // ui::SimpleMenuModel::Delegate: 250 // ui::SimpleMenuModel::Delegate:
249 virtual bool IsCommandIdChecked(int id) const OVERRIDE; 251 virtual bool IsCommandIdChecked(int id) const OVERRIDE;
250 virtual bool IsCommandIdEnabled(int id) const OVERRIDE; 252 virtual bool IsCommandIdEnabled(int id) const OVERRIDE;
251 virtual bool GetAcceleratorForCommandId( 253 virtual bool GetAcceleratorForCommandId(
252 int command_id, 254 int command_id,
253 ui::Accelerator* accelerator) OVERRIDE; 255 ui::Accelerator* accelerator) OVERRIDE;
254 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; 256 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE;
255 257
256 private: 258 private:
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 void TaskManagerView::OnKeyDown(ui::KeyboardCode keycode) { 677 void TaskManagerView::OnKeyDown(ui::KeyboardCode keycode) {
676 if (keycode == ui::VKEY_RETURN) 678 if (keycode == ui::VKEY_RETURN)
677 ActivateFocusedTab(); 679 ActivateFocusedTab();
678 } 680 }
679 681
680 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) { 682 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) {
681 DCHECK_EQ(about_memory_link_, source); 683 DCHECK_EQ(about_memory_link_, source);
682 task_manager_->OpenAboutMemory(desktop_type_); 684 task_manager_->OpenAboutMemory(desktop_type_);
683 } 685 }
684 686
685 void TaskManagerView::ShowContextMenuForView(views::View* source, 687 void TaskManagerView::ShowContextMenuForView(
686 const gfx::Point& point) { 688 views::View* source,
689 const gfx::Point& point,
690 ui::ContextMenuSourceType source_type) {
687 UpdateStatsCounters(); 691 UpdateStatsCounters();
688 ui::SimpleMenuModel menu_model(this); 692 ui::SimpleMenuModel menu_model(this);
689 for (std::vector<ui::TableColumn>::iterator i(columns_.begin()); 693 for (std::vector<ui::TableColumn>::iterator i(columns_.begin());
690 i != columns_.end(); ++i) { 694 i != columns_.end(); ++i) {
691 menu_model.AddCheckItem(i->id, l10n_util::GetStringUTF16(i->id)); 695 menu_model.AddCheckItem(i->id, l10n_util::GetStringUTF16(i->id));
692 } 696 }
693 menu_runner_.reset(new views::MenuRunner(&menu_model)); 697 menu_runner_.reset(new views::MenuRunner(&menu_model));
694 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()), 698 if (menu_runner_->RunContextMenuAt(GetWidget(), NULL,
695 views::MenuItemView::TOPLEFT, 699 gfx::Rect(point, gfx::Size()),
696 views::MenuRunner::CONTEXT_MENU) == 700 source_type,
701 views::MenuRunner::CONTEXT_MENU) ==
697 views::MenuRunner::MENU_DELETED) 702 views::MenuRunner::MENU_DELETED)
698 return; 703 return;
699 } 704 }
700 705
701 bool TaskManagerView::IsCommandIdChecked(int id) const { 706 bool TaskManagerView::IsCommandIdChecked(int id) const {
702 return tab_table_->IsColumnVisible(id); 707 return tab_table_->IsColumnVisible(id);
703 } 708 }
704 709
705 bool TaskManagerView::IsCommandIdEnabled(int id) const { 710 bool TaskManagerView::IsCommandIdEnabled(int id) const {
706 return true; 711 return true;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } // namespace 780 } // namespace
776 781
777 namespace chrome { 782 namespace chrome {
778 783
779 // Declared in browser_dialogs.h so others don't need to depend on our header. 784 // Declared in browser_dialogs.h so others don't need to depend on our header.
780 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { 785 void ShowTaskManager(Browser* browser, bool highlight_background_resources) {
781 TaskManagerView::Show(highlight_background_resources, browser); 786 TaskManagerView::Show(highlight_background_resources, browser);
782 } 787 }
783 788
784 } // namespace chrome 789 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698