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'); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 */ | 71 */ |
72 onTabUpdated: function(tabId, changeInfo) { | 72 onTabUpdated: function(tabId, changeInfo) { |
73 if (changeInfo.status != 'complete') | 73 if (changeInfo.status != 'complete') |
74 return; | 74 return; |
75 chrome.tabs.get(tabId, function(tab) { | 75 chrome.tabs.get(tabId, function(tab) { |
76 if (!tab.url) | 76 if (!tab.url) |
77 return; | 77 return; |
78 | 78 |
79 if (!this.isWhitelisted_(tab.url)) { | 79 if (!this.isWhitelisted_(tab.url)) { |
80 chrome.commands.onCommand.removeListener(this.onGotCommand); | 80 chrome.commands.onCommand.removeListener(this.onGotCommand); |
81 cvox.ChromeVox.injectChromeVoxIntoTabs([tab], true); | 81 cvox.ChromeVox.injectChromeVoxIntoTabs([tab]); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 if (!chrome.commands.onCommand.hasListeners()) | 85 if (!chrome.commands.onCommand.hasListeners()) |
86 chrome.commands.onCommand.addListener(this.onGotCommand); | 86 chrome.commands.onCommand.addListener(this.onGotCommand); |
87 | 87 |
88 this.disableClassicChromeVox_(tab.id); | 88 this.disableClassicChromeVox_(tab.id); |
89 | 89 |
90 chrome.automation.getTree(this.onGotTree); | 90 chrome.automation.getTree(this.onGotTree); |
91 }.bind(this)); | 91 }.bind(this)); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 disableClassicChromeVox_: function(tabId) { | 243 disableClassicChromeVox_: function(tabId) { |
244 chrome.tabs.executeScript( | 244 chrome.tabs.executeScript( |
245 tabId, | 245 tabId, |
246 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n', | 246 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n', |
247 'allFrames': true}); | 247 'allFrames': true}); |
248 } | 248 } |
249 }; | 249 }; |
250 | 250 |
251 /** @type {cvox2.Background} */ | 251 /** @type {cvox2.Background} */ |
252 cvox2.global.backgroundObj = new cvox2.Background(); | 252 cvox2.global.backgroundObj = new cvox2.Background(); |
OLD | NEW |