views: Show menubar's submenu when "Alt+Key" is pressed.

This commit is contained in:
Cheng Zhao 2014-08-18 14:42:21 +08:00
parent e9536508a5
commit ba41634ad6
5 changed files with 39 additions and 8 deletions

View file

@ -572,9 +572,16 @@ void NativeWindowViews::HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) {
keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager());
if (menu_bar_ && menu_bar_visible_ && IsAltKey(event)) {
menu_bar_->SetAcceleratorVisibility(
event.type == blink::WebInputEvent::RawKeyDown);
if (menu_bar_ && menu_bar_visible_) {
// Toggle accelerator when "Alt" is pressed.
if (IsAltKey(event))
menu_bar_->SetAcceleratorVisibility(
event.type == blink::WebInputEvent::RawKeyDown);
// Show the submenu when "Alt+Key" is pressed.
if (event.type == blink::WebInputEvent::RawKeyDown && !IsAltKey(event) &&
IsAltModifier(event))
menu_bar_->ActivateAccelerator(event.windowsKeyCode);
}
if (!menu_bar_autohide_)