Adds the ability for WebContentsDelegate to decide if event should be updated
https://codereview.chromium.org/2775553002
This commit is contained in:
parent
d322769de8
commit
9b8a77f0d8
2 changed files with 12 additions and 9 deletions
|
@ -587,16 +587,18 @@ void WebContents::HandleKeyboardEvent(
|
|||
}
|
||||
}
|
||||
|
||||
bool WebContents::PreHandleKeyboardEvent(
|
||||
content::KeyboardEventProcessingResult WebContents::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
bool* is_keyboard_shortcut) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (event.GetType() == blink::WebInputEvent::Type::kRawKeyDown ||
|
||||
event.GetType() == blink::WebInputEvent::Type::kKeyUp) {
|
||||
return Emit("before-input-event", event);
|
||||
} else {
|
||||
return false;
|
||||
bool prevent_default = Emit("before-input-event", event);
|
||||
if (prevent_default) {
|
||||
return content::KeyboardEventProcessingResult::HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
return content::KeyboardEventProcessingResult::NOT_HANDLED;
|
||||
}
|
||||
|
||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue