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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 return this.currentRange_; | 273 return this.currentRange_; |
274 }, | 274 }, |
275 | 275 |
276 /** | 276 /** |
277 * @override | 277 * @override |
278 */ | 278 */ |
279 setCurrentRange: function(newRange) { | 279 setCurrentRange: function(newRange) { |
280 if (!newRange) | 280 if (!newRange) |
281 return; | 281 return; |
282 | 282 |
283 // Is the range invalid? | |
284 if (newRange.start.node.role === undefined || | |
dmazzoni
2016/03/16 23:48:36
Consider ending an excursion if necessary?
David Tseng
2016/03/17 00:40:11
I don't think we want this. For example, in an inc
| |
285 newRange.end.node.role === undefined) { | |
286 // Restore range to the focused location. | |
287 chrome.automation.getFocus(function(f) { | |
288 newRange = cursors.Range.fromNode(f); | |
289 }); | |
290 } | |
291 | |
283 if (!this.inExcursion_) | 292 if (!this.inExcursion_) |
284 this.savedRange_ = new cursors.Range(newRange.start, newRange.end); | 293 this.savedRange_ = new cursors.Range(newRange.start, newRange.end); |
285 | 294 |
286 this.currentRange_ = newRange; | 295 this.currentRange_ = newRange; |
287 | 296 |
288 if (this.currentRange_) | 297 if (this.currentRange_) |
289 this.currentRange_.start.node.makeVisible(); | 298 this.currentRange_.start.node.makeVisible(); |
290 }, | 299 }, |
291 | 300 |
292 /** Forces ChromeVox Next to be active for all tabs. */ | 301 /** Forces ChromeVox Next to be active for all tabs. */ |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 1005 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
997 .replace(/\*/g, '.*') | 1006 .replace(/\*/g, '.*') |
998 .replace(/\?/g, '.'); | 1007 .replace(/\?/g, '.'); |
999 }).join('|') + ')$'); | 1008 }).join('|') + ')$'); |
1000 }; | 1009 }; |
1001 | 1010 |
1002 /** @type {Background} */ | 1011 /** @type {Background} */ |
1003 global.backgroundObj = new Background(); | 1012 global.backgroundObj = new Background(); |
1004 | 1013 |
1005 }); // goog.scope | 1014 }); // goog.scope |
OLD | NEW |