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 d1547c41a8c3d4aaec0de657a595a2777328e742..b74ddce7d065ec711ec7e68fcc05f2f086196c8f 100644 |
| --- a/ui/views/controls/menu/menu_controller.cc |
| +++ b/ui/views/controls/menu/menu_controller.cc |
| @@ -804,6 +804,22 @@ void MenuController::OnDragComplete(bool should_close) { |
| } |
| } |
| +ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent( |
| + base::char16 character, |
| + ui::KeyboardCode key_code) { |
| + if (exit_type() == MenuController::EXIT_ALL || |
| + exit_type() == MenuController::EXIT_DESTROYED) { |
| + TerminateNestedMessageLoop(); |
| + return ui::POST_DISPATCH_PERFORM_DEFAULT; |
| + } |
| + |
| + bool should_quit = character ? SelectByChar(character) : !OnKeyDown(key_code); |
| + if (should_quit || exit_type() != MenuController::EXIT_NONE) |
| + TerminateNestedMessageLoop(); |
| + |
| + return ui::POST_DISPATCH_NONE; |
| +} |
|
tapted
2015/02/04 11:55:48
This function started life being refactored out of
|
| + |
| void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) { |
| if (submenu->IsShowing()) { |
| gfx::Point point = GetScreen()->GetCursorScreenPoint(); |
| @@ -1028,16 +1044,22 @@ bool MenuController::OnKeyDown(ui::KeyboardCode key_code) { |
| CloseSubmenu(); |
| break; |
| +// On Mac, treat space the same as return. |
| +#if !defined(OS_MACOSX) |
| case ui::VKEY_SPACE: |
| if (SendAcceleratorToHotTrackedView() == ACCELERATOR_PROCESSED_EXIT) |
| return false; |
| break; |
| +#endif |
| case ui::VKEY_F4: |
| if (!is_combobox_) |
| break; |
| // Fallthrough to accept or dismiss combobox menus on F4, like windows. |
| case ui::VKEY_RETURN: |
| +#if defined(OS_MACOSX) |
| + case ui::VKEY_SPACE: |
| +#endif |
| if (pending_state_.item) { |
| if (pending_state_.item->HasSubmenu()) { |
| if (key_code == ui::VKEY_F4 && |