| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 */ | 386 */ |
| 387 setCurrentRange: function(newRange) { | 387 setCurrentRange: function(newRange) { |
| 388 // Clear anything that was frozen on the braille display whenever | 388 // Clear anything that was frozen on the braille display whenever |
| 389 // the user navigates. | 389 // the user navigates. |
| 390 cvox.ChromeVox.braille.thaw(); | 390 cvox.ChromeVox.braille.thaw(); |
| 391 | 391 |
| 392 if (newRange && !newRange.isValid()) | 392 if (newRange && !newRange.isValid()) |
| 393 return; | 393 return; |
| 394 | 394 |
| 395 this.currentRange_ = newRange; | 395 this.currentRange_ = newRange; |
| 396 ChromeVoxState.observers.forEach(function(observer) { |
| 397 observer.onCurrentRangeChanged(newRange); |
| 398 }); |
| 396 var oldMode = this.mode_; | 399 var oldMode = this.mode_; |
| 397 var newMode = this.getMode(); | 400 var newMode = this.getMode(); |
| 398 if (oldMode != newMode) { | 401 if (oldMode != newMode) { |
| 399 this.onModeChanged_(newMode, oldMode); | 402 this.onModeChanged_(newMode, oldMode); |
| 400 this.mode_ = newMode; | 403 this.mode_ = newMode; |
| 401 } | 404 } |
| 402 | 405 |
| 403 if (this.currentRange_) { | 406 if (this.currentRange_) { |
| 404 var start = this.currentRange_.start.node; | 407 var start = this.currentRange_.start.node; |
| 405 start.makeVisible(); | 408 start.makeVisible(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 return new RegExp('^(' + globs.map(function(glob) { | 830 return new RegExp('^(' + globs.map(function(glob) { |
| 828 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 831 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 829 .replace(/\*/g, '.*') | 832 .replace(/\*/g, '.*') |
| 830 .replace(/\?/g, '.'); | 833 .replace(/\?/g, '.'); |
| 831 }).join('|') + ')$'); | 834 }).join('|') + ')$'); |
| 832 }; | 835 }; |
| 833 | 836 |
| 834 new Background(); | 837 new Background(); |
| 835 | 838 |
| 836 }); // goog.scope | 839 }); // goog.scope |
| OLD | NEW |