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

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

Issue 2331253002: Use category flush for focus events. (Closed)
Patch Set: fix test Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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');
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 get: function() { 120 get: function() {
121 return localStorage['active'] !== 'false'; 121 return localStorage['active'] !== 'false';
122 }, 122 },
123 set: function(value) { 123 set: function(value) {
124 localStorage['active'] = value; 124 localStorage['active'] = value;
125 } 125 }
126 }); 126 });
127 127
128 cvox.ExtensionBridge.addMessageListener(this.onMessage_); 128 cvox.ExtensionBridge.addMessageListener(this.onMessage_);
129 129
130 /** @type {!BackgroundKeyboardHandler} */ 130 /** @type {!BackgroundKeyboardHandler} @private */
131 this.keyboardHandler_ = new BackgroundKeyboardHandler(); 131 this.keyboardHandler_ = new BackgroundKeyboardHandler();
132 132
133 /** @type {!LiveRegions} */ 133 /** @type {!LiveRegions} @private */
134 this.liveRegions_ = new LiveRegions(this); 134 this.liveRegions_ = new LiveRegions(this);
135 135
136 /** @type {boolean} @private */ 136 /** @type {boolean} @private */
137 this.inExcursion_ = false; 137 this.inExcursion_ = false;
138 138
139 /** 139 /**
140 * Stores the mode as computed the last time a current range was set. 140 * Stores the mode as computed the last time a current range was set.
141 * @type {?ChromeVoxMode} 141 * @type {?ChromeVoxMode}
142 * @private
142 */ 143 */
143 this.mode_ = null; 144 this.mode_ = null;
144 145
145 chrome.accessibilityPrivate.onAccessibilityGesture.addListener( 146 chrome.accessibilityPrivate.onAccessibilityGesture.addListener(
146 this.onAccessibilityGesture_); 147 this.onAccessibilityGesture_);
147 }; 148 };
148 149
149 /** 150 /**
150 * @const {string} 151 * @const {string}
151 */ 152 */
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 return this.mode != ChromeVoxMode.FORCE_NEXT && 513 return this.mode != ChromeVoxMode.FORCE_NEXT &&
513 !this.isBlacklistedForClassic_(url) && 514 !this.isBlacklistedForClassic_(url) &&
514 !this.isWhitelistedForNext_(url); 515 !this.isWhitelistedForNext_(url);
515 }, 516 },
516 517
517 /** 518 /**
518 * Compat mode is on if any of the following are true: 519 * Compat mode is on if any of the following are true:
519 * 1. a url is blacklisted for Classic. 520 * 1. a url is blacklisted for Classic.
520 * 2. the current range is not within web content. 521 * 2. the current range is not within web content.
521 * @param {string} url 522 * @param {string} url
523 * @return {boolean}
522 */ 524 */
523 isWhitelistedForCompat_: function(url) { 525 isWhitelistedForCompat_: function(url) {
524 return this.isBlacklistedForClassic_(url) || (this.getCurrentRange() && 526 return this.isBlacklistedForClassic_(url) || (this.getCurrentRange() &&
525 !this.getCurrentRange().isWebRange() && 527 !this.getCurrentRange().isWebRange() &&
526 this.getCurrentRange().start.node.state.focused); 528 this.getCurrentRange().start.node.state.focused);
527 }, 529 },
528 530
529 /** 531 /**
530 * @param {string} url 532 * @param {string} url
531 * @return {boolean} 533 * @return {boolean}
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 isClassicEnabled: isClassicEnabled 621 isClassicEnabled: isClassicEnabled
620 }); 622 });
621 } else if (action == 'enableCompatForUrl') { 623 } else if (action == 'enableCompatForUrl') {
622 var url = msg['url']; 624 var url = msg['url'];
623 this.classicBlacklist_.add(url); 625 this.classicBlacklist_.add(url);
624 if (this.currentRange_ && this.currentRange_.start.node) 626 if (this.currentRange_ && this.currentRange_.start.node)
625 this.setCurrentRange(this.currentRange_); 627 this.setCurrentRange(this.currentRange_);
626 } else if (action == 'onCommand') { 628 } else if (action == 'onCommand') {
627 CommandHandler.onCommand(msg['command']); 629 CommandHandler.onCommand(msg['command']);
628 } else if (action == 'flushNextUtterance') { 630 } else if (action == 'flushNextUtterance') {
629 Output.flushNextSpeechUtterance(); 631 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
630 } 632 }
631 break; 633 break;
632 } 634 }
633 }, 635 },
634 636
635 /** 637 /**
636 * Restore the range to the last range that was *not* in the ChromeVox 638 * Restore the range to the last range that was *not* in the ChromeVox
637 * panel. This is used when the ChromeVox Panel closes. 639 * panel. This is used when the ChromeVox Panel closes.
638 * @param {function()=} opt_callback 640 * @param {function()=} opt_callback
639 * @private 641 * @private
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 return new RegExp('^(' + globs.map(function(glob) { 753 return new RegExp('^(' + globs.map(function(glob) {
752 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 754 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
753 .replace(/\*/g, '.*') 755 .replace(/\*/g, '.*')
754 .replace(/\?/g, '.'); 756 .replace(/\?/g, '.');
755 }).join('|') + ')$'); 757 }).join('|') + ')$');
756 }; 758 };
757 759
758 new Background(); 760 new Background();
759 761
760 }); // goog.scope 762 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698