| 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('cvox2.Background'); | 10 goog.provide('cvox2.Background'); |
| 11 goog.provide('cvox2.global'); | 11 goog.provide('cvox2.global'); |
| 12 | 12 |
| 13 goog.require('cvox.TabsApiHandler'); |
| 14 |
| 13 /** Classic Chrome accessibility API. */ | 15 /** Classic Chrome accessibility API. */ |
| 14 cvox2.global.accessibility = | 16 cvox2.global.accessibility = |
| 15 chrome.accessibilityPrivate || chrome.experimental.accessibility; | 17 chrome.accessibilityPrivate || chrome.experimental.accessibility; |
| 16 | 18 |
| 17 /** | 19 /** |
| 18 * ChromeVox2 background page. | 20 * ChromeVox2 background page. |
| 19 */ | 21 */ |
| 20 cvox2.Background = function() { | 22 cvox2.Background = function() { |
| 21 /** | 23 /** |
| 22 * A list of site substring patterns to use with ChromeVox next. Keep these | 24 * A list of site substring patterns to use with ChromeVox next. Keep these |
| 23 * strings relatively specific. | 25 * strings relatively specific. |
| 24 * @type {!Array.<string>} | 26 * @type {!Array.<string>} |
| 25 */ | 27 */ |
| 26 this.whitelist_ = ['http://www.chromevox.com/', 'chromevox_next_test']; | 28 this.whitelist_ = ['http://www.chromevox.com/', 'chromevox_next_test']; |
| 27 | 29 |
| 30 /** @type {cvox.TabsApiHandler} @private */ |
| 31 this.tabsHandler_ = new cvox.TabsApiHandler(cvox.ChromeVox.tts, |
| 32 cvox.ChromeVox.braille, |
| 33 cvox.ChromeVox.earcons); |
| 34 |
| 28 // Only needed with unmerged ChromeVox classic loaded before. | 35 // Only needed with unmerged ChromeVox classic loaded before. |
| 29 // TODO(dtseng): Refactor all tabs handlers out of | |
| 30 // accessibility_api_handler.js. | |
| 31 cvox2.global.accessibility.setAccessibilityEnabled(false); | 36 cvox2.global.accessibility.setAccessibilityEnabled(false); |
| 32 | 37 |
| 33 // Manually bind all functions to |this|. | 38 // Manually bind all functions to |this|. |
| 34 for (var func in this) { | 39 for (var func in this) { |
| 35 if (typeof(this[func]) == 'function') | 40 if (typeof(this[func]) == 'function') |
| 36 this[func] = this[func].bind(this); | 41 this[func] = this[func].bind(this); |
| 37 } | 42 } |
| 38 | 43 |
| 39 // Register listeners for ... | 44 // Register listeners for ... |
| 40 // Desktop. | 45 // Desktop. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 disableClassicChromeVox_: function(tabId) { | 121 disableClassicChromeVox_: function(tabId) { |
| 117 chrome.tabs.executeScript( | 122 chrome.tabs.executeScript( |
| 118 tabId, | 123 tabId, |
| 119 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n', | 124 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n', |
| 120 'allFrames': true}); | 125 'allFrames': true}); |
| 121 } | 126 } |
| 122 }; | 127 }; |
| 123 | 128 |
| 124 /** @type {cvox2.Background} */ | 129 /** @type {cvox2.Background} */ |
| 125 cvox2.global.backgroundObj = new cvox2.Background(); | 130 cvox2.global.backgroundObj = new cvox2.Background(); |
| OLD | NEW |