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

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

Issue 2104663003: Prepare ChromeVox for webstore release. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 The entry point for all ChromeVox2 related code for the 6 * @fileoverview The entry point for all ChromeVox2 related code for the
7 * background page. 7 * background page.
8 */ 8 */
9 9
10 goog.provide('Background'); 10 goog.provide('Background');
11 11
12 goog.require('AutomationPredicate'); 12 goog.require('AutomationPredicate');
13 goog.require('AutomationUtil'); 13 goog.require('AutomationUtil');
14 goog.require('ChromeVoxState'); 14 goog.require('ChromeVoxState');
15 goog.require('LiveRegions'); 15 goog.require('LiveRegions');
16 goog.require('NextEarcons'); 16 goog.require('NextEarcons');
17 goog.require('Notifications'); 17 goog.require('Notifications');
18 goog.require('Output'); 18 goog.require('Output');
19 goog.require('Output.EventType'); 19 goog.require('Output.EventType');
20 goog.require('PanelCommand'); 20 goog.require('PanelCommand');
21 goog.require('Stubs');
21 goog.require('constants'); 22 goog.require('constants');
22 goog.require('cursors.Cursor'); 23 goog.require('cursors.Cursor');
23 goog.require('cvox.BrailleKeyCommand'); 24 goog.require('cvox.BrailleKeyCommand');
24 goog.require('cvox.ChromeVoxBackground'); 25 goog.require('cvox.ChromeVoxBackground');
25 goog.require('cvox.ChromeVoxEditableTextBase'); 26 goog.require('cvox.ChromeVoxEditableTextBase');
26 goog.require('cvox.ChromeVoxKbHandler'); 27 goog.require('cvox.ChromeVoxKbHandler');
27 goog.require('cvox.ClassicEarcons'); 28 goog.require('cvox.ClassicEarcons');
28 goog.require('cvox.ExtensionBridge'); 29 goog.require('cvox.ExtensionBridge');
29 goog.require('cvox.NavBraille'); 30 goog.require('cvox.NavBraille');
30 31
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return this.nextEarcons_; 100 return this.nextEarcons_;
100 } else { 101 } else {
101 return this.classicEarcons_; 102 return this.classicEarcons_;
102 } 103 }
103 }).bind(this) 104 }).bind(this)
104 }); 105 });
105 106
106 if (cvox.ChromeVox.isChromeOS) { 107 if (cvox.ChromeVox.isChromeOS) {
107 Object.defineProperty(cvox.ChromeVox, 'modKeyStr', { 108 Object.defineProperty(cvox.ChromeVox, 'modKeyStr', {
108 get: function() { 109 get: function() {
109 return (this.mode == ChromeVoxMode.CLASSIC || this.mode == 110 return (this.mode == ChromeVoxMode.CLASSIC ||
110 ChromeVoxMode.COMPAT) ? 111 this.mode == ChromeVoxMode.COMPAT) ?
111 'Search+Shift' : 'Search'; 112 'Search+Shift' : 'Search';
112 }.bind(this) 113 }.bind(this)
113 }); 114 });
114 } 115 }
115 116
116 Object.defineProperty(cvox.ChromeVox, 'isActive', { 117 Object.defineProperty(cvox.ChromeVox, 'isActive', {
117 get: function() { 118 get: function() {
118 return localStorage['active'] !== 'false'; 119 return localStorage['active'] !== 'false';
119 }, 120 },
120 set: function(value) { 121 set: function(value) {
(...skipping 18 matching lines...) Expand all
139 140
140 /** @type {boolean} @private */ 141 /** @type {boolean} @private */
141 this.inExcursion_ = false; 142 this.inExcursion_ = false;
142 143
143 /** 144 /**
144 * Stores the mode as computed the last time a current range was set. 145 * Stores the mode as computed the last time a current range was set.
145 * @type {?ChromeVoxMode} 146 * @type {?ChromeVoxMode}
146 */ 147 */
147 this.mode_ = null; 148 this.mode_ = null;
148 149
149 if (!chrome.accessibilityPrivate.setKeyboardListener) 150 chrome.accessibilityPrivate.onAccessibilityGesture.addListener(
150 chrome.accessibilityPrivate.setKeyboardListener = function() {}; 151 this.onAccessibilityGesture_);
151 152 Notifications.onStartup();
152 if (cvox.ChromeVox.isChromeOS) { 153 };
153 chrome.accessibilityPrivate.onAccessibilityGesture.addListener(
154 this.onAccessibilityGesture_);
155
156 Notifications.onStartup();
157 }};
158 154
159 /** 155 /**
160 * @const {string} 156 * @const {string}
161 */ 157 */
162 Background.ISSUE_URL = 'https://code.google.com/p/chromium/issues/entry?' + 158 Background.ISSUE_URL = 'https://code.google.com/p/chromium/issues/entry?' +
163 'labels=Type-Bug,Pri-2,cvox2,OS-Chrome&' + 159 'labels=Type-Bug,Pri-2,cvox2,OS-Chrome&' +
164 'components=UI>accessibility&' + 160 'components=UI>accessibility&' +
165 'description='; 161 'description=';
166 162
167 /** 163 /**
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 var selectedKeyMap = 244 var selectedKeyMap =
249 newMode == ChromeVoxMode.CLASSIC || newMode == ChromeVoxMode.COMPAT ? 245 newMode == ChromeVoxMode.CLASSIC || newMode == ChromeVoxMode.COMPAT ?
250 'keymap_classic' : 'keymap_next'; 246 'keymap_classic' : 'keymap_next';
251 window['prefs'].switchToKeyMap(selectedKeyMap); 247 window['prefs'].switchToKeyMap(selectedKeyMap);
252 248
253 if (newMode == ChromeVoxMode.CLASSIC) { 249 if (newMode == ChromeVoxMode.CLASSIC) {
254 if (chrome.commands && 250 if (chrome.commands &&
255 chrome.commands.onCommand.hasListener(this.onGotCommand)) 251 chrome.commands.onCommand.hasListener(this.onGotCommand))
256 chrome.commands.onCommand.removeListener(this.onGotCommand); 252 chrome.commands.onCommand.removeListener(this.onGotCommand);
257 chrome.accessibilityPrivate.setKeyboardListener(false, false); 253 chrome.accessibilityPrivate.setKeyboardListener(false, false);
258 254 chrome.accessibilityPrivate.setFocusRing([]);
259 if (cvox.ChromeVox.isChromeOS)
260 chrome.accessibilityPrivate.setFocusRing([]);
261 } else { 255 } else {
262 if (chrome.commands && 256 if (chrome.commands &&
263 !chrome.commands.onCommand.hasListener(this.onGotCommand)) 257 !chrome.commands.onCommand.hasListener(this.onGotCommand))
264 chrome.commands.onCommand.addListener(this.onGotCommand); 258 chrome.commands.onCommand.addListener(this.onGotCommand);
265 chrome.accessibilityPrivate.setKeyboardListener( 259 chrome.accessibilityPrivate.setKeyboardListener(
266 true, cvox.ChromeVox.isStickyPrefOn); 260 true, cvox.ChromeVox.isStickyPrefOn);
267 } 261 }
268 262
269 // note that |this.currentRange_| can *change* because the request is 263 // note that |this.currentRange_| can *change* because the request is
270 // async. Save it to ensure we're looking at the currentRange at this moment 264 // async. Save it to ensure we're looking at the currentRange at this moment
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 return new RegExp('^(' + globs.map(function(glob) { 1225 return new RegExp('^(' + globs.map(function(glob) {
1232 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 1226 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
1233 .replace(/\*/g, '.*') 1227 .replace(/\*/g, '.*')
1234 .replace(/\?/g, '.'); 1228 .replace(/\?/g, '.');
1235 }).join('|') + ')$'); 1229 }).join('|') + ')$');
1236 }; 1230 };
1237 1231
1238 new Background(); 1232 new Background();
1239 1233
1240 }); // goog.scope 1234 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698