Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| index 60133570e9f67c0957f4b0783c87f0aa401343a4..1ebb60ee75184e613b8da8ddbd067894e63c3388 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| @@ -617,24 +617,30 @@ Panel.getCallbackForCurrentItem = function() { |
| * was queued, execute it once focus is restored. |
| */ |
| Panel.closeMenusAndRestoreFocus = function() { |
| - // Make sure we're not in full-screen mode. |
| - window.location = '#'; |
| - |
| - this.activeMenu_ = null; |
| + // Watch for the next focus event. |
| + var desktop = null; |
| + var onFocus = function(evt) { |
|
dmazzoni
2016/10/11 17:41:18
Rather than add and remove a focus listener, what
David Tseng
2016/10/11 21:24:32
I'd like to limit the panel's global event listene
|
| + desktop.removeEventListener(chrome.automation.EventType.focus, onFocus); |
| + Panel.pendingCallback_ && Panel.pendingCallback_(); |
| + }.bind(this); |
| + |
| + chrome.automation.getDesktop(function(node) { |
|
dmazzoni
2016/10/11 17:41:18
How about: getDesktop(function(desktop) {
David Tseng
2016/10/11 21:24:32
desktop is used above. I guess I could bind it to
|
| + desktop = node; |
| + desktop.addEventListener(chrome.automation.EventType.focus, |
| + onFocus, |
| + true); |
| + |
| + // Make sure we're not in full-screen mode. |
| + window.location = '#'; |
| - var bkgnd = |
| - chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; |
| - bkgnd['endExcursion'](Panel.pendingCallback_); |
| + this.activeMenu_ = null; |
| + }); |
| }; |
| /** |
| * Open the tutorial. |
| */ |
| Panel.onTutorial = function() { |
| - var bkgnd = |
| - chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; |
| - bkgnd['startExcursion'](); |
| - |
| // Change the url fragment to 'fullscreen', which signals the native |
| // host code to make the window fullscreen, revealing the menus. |
| window.location = '#fullscreen'; |