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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 chrome.automation.getFocus(function(focus) { | 207 chrome.automation.getFocus(function(focus) { |
208 target = focus; | 208 target = focus; |
209 }); | 209 }); |
210 } else { | 210 } else { |
211 target = this.getCurrentRange().start.node; | 211 target = this.getCurrentRange().start.node; |
212 } | 212 } |
213 | 213 |
214 if (!target) | 214 if (!target) |
215 return ChromeVoxMode.CLASSIC; | 215 return ChromeVoxMode.CLASSIC; |
216 | 216 |
| 217 var root = target.root; |
| 218 if (root && this.isWhitelistedForCompat_(root.docUrl)) |
| 219 return ChromeVoxMode.COMPAT; |
| 220 |
217 // Closure complains, but clearly, |target| is not null. | 221 // Closure complains, but clearly, |target| is not null. |
218 var root = | 222 var topLevelRoot = |
219 AutomationUtil.getTopLevelRoot(/** @type {!AutomationNode} */(target)); | 223 AutomationUtil.getTopLevelRoot(/** @type {!AutomationNode} */(target)); |
220 if (!root) | 224 if (!topLevelRoot) |
221 return ChromeVoxMode.COMPAT; | 225 return ChromeVoxMode.COMPAT; |
222 if (this.isWhitelistedForCompat_(root.docUrl)) | 226 if (this.isWhitelistedForCompat_(topLevelRoot.docUrl)) |
223 return ChromeVoxMode.COMPAT; | 227 return ChromeVoxMode.COMPAT; |
224 else if (this.isWhitelistedForNext_(root.docUrl)) | 228 else if (this.isWhitelistedForNext_(topLevelRoot.docUrl)) |
225 return ChromeVoxMode.NEXT; | 229 return ChromeVoxMode.NEXT; |
226 else | 230 else |
227 return ChromeVoxMode.CLASSIC; | 231 return ChromeVoxMode.CLASSIC; |
228 }, | 232 }, |
229 | 233 |
230 /** | 234 /** |
231 * Handles a mode change. | 235 * Handles a mode change. |
232 * @param {ChromeVoxMode} newMode | 236 * @param {ChromeVoxMode} newMode |
233 * @param {?ChromeVoxMode} oldMode Can be null at startup when no range was | 237 * @param {?ChromeVoxMode} oldMode Can be null at startup when no range was |
234 * previously set. | 238 * previously set. |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 return new RegExp('^(' + globs.map(function(glob) { | 1234 return new RegExp('^(' + globs.map(function(glob) { |
1231 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 1235 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
1232 .replace(/\*/g, '.*') | 1236 .replace(/\*/g, '.*') |
1233 .replace(/\?/g, '.'); | 1237 .replace(/\?/g, '.'); |
1234 }).join('|') + ')$'); | 1238 }).join('|') + ')$'); |
1235 }; | 1239 }; |
1236 | 1240 |
1237 new Background(); | 1241 new Background(); |
1238 | 1242 |
1239 }); // goog.scope | 1243 }); // goog.scope |
OLD | NEW |