Commit aeb1a536 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Remove chrome.windows.onFocusChanged listener

Test: manual.
Bug: 857540
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I50532c92c750ceb37ace2c8ec01b2eb3d572525c
Reviewed-on: https://chromium-review.googlesource.com/1130014Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573847}
parent 63ecd699
......@@ -34,7 +34,6 @@ cvox.TabsApiHandler = function() {
chrome.tabs.onRemoved.addListener(this.onRemoved.bind(this));
chrome.tabs.onActivated.addListener(this.onActivated.bind(this));
chrome.tabs.onUpdated.addListener(this.onUpdated.bind(this));
chrome.windows.onFocusChanged.addListener(this.onFocusChanged.bind(this));
/**
* @type {?number} The window.setInterval ID for checking the loading
......@@ -163,42 +162,6 @@ cvox.TabsApiHandler.prototype = {
}.bind(this));
},
/**
* Handles chrome.windows.onFocusChanged.
* @param {number} windowId
*/
onFocusChanged: function(windowId) {
if (!cvox.ChromeVox.isActive) {
return;
}
if (windowId == chrome.windows.WINDOW_ID_NONE) {
return;
}
chrome.windows.get(windowId, function(window) {
chrome.tabs.query({active: true, windowId: windowId}, function(tabs) {
if (tabs[0])
this.updateLoadingSoundsWhenTabFocusChanges_(tabs[0].id);
var tab = tabs[0] || {};
if (tab.status == 'loading') {
return;
}
if (cvox.TabsApiHandler.shouldOutputSpeechAndBraille) {
var msgId = window.incognito ? 'chrome_incognito_window_selected' :
'chrome_normal_window_selected';
var title = tab.title ? tab.title : tab.url;
cvox.ChromeVox.tts.speak(
this.msg_(msgId, [title]), cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
cvox.ChromeVox.braille.write(
cvox.NavBraille.fromText(this.msg_(msgId, [title])));
}
cvox.ChromeVox.earcons.playEarcon(cvox.Earcon.OBJECT_SELECT);
}.bind(this));
}.bind(this));
},
/**
* The chrome.tabs API doesn't always fire an onUpdated event when a
* page finishes loading, so we poll it.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment