Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 599193002: Only inject ChromeVox classic when necessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@command_prev_next
Patch Set: Address comment. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 * @param {number} tabId 65 * @param {number} tabId
66 * @param {Object} changeInfo 66 * @param {Object} changeInfo
67 */ 67 */
68 onTabUpdated: function(tabId, changeInfo) { 68 onTabUpdated: function(tabId, changeInfo) {
69 chrome.tabs.get(tabId, function(tab) { 69 chrome.tabs.get(tabId, function(tab) {
70 if (!tab.url) 70 if (!tab.url)
71 return; 71 return;
72 72
73 if (!this.isWhitelisted_(tab.url)) { 73 if (!this.isWhitelisted_(tab.url)) {
74 chrome.commands.onCommand.removeListener(this.onGotCommand); 74 chrome.commands.onCommand.removeListener(this.onGotCommand);
75 cvox.ChromeVox.background.injectChromeVoxIntoTabs([tab], true);
75 return; 76 return;
76 } 77 }
77 78
78 if (!chrome.commands.onCommand.hasListeners()) { 79 if (!chrome.commands.onCommand.hasListeners()) {
79 chrome.commands.onCommand.addListener(this.onGotCommand); 80 chrome.commands.onCommand.addListener(this.onGotCommand);
80 } 81 }
81 82
82 this.disableClassicChromeVox_(tab.id); 83 this.disableClassicChromeVox_(tab.id);
83 84
84 chrome.automation.getTree(this.onGotTree.bind(this)); 85 chrome.automation.getTree(this.onGotTree.bind(this));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 disableClassicChromeVox_: function(tabId) { 215 disableClassicChromeVox_: function(tabId) {
215 chrome.tabs.executeScript( 216 chrome.tabs.executeScript(
216 tabId, 217 tabId,
217 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n', 218 {'code': 'try { window.disableChromeVox(); } catch(e) { }\n',
218 'allFrames': true}); 219 'allFrames': true});
219 } 220 }
220 }; 221 };
221 222
222 /** @type {cvox2.Background} */ 223 /** @type {cvox2.Background} */
223 cvox2.global.backgroundObj = new cvox2.Background(); 224 cvox2.global.backgroundObj = new cvox2.Background();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698