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

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: patch 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(views::View* source,
246 const gfx::Point& point) OVERRIDE; 246 const gfx::Point& point,
247 ui::MenuSourceType source_type) OVERRIDE;
247 248
248 // ui::SimpleMenuModel::Delegate: 249 // ui::SimpleMenuModel::Delegate:
249 virtual bool IsCommandIdChecked(int id) const OVERRIDE; 250 virtual bool IsCommandIdChecked(int id) const OVERRIDE;
250 virtual bool IsCommandIdEnabled(int id) const OVERRIDE; 251 virtual bool IsCommandIdEnabled(int id) const OVERRIDE;
251 virtual bool GetAcceleratorForCommandId( 252 virtual bool GetAcceleratorForCommandId(
252 int command_id, 253 int command_id,
253 ui::Accelerator* accelerator) OVERRIDE; 254 ui::Accelerator* accelerator) OVERRIDE;
254 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; 255 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE;
255 256
256 private: 257 private:
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 if (keycode == ui::VKEY_RETURN) 677 if (keycode == ui::VKEY_RETURN)
677 ActivateFocusedTab(); 678 ActivateFocusedTab();
678 } 679 }
679 680
680 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) { 681 void TaskManagerView::LinkClicked(views::Link* source, int event_flags) {
681 DCHECK_EQ(about_memory_link_, source); 682 DCHECK_EQ(about_memory_link_, source);
682 task_manager_->OpenAboutMemory(desktop_type_); 683 task_manager_->OpenAboutMemory(desktop_type_);
683 } 684 }
684 685
685 void TaskManagerView::ShowContextMenuForView(views::View* source, 686 void TaskManagerView::ShowContextMenuForView(views::View* source,
686 const gfx::Point& point) { 687 const gfx::Point& point,
688 ui::MenuSourceType source_type) {
687 UpdateStatsCounters(); 689 UpdateStatsCounters();
688 ui::SimpleMenuModel menu_model(this); 690 ui::SimpleMenuModel menu_model(this);
689 for (std::vector<ui::TableColumn>::iterator i(columns_.begin()); 691 for (std::vector<ui::TableColumn>::iterator i(columns_.begin());
690 i != columns_.end(); ++i) { 692 i != columns_.end(); ++i) {
691 menu_model.AddCheckItem(i->id, l10n_util::GetStringUTF16(i->id)); 693 menu_model.AddCheckItem(i->id, l10n_util::GetStringUTF16(i->id));
692 } 694 }
693 menu_runner_.reset(new views::MenuRunner(&menu_model)); 695 menu_runner_.reset(new views::MenuRunner(&menu_model));
694 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()), 696 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(point, gfx::Size()),
695 views::MenuItemView::TOPLEFT, 697 views::MenuItemView::TOPLEFT, source_type,
696 views::MenuRunner::CONTEXT_MENU) == 698 views::MenuRunner::CONTEXT_MENU) ==
697 views::MenuRunner::MENU_DELETED) 699 views::MenuRunner::MENU_DELETED)
698 return; 700 return;
699 } 701 }
700 702
701 bool TaskManagerView::IsCommandIdChecked(int id) const { 703 bool TaskManagerView::IsCommandIdChecked(int id) const {
702 return tab_table_->IsColumnVisible(id); 704 return tab_table_->IsColumnVisible(id);
703 } 705 }
704 706
705 bool TaskManagerView::IsCommandIdEnabled(int id) const { 707 bool TaskManagerView::IsCommandIdEnabled(int id) const {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } // namespace 777 } // namespace
776 778
777 namespace chrome { 779 namespace chrome {
778 780
779 // Declared in browser_dialogs.h so others don't need to depend on our header. 781 // Declared in browser_dialogs.h so others don't need to depend on our header.
780 void ShowTaskManager(Browser* browser, bool highlight_background_resources) { 782 void ShowTaskManager(Browser* browser, bool highlight_background_resources) {
781 TaskManagerView::Show(highlight_background_resources, browser); 783 TaskManagerView::Show(highlight_background_resources, browser);
782 } 784 }
783 785
784 } // namespace chrome 786 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_unittest.cc ('k') | chrome/browser/ui/views/website_settings/permission_selector_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698