| OLD | NEW |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 '*docs.google.com/spreadsheets/*', | 81 '*docs.google.com/spreadsheets/*', |
| 82 '*docs.google.com/presentation/*' | 82 '*docs.google.com/presentation/*' |
| 83 ]); | 83 ]); |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * @type {cursors.Range} | 86 * @type {cursors.Range} |
| 87 * @private | 87 * @private |
| 88 */ | 88 */ |
| 89 this.currentRange_ = null; | 89 this.currentRange_ = null; |
| 90 | 90 |
| 91 /** | |
| 92 * @type {cursors.Range} | |
| 93 * @private | |
| 94 */ | |
| 95 this.savedRange_ = null; | |
| 96 | |
| 97 // Manually bind all functions to |this|. | 91 // Manually bind all functions to |this|. |
| 98 for (var func in this) { | 92 for (var func in this) { |
| 99 if (typeof(this[func]) == 'function') | 93 if (typeof(this[func]) == 'function') |
| 100 this[func] = this[func].bind(this); | 94 this[func] = this[func].bind(this); |
| 101 } | 95 } |
| 102 | 96 |
| 103 /** @type {!cvox.AbstractEarcons} @private */ | 97 /** @type {!cvox.AbstractEarcons} @private */ |
| 104 this.classicEarcons_ = cvox.ChromeVox.earcons || new cvox.ClassicEarcons(); | 98 this.classicEarcons_ = cvox.ChromeVox.earcons || new cvox.ClassicEarcons(); |
| 105 | 99 |
| 106 /** @type {!cvox.AbstractEarcons} @private */ | 100 /** @type {!cvox.AbstractEarcons} @private */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }); | 143 }); |
| 150 | 144 |
| 151 cvox.ExtensionBridge.addMessageListener(this.onMessage_); | 145 cvox.ExtensionBridge.addMessageListener(this.onMessage_); |
| 152 | 146 |
| 153 /** @type {!BackgroundKeyboardHandler} @private */ | 147 /** @type {!BackgroundKeyboardHandler} @private */ |
| 154 this.keyboardHandler_ = new BackgroundKeyboardHandler(); | 148 this.keyboardHandler_ = new BackgroundKeyboardHandler(); |
| 155 | 149 |
| 156 /** @type {!LiveRegions} @private */ | 150 /** @type {!LiveRegions} @private */ |
| 157 this.liveRegions_ = new LiveRegions(this); | 151 this.liveRegions_ = new LiveRegions(this); |
| 158 | 152 |
| 159 /** @type {boolean} @private */ | |
| 160 this.inExcursion_ = false; | |
| 161 | |
| 162 /** | 153 /** |
| 163 * Stores the mode as computed the last time a current range was set. | 154 * Stores the mode as computed the last time a current range was set. |
| 164 * @type {?ChromeVoxMode} | 155 * @type {?ChromeVoxMode} |
| 165 * @private | 156 * @private |
| 166 */ | 157 */ |
| 167 this.mode_ = null; | 158 this.mode_ = null; |
| 168 | 159 |
| 169 chrome.accessibilityPrivate.onAccessibilityGesture.addListener( | 160 chrome.accessibilityPrivate.onAccessibilityGesture.addListener( |
| 170 this.onAccessibilityGesture_); | 161 this.onAccessibilityGesture_); |
| 171 | 162 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 getCurrentRange: function() { | 381 getCurrentRange: function() { |
| 391 if (this.currentRange_ && this.currentRange_.isValid()) | 382 if (this.currentRange_ && this.currentRange_.isValid()) |
| 392 return this.currentRange_; | 383 return this.currentRange_; |
| 393 return null; | 384 return null; |
| 394 }, | 385 }, |
| 395 | 386 |
| 396 /** | 387 /** |
| 397 * @override | 388 * @override |
| 398 */ | 389 */ |
| 399 setCurrentRange: function(newRange) { | 390 setCurrentRange: function(newRange) { |
| 400 if (!this.inExcursion_ && newRange) | |
| 401 this.savedRange_ = new cursors.Range(newRange.start, newRange.end); | |
| 402 | |
| 403 if (newRange && !newRange.isValid()) | 391 if (newRange && !newRange.isValid()) |
| 404 return; | 392 return; |
| 405 | 393 |
| 406 this.currentRange_ = newRange; | 394 this.currentRange_ = newRange; |
| 407 var oldMode = this.mode_; | 395 var oldMode = this.mode_; |
| 408 var newMode = this.getMode(); | 396 var newMode = this.getMode(); |
| 409 if (oldMode != newMode) { | 397 if (oldMode != newMode) { |
| 410 this.onModeChanged_(newMode, oldMode); | 398 this.onModeChanged_(newMode, oldMode); |
| 411 this.mode_ = newMode; | 399 this.mode_ = newMode; |
| 412 } | 400 } |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 return new RegExp('^(' + globs.map(function(glob) { | 836 return new RegExp('^(' + globs.map(function(glob) { |
| 849 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 837 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 850 .replace(/\*/g, '.*') | 838 .replace(/\*/g, '.*') |
| 851 .replace(/\?/g, '.'); | 839 .replace(/\?/g, '.'); |
| 852 }).join('|') + ')$'); | 840 }).join('|') + ')$'); |
| 853 }; | 841 }; |
| 854 | 842 |
| 855 new Background(); | 843 new Background(); |
| 856 | 844 |
| 857 }); // goog.scope | 845 }); // goog.scope |
| OLD | NEW |