fix: read ignoreMenuShortcuts per WebContents (#14538)

This commit is contained in:
Cheng Zhao 2018-09-11 16:52:04 +09:00 committed by Samuel Attard
parent 1b920c25af
commit 8950caaa85
4 changed files with 21 additions and 16 deletions

View file

@ -6,6 +6,7 @@
#include "atom/browser/api/atom_api_web_contents_view.h"
#include "atom/browser/native_window_views.h"
#include "atom/browser/web_contents_preferences.h"
#include "base/strings/string_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/keycodes/keyboard_codes.h"
@ -24,8 +25,12 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
ExitFullscreenModeForTab(source);
// Let the NativeWindow handle other parts.
if (!ignore_menu_shortcuts_ && owner_window())
owner_window()->HandleKeyboardEvent(source, event);
if (auto* web_preferences = WebContentsPreferences::From(source)) {
if (owner_window() &&
!web_preferences->IsEnabled("ignoreMenuShortcuts", false)) {
owner_window()->HandleKeyboardEvent(source, event);
}
}
}
void CommonWebContentsDelegate::ShowAutofillPopup(