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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build 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
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 86cd597fe313963898a5caea4661535a2e72ed4e..c53bd217b88dc9fe73fceeca6030047b366a89dd 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -490,7 +490,8 @@ void MenuController::OnMouseReleased(SubmenuView* source,
== views::MenuItemView::kEmptyMenuItemViewID)
menu = part.parent;
- if (menu != NULL && ShowContextMenu(menu, source, event))
+ if (menu != NULL && ShowContextMenu(menu, source, event,
+ ui::MENU_SOURCE_MOUSE))
return;
}
@@ -554,7 +555,7 @@ void MenuController::OnGestureEvent(SubmenuView* source,
event->StopPropagation();
} else if (event->type() == ui::ET_GESTURE_LONG_PRESS) {
if (part.type == MenuPart::MENU_ITEM && part.menu) {
- if (ShowContextMenu(part.menu, source, *event))
+ if (ShowContextMenu(part.menu, source, *event, ui::MENU_SOURCE_TOUCH))
event->StopPropagation();
}
} else if (event->type() == ui::ET_GESTURE_TAP) {
@@ -958,7 +959,7 @@ bool MenuController::Dispatch(const MSG& msg) {
gfx::Point screen_loc(0, item->height());
View::ConvertPointToScreen(item, &screen_loc);
item->GetDelegate()->ShowContextMenu(item, item->GetCommand(),
- screen_loc, false);
+ screen_loc, ui::MENU_SOURCE_MOUSE);
sky 2013/06/17 16:08:19 I think this can be keyboard too. See description
varunjain 2013/06/17 20:13:55 Done.
}
return true;
}
@@ -1270,7 +1271,8 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source,
bool MenuController::ShowContextMenu(MenuItemView* menu_item,
SubmenuView* source,
- const ui::LocatedEvent& event) {
+ const ui::LocatedEvent& event,
+ ui::MenuSourceType source_type) {
// Set the selection immediately, making sure the submenu is only open
// if it already was.
int selection_types = SELECTION_UPDATE_IMMEDIATELY;
@@ -1281,7 +1283,7 @@ bool MenuController::ShowContextMenu(MenuItemView* menu_item,
View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc);
if (menu_item->GetDelegate()->ShowContextMenu(
- menu_item, menu_item->GetCommand(), loc, true)) {
+ menu_item, menu_item->GetCommand(), loc, source_type)) {
SendMouseCaptureLostToActiveView();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698