Commit 71057143 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Allow capture of f1-f12

History:
At some point in the past, SpokenFeedbackEventRewriter did not have the notion of |capture| (a boolean set by a calling extension). As a result, we had to hard code values into the rewriter so that they get rewritten by things like KeyboardDrivenEventRewriter. For example, F1->back.

This leads to us not being able to capture and prevent default on F1-F12 which map to hardware keys.

Bug: 687748
Test: Search+o, k; verify f1-f12 announce and don't trigger.
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I3ca70a8fc1159f9b5f60332ef5a77ecfe95482b7
Reviewed-on: https://chromium-review.googlesource.com/905283Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537582}
parent 830f47c9
...@@ -53,10 +53,6 @@ bool SpokenFeedbackEventRewriterDelegate::DispatchKeyEventToChromeVox( ...@@ -53,10 +53,6 @@ bool SpokenFeedbackEventRewriterDelegate::DispatchKeyEventToChromeVox(
// Forward all key events to ChromeVox's background page. // Forward all key events to ChromeVox's background page.
chromeos::ForwardKeyToExtension(key_event, host); chromeos::ForwardKeyToExtension(key_event, host);
if ((key_event.key_code() >= ui::VKEY_F1) &&
(key_event.key_code() <= ui::VKEY_F12))
return false;
return capture; return capture;
} }
...@@ -65,10 +61,6 @@ void SpokenFeedbackEventRewriterDelegate::HandleKeyboardEvent( ...@@ -65,10 +61,6 @@ void SpokenFeedbackEventRewriterDelegate::HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) { const content::NativeWebKeyboardEvent& event) {
ui::KeyEvent key_event(*static_cast<ui::KeyEvent*>(event.os_event)); ui::KeyEvent key_event(*static_cast<ui::KeyEvent*>(event.os_event));
if ((key_event.key_code() >= ui::VKEY_F1) &&
(key_event.key_code() <= ui::VKEY_F12))
return;
ui::EventSink* sink = ui::EventSink* sink =
ash::Shell::GetPrimaryRootWindow()->GetHost()->event_sink(); ash::Shell::GetPrimaryRootWindow()->GetHost()->event_sink();
......
...@@ -38,6 +38,7 @@ cvox.KbExplorer.init = function() { ...@@ -38,6 +38,7 @@ cvox.KbExplorer.init = function() {
cvox.KbExplorer.onBrailleKeyEvent); cvox.KbExplorer.onBrailleKeyEvent);
chrome.accessibilityPrivate.onAccessibilityGesture.addListener( chrome.accessibilityPrivate.onAccessibilityGesture.addListener(
cvox.KbExplorer.onAccessibilityGesture); cvox.KbExplorer.onAccessibilityGesture);
chrome.accessibilityPrivate.setKeyboardListener(true, true);
window.onbeforeunload = function(evt) { window.onbeforeunload = function(evt) {
backgroundWindow.removeEventListener( backgroundWindow.removeEventListener(
...@@ -50,6 +51,7 @@ cvox.KbExplorer.init = function() { ...@@ -50,6 +51,7 @@ cvox.KbExplorer.init = function() {
cvox.KbExplorer.onBrailleKeyEvent); cvox.KbExplorer.onBrailleKeyEvent);
chrome.accessibilityPrivate.onAccessibilityGesture.removeListener( chrome.accessibilityPrivate.onAccessibilityGesture.removeListener(
cvox.KbExplorer.onAccessibilityGesture); cvox.KbExplorer.onAccessibilityGesture);
chrome.accessibilityPrivate.setKeyboardListener(true, false);
}; };
if (localStorage['useClassic'] != 'true') { if (localStorage['useClassic'] != 'true') {
cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext(); cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment