views: Show menubar's accelerator when "Alt" is pressed.

This commit is contained in:
Cheng Zhao 2014-08-18 14:12:12 +08:00
parent 965f2b1b6b
commit e9536508a5
5 changed files with 30 additions and 1 deletions

View file

@ -572,6 +572,11 @@ 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_autohide_)
return;
@ -627,6 +632,10 @@ void NativeWindowViews::SetMenuBarVisibility(bool visible) {
if (!menu_bar_)
return;
// Always show the accelerator when the auto-hide menu bar shows.
if (menu_bar_autohide_)
menu_bar_->SetAcceleratorVisibility(visible);
menu_bar_visible_ = visible;
if (visible) {
DCHECK_EQ(child_count(), 1);