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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 | 128 |
129 chrome.automation.addTreeChangeObserver(this.onTreeChange); | 129 chrome.automation.addTreeChangeObserver(this.onTreeChange); |
130 }; | 130 }; |
131 | 131 |
132 Background.prototype = { | 132 Background.prototype = { |
133 /** Forces ChromeVox Next to be active for all tabs. */ | 133 /** Forces ChromeVox Next to be active for all tabs. */ |
134 forceChromeVoxNextActive: function() { | 134 forceChromeVoxNextActive: function() { |
135 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT); | 135 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT); |
136 }, | 136 }, |
137 | 137 |
138 /** @type {ChromeVoxMode} */ | |
138 get mode() { | 139 get mode() { |
139 return this.mode_; | 140 return this.mode_; |
140 }, | 141 }, |
141 | 142 |
143 /** @type {cursors.Range} */ | |
142 get currentRange() { | 144 get currentRange() { |
143 return this.currentRange_; | 145 return this.currentRange_; |
144 }, | 146 }, |
145 | 147 |
146 set currentRange(value) { | 148 set currentRange(value) { |
147 if (!value) | 149 if (!value) |
148 return; | 150 return; |
149 | 151 |
150 this.currentRange_ = value; | 152 this.currentRange_ = value; |
151 }, | 153 }, |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 chrome.tabs.query({active: true}, function(tabs) { | 590 chrome.tabs.query({active: true}, function(tabs) { |
589 if (mode === ChromeVoxMode.CLASSIC) { | 591 if (mode === ChromeVoxMode.CLASSIC) { |
590 // Generally, we don't want to inject classic content scripts as it is | 592 // Generally, we don't want to inject classic content scripts as it is |
591 // done by the extension system at document load. The exception is when | 593 // done by the extension system at document load. The exception is when |
592 // we toggle classic on manually as part of a user command. | 594 // we toggle classic on manually as part of a user command. |
593 if (opt_injectClassic) | 595 if (opt_injectClassic) |
594 cvox.ChromeVox.injectChromeVoxIntoTabs(tabs); | 596 cvox.ChromeVox.injectChromeVoxIntoTabs(tabs); |
595 } else { | 597 } else { |
596 // When in compat mode, if the focus is within the desktop tree proper, | 598 // When in compat mode, if the focus is within the desktop tree proper, |
597 // then do not disable content scripts. | 599 // then do not disable content scripts. |
598 if (this.currentRange_.start.node.root.role == 'desktop') | 600 if (!this.currentRange_ || |
David Tseng
2015/11/17 19:06:25
this.currentRange_ &&
| |
601 this.currentRange_.start.node.root.role == RoleType.desktop) | |
599 return; | 602 return; |
600 | 603 |
601 this.disableClassicChromeVox_(); | 604 this.disableClassicChromeVox_(); |
602 } | 605 } |
603 }.bind(this)); | 606 }.bind(this)); |
604 | 607 |
605 this.mode_ = mode; | 608 this.mode_ = mode; |
606 }, | 609 }, |
607 | 610 |
608 /** | 611 /** |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 674 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
672 .replace(/\*/g, '.*') | 675 .replace(/\*/g, '.*') |
673 .replace(/\?/g, '.'); | 676 .replace(/\?/g, '.'); |
674 }).join('|') + ')$'); | 677 }).join('|') + ')$'); |
675 }; | 678 }; |
676 | 679 |
677 /** @type {Background} */ | 680 /** @type {Background} */ |
678 global.backgroundObj = new Background(); | 681 global.backgroundObj = new Background(); |
679 | 682 |
680 }); // goog.scope | 683 }); // goog.scope |
OLD | NEW |