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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 textSelectionChanged: this.onTextOrTextSelectionChanged, | 70 textSelectionChanged: this.onTextOrTextSelectionChanged, |
71 valueChanged: this.onValueChanged | 71 valueChanged: this.onValueChanged |
72 }; | 72 }; |
73 | 73 |
74 // Register listeners for ... | 74 // Register listeners for ... |
75 // Desktop. | 75 // Desktop. |
76 chrome.automation.getDesktop(this.onGotDesktop); | 76 chrome.automation.getDesktop(this.onGotDesktop); |
77 }; | 77 }; |
78 | 78 |
79 Background.prototype = { | 79 Background.prototype = { |
| 80 /** Forces ChromeVox Next to be active for all tabs. */ |
| 81 forceChromeVoxNextActive: function() { |
| 82 this.active_ = true; |
| 83 }, |
| 84 |
80 /** | 85 /** |
81 * Handles all setup once a new automation tree appears. | 86 * Handles all setup once a new automation tree appears. |
82 * @param {chrome.automation.AutomationNode} desktop | 87 * @param {chrome.automation.AutomationNode} desktop |
83 */ | 88 */ |
84 onGotDesktop: function(desktop) { | 89 onGotDesktop: function(desktop) { |
85 // Register all automation event listeners. | 90 // Register all automation event listeners. |
86 for (var eventType in this.listeners_) | 91 for (var eventType in this.listeners_) |
87 desktop.addEventListener(eventType, this.listeners_[eventType], true); | 92 desktop.addEventListener(eventType, this.listeners_[eventType], true); |
88 | 93 |
89 // Register a tree change observer. | 94 // Register a tree change observer. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 new Output().withSpeechAndBraille( | 246 new Output().withSpeechAndBraille( |
242 this.currentRange_, prevRange, evt.type) | 247 this.currentRange_, prevRange, evt.type) |
243 .go(); | 248 .go(); |
244 }, | 249 }, |
245 | 250 |
246 /** | 251 /** |
247 * Provides all feedback once a load complete event fires. | 252 * Provides all feedback once a load complete event fires. |
248 * @param {Object} evt | 253 * @param {Object} evt |
249 */ | 254 */ |
250 onLoadComplete: function(evt) { | 255 onLoadComplete: function(evt) { |
251 var next = this.isWhitelisted_(evt.target.attributes.url); | 256 var next = this.isWhitelisted_(evt.target.attributes.url) || this.active_; |
252 this.toggleChromeVoxVersion({next: next, classic: !next}); | 257 this.toggleChromeVoxVersion({next: next, classic: !next}); |
253 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 258 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
254 if (evt.target.root.role != chrome.automation.RoleType.desktop && | 259 if (evt.target.root.role != chrome.automation.RoleType.desktop && |
255 !this.active_) | 260 !this.active_) |
256 return; | 261 return; |
257 | 262 |
258 if (this.currentRange_) | 263 if (this.currentRange_) |
259 return; | 264 return; |
260 | 265 |
261 var root = evt.target; | 266 var root = evt.target; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 }.bind(this)); | 440 }.bind(this)); |
436 } | 441 } |
437 }.bind(this)); | 442 }.bind(this)); |
438 } | 443 } |
439 }; | 444 }; |
440 | 445 |
441 /** @type {Background} */ | 446 /** @type {Background} */ |
442 global.backgroundObj = new Background(); | 447 global.backgroundObj = new Background(); |
443 | 448 |
444 }); // goog.scope | 449 }); // goog.scope |
OLD | NEW |