| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // the progress loading sound just in case. | 247 // the progress loading sound just in case. |
| 248 if ((this.mode_ === ChromeVoxMode.NEXT || | 248 if ((this.mode_ === ChromeVoxMode.NEXT || |
| 249 this.mode_ === ChromeVoxMode.FORCE_NEXT) && | 249 this.mode_ === ChromeVoxMode.FORCE_NEXT) && |
| 250 this.mode_ != mode) { | 250 this.mode_ != mode) { |
| 251 cvox.ChromeVox.earcons.cancelEarcon(cvox.Earcon.PAGE_START_LOADING); | 251 cvox.ChromeVox.earcons.cancelEarcon(cvox.Earcon.PAGE_START_LOADING); |
| 252 } | 252 } |
| 253 | 253 |
| 254 if (mode === ChromeVoxMode.NEXT || | 254 if (mode === ChromeVoxMode.NEXT || |
| 255 mode === ChromeVoxMode.FORCE_NEXT) { | 255 mode === ChromeVoxMode.FORCE_NEXT) { |
| 256 (new PanelCommand(PanelCommandType.ENABLE_MENUS)).send(); | 256 (new PanelCommand(PanelCommandType.ENABLE_MENUS)).send(); |
| 257 if (cvox.TabsApiHandler) |
| 258 cvox.TabsApiHandler.shouldOutputSpeechAndBraille = false; |
| 257 } else { | 259 } else { |
| 258 (new PanelCommand(PanelCommandType.DISABLE_MENUS)).send(); | 260 (new PanelCommand(PanelCommandType.DISABLE_MENUS)).send(); |
| 261 if (cvox.TabsApiHandler) |
| 262 cvox.TabsApiHandler.shouldOutputSpeechAndBraille = true; |
| 259 } | 263 } |
| 260 | 264 |
| 261 // If switching to Classic from any automation-API-based mode, | 265 // If switching to Classic from any automation-API-based mode, |
| 262 // clear the focus ring. | 266 // clear the focus ring. |
| 263 if (mode === ChromeVoxMode.CLASSIC && mode != this.mode_) { | 267 if (mode === ChromeVoxMode.CLASSIC && mode != this.mode_) { |
| 264 if (cvox.ChromeVox.isChromeOS) | 268 if (cvox.ChromeVox.isChromeOS) |
| 265 chrome.accessibilityPrivate.setFocusRing([]); | 269 chrome.accessibilityPrivate.setFocusRing([]); |
| 266 } | 270 } |
| 267 | 271 |
| 268 // If switching away from Classic to any automation-API-based mode, | 272 // If switching away from Classic to any automation-API-based mode, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 315 } |
| 312 } | 316 } |
| 313 | 317 |
| 314 this.setMode(mode); | 318 this.setMode(mode); |
| 315 }, | 319 }, |
| 316 | 320 |
| 317 /** | 321 /** |
| 318 * @override | 322 * @override |
| 319 */ | 323 */ |
| 320 getCurrentRange: function() { | 324 getCurrentRange: function() { |
| 321 return this.currentRange_; | 325 if (this.currentRange_ && this.currentRange_.isValid()) |
| 326 return this.currentRange_; |
| 327 return null; |
| 322 }, | 328 }, |
| 323 | 329 |
| 324 /** | 330 /** |
| 325 * @override | 331 * @override |
| 326 */ | 332 */ |
| 327 setCurrentRange: function(newRange) { | 333 setCurrentRange: function(newRange) { |
| 328 if (!newRange) | 334 if (!newRange) |
| 329 return; | 335 return; |
| 330 | 336 |
| 331 // Is the range invalid? | 337 // Is the range invalid? |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 1124 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 1119 .replace(/\*/g, '.*') | 1125 .replace(/\*/g, '.*') |
| 1120 .replace(/\?/g, '.'); | 1126 .replace(/\?/g, '.'); |
| 1121 }).join('|') + ')$'); | 1127 }).join('|') + ')$'); |
| 1122 }; | 1128 }; |
| 1123 | 1129 |
| 1124 /** @type {Background} */ | 1130 /** @type {Background} */ |
| 1125 global.backgroundObj = new Background(); | 1131 global.backgroundObj = new Background(); |
| 1126 | 1132 |
| 1127 }); // goog.scope | 1133 }); // goog.scope |
| OLD | NEW |