Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1636243002: Eat all keys involving Search when ChromeVox is on and add a pass through mode command. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Track key up. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index bea4f4861f4d40f687adb3beedb014c5bde4c56c..41a82874c73fec9f5286d47acba975dceea23f98 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -116,6 +116,7 @@ Background = function() {
cvox.ExtensionBridge.addMessageListener(this.onMessage_);
document.addEventListener('keydown', this.onKeyDown.bind(this), true);
+ document.addEventListener('keyup', this.onKeyUp.bind(this), true);
cvox.ChromeVoxKbHandler.commandHandler = this.onGotCommand.bind(this);
// Classic keymap.
@@ -124,6 +125,9 @@ Background = function() {
// Live region handler.
this.liveRegions_ = new LiveRegions(this);
+ /** @type {number} @private */
+ this.passThroughKeyUpCount_ = 0;
+
if (!chrome.accessibilityPrivate.setKeyboardListener)
chrome.accessibilityPrivate.setKeyboardListener = function() {};
};
@@ -476,6 +480,11 @@ Background.prototype = {
else
chrome.accessibilityPrivate.setKeyboardListener(true, false);
return false;
+ case 'passThroughMode':
+ cvox.ChromeVox.passThroughMode = true;
+ cvox.ChromeVox.tts.speak(
+ Msgs.getMsg('pass_through_key'), cvox.QueueMode.QUEUE);
+ return true;
default:
return true;
}
@@ -525,16 +534,36 @@ Background.prototype = {
*/
onKeyDown: function(evt) {
evt.stickyMode = cvox.ChromeVox.isStickyModeOn() && cvox.ChromeVox.isActive;
+ if (cvox.ChromeVox.passThroughMode)
+ return false;
+
if (this.mode_ != ChromeVoxMode.CLASSIC &&
!cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt)) {
evt.preventDefault();
evt.stopPropagation();
}
-
Output.flushNextSpeechUtterance();
},
/**
+ * Handles key up events.
+ * @param {Event} evt The key down event to process.
+ * @return {boolean} True if the default action should be performed.
+ */
+ onKeyUp: function(evt) {
+ // Reset pass through mode once a keyup (not involving the pass through key)
+ // is seen. The pass through command involves three keys.
+ if (cvox.ChromeVox.passThroughMode) {
+ if (this.passThroughKeyUpCount_ >= 3) {
+ cvox.ChromeVox.passThroughMode = false;
+ this.passThroughKeyUpCount_ = 0;
+ } else {
+ this.passThroughKeyUpCount_++;
+ }
+ }
+ },
+
+ /**
* Open the options page in a new tab.
*/
showOptionsPage: function() {
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698