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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js

Issue 2740793002: Minimize the Classic API and enable it for Next (Closed)
Patch Set: Minimize the Classic API and enable it for Next Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview ChromeVox keyboard handler. 6 * @fileoverview ChromeVox keyboard handler.
7 */ 7 */
8 8
9 goog.provide('BackgroundKeyboardHandler'); 9 goog.provide('BackgroundKeyboardHandler');
10 10
(...skipping 21 matching lines...) Expand all
32 * Handles key down events. 32 * Handles key down events.
33 * @param {Event} evt The key down event to process. 33 * @param {Event} evt The key down event to process.
34 * @return {boolean} True if the default action should be performed. 34 * @return {boolean} True if the default action should be performed.
35 */ 35 */
36 onKeyDown: function(evt) { 36 onKeyDown: function(evt) {
37 evt.stickyMode = cvox.ChromeVox.isStickyModeOn() && cvox.ChromeVox.isActive; 37 evt.stickyMode = cvox.ChromeVox.isStickyModeOn() && cvox.ChromeVox.isActive;
38 if (cvox.ChromeVox.passThroughMode) 38 if (cvox.ChromeVox.passThroughMode)
39 return false; 39 return false;
40 40
41 if (ChromeVoxState.instance.mode != ChromeVoxMode.CLASSIC && 41 if (ChromeVoxState.instance.mode != ChromeVoxMode.CLASSIC &&
42 ChromeVoxState.instance.mode != ChromeVoxMode.NEXT_COMPAT &&
43 !cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt)) { 42 !cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt)) {
44 evt.preventDefault(); 43 evt.preventDefault();
45 evt.stopPropagation(); 44 evt.stopPropagation();
46 this.eatenKeyDowns_.add(evt.keyCode); 45 this.eatenKeyDowns_.add(evt.keyCode);
47 } 46 }
48 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); 47 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
49 return false; 48 return false;
50 }, 49 },
51 50
52 /** 51 /**
(...skipping 21 matching lines...) Expand all
74 73
75 return false; 74 return false;
76 }, 75 },
77 76
78 /** 77 /**
79 * React to mode changes. 78 * React to mode changes.
80 * @param {ChromeVoxMode} newMode 79 * @param {ChromeVoxMode} newMode
81 * @param {ChromeVoxMode?} oldMode 80 * @param {ChromeVoxMode?} oldMode
82 */ 81 */
83 onModeChanged: function(newMode, oldMode) { 82 onModeChanged: function(newMode, oldMode) {
84 if (newMode == ChromeVoxMode.CLASSIC || 83 if (newMode == ChromeVoxMode.CLASSIC) {
85 newMode == ChromeVoxMode.NEXT_COMPAT) {
86 chrome.accessibilityPrivate.setKeyboardListener(false, false); 84 chrome.accessibilityPrivate.setKeyboardListener(false, false);
87 } else { 85 } else {
88 chrome.accessibilityPrivate.setKeyboardListener( 86 chrome.accessibilityPrivate.setKeyboardListener(
89 true, cvox.ChromeVox.isStickyPrefOn); 87 true, cvox.ChromeVox.isStickyPrefOn);
90 } 88 }
91 89
92 if (newMode === ChromeVoxMode.NEXT || 90 if (newMode === ChromeVoxMode.NEXT ||
93 newMode === ChromeVoxMode.FORCE_NEXT || 91 newMode === ChromeVoxMode.FORCE_NEXT) {
94 newMode === ChromeVoxMode.NEXT_COMPAT) {
95 // Switching out of classic, classic compat, or uninitialized 92 // Switching out of classic, classic compat, or uninitialized
96 // (on startup). 93 // (on startup).
97 window['prefs'].switchToKeyMap('keymap_next'); 94 window['prefs'].switchToKeyMap('keymap_next');
98 } else if (oldMode && 95 } else if (oldMode &&
99 oldMode != ChromeVoxMode.CLASSIC && 96 oldMode != ChromeVoxMode.CLASSIC &&
100 oldMode != ChromeVoxMode.CLASSIC_COMPAT) { 97 oldMode != ChromeVoxMode.CLASSIC_COMPAT) {
101 // Switching out of next. Intentionally do nothing when switching out of 98 // Switching out of next. Intentionally do nothing when switching out of
102 // an uninitialized |oldMode|. 99 // an uninitialized |oldMode|.
103 window['prefs'].switchToKeyMap('keymap_classic'); 100 window['prefs'].switchToKeyMap('keymap_classic');
104 } 101 }
105 } 102 }
106 }; 103 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698