Chromium Code Reviews| 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; |
| } |