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

Unified Diff: ash/launcher/launcher_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/root_window_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_view.cc
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 0d1f89872c8e304a0210b429bf6a8db7926152f3..70292f21932643b1e35004b8547f7ebc84973cb8 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -1498,14 +1498,14 @@ void LauncherView::ButtonPressed(views::Button* sender,
}
if (model_->items()[view_index].type != TYPE_APP_LIST)
- ShowListMenuForView(model_->items()[view_index], sender, event.flags());
+ ShowListMenuForView(model_->items()[view_index], sender, event);
}
bool LauncherView::ShowListMenuForView(const LauncherItem& item,
views::View* source,
- int event_flags) {
+ const ui::Event& event) {
scoped_ptr<ash::LauncherMenuModel> menu_model;
- menu_model.reset(delegate_->CreateApplicationMenu(item, event_flags));
+ menu_model.reset(delegate_->CreateApplicationMenu(item, event.flags()));
// Make sure we have a menu and it has at least two items in addition to the
// application title and the 3 spacing separators.
@@ -1516,12 +1516,14 @@ bool LauncherView::ShowListMenuForView(const LauncherItem& item,
new LauncherMenuModelAdapter(menu_model.get())),
source,
gfx::Point(),
- false);
+ false,
+ ui::GetMenuSourceTypeForEvent(event));
return true;
}
void LauncherView::ShowContextMenuForView(views::View* source,
- const gfx::Point& point) {
+ const gfx::Point& point,
+ ui:: MenuSourceType source_type) {
int view_index = view_model_->GetIndexOfView(source);
if (view_index != -1 &&
model_->items()[view_index].type == TYPE_APP_LIST) {
@@ -1531,7 +1533,7 @@ void LauncherView::ShowContextMenuForView(views::View* source,
tooltip_->Close();
if (view_index == -1) {
- Shell::GetInstance()->ShowContextMenu(point);
+ Shell::GetInstance()->ShowContextMenu(point, source_type);
return;
}
scoped_ptr<ui::MenuModel> menu_model(delegate_->CreateContextMenu(
@@ -1547,14 +1549,16 @@ void LauncherView::ShowContextMenuForView(views::View* source,
new views::MenuModelAdapter(menu_model.get())),
source,
point,
- true);
+ true,
+ source_type);
}
void LauncherView::ShowMenu(
scoped_ptr<views::MenuModelAdapter> menu_model_adapter,
views::View* source,
const gfx::Point& click_point,
- bool context_menu) {
+ bool context_menu,
+ ui::MenuSourceType source_type) {
closing_event_time_ = base::TimeDelta();
launcher_menu_runner_.reset(
new views::MenuRunner(menu_model_adapter->CreateMenu()));
@@ -1612,7 +1616,9 @@ void LauncherView::ShowMenu(
NULL,
anchor_point,
menu_alignment,
- views::MenuRunner::CONTEXT_MENU) == views::MenuRunner::MENU_DELETED) {
+ source_type,
+ context_menu ? views::MenuRunner::CONTEXT_MENU : 0) ==
+ views::MenuRunner::MENU_DELETED) {
if (!got_deleted) {
got_deleted_ = NULL;
shelf->ForceUndimming(false);
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/root_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698