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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js

Issue 2782753002: Ensure only one instance of AutomationInternalCustomBindings for background page extensions (Closed)
Patch Set: Rebase. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34e0bfb5128cbe0e06e93eebe682c6e09678d096..f3c99f38185bf43dda49bc74114c17665a6bb049 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -165,6 +165,9 @@ Panel.init = function() {
Panel.closeMenusAndRestoreFocus();
}, false);
+
+ /** @type {Window} */
+ Panel.ownerWindow = window;
};
/**
@@ -291,7 +294,13 @@ Panel.setMode = function(mode) {
this.mode_ = mode;
document.title = Msgs.getMsg(Panel.ModeInfo[this.mode_].title);
- window.location = Panel.ModeInfo[this.mode_].location;
+
+ // Fully qualify the path here because this function might be called with a
+ // window object belonging to the background page.
+ Panel.ownerWindow.location =
+ chrome.extension.getURL('cvox2/background/panel.html') +
+ Panel.ModeInfo[this.mode_].location;
+
$('main').hidden = (this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL);
$('menus_background').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_MENUS);
$('tutorial').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_TUTORIAL);
@@ -804,7 +813,8 @@ Panel.onOptions = function() {
Panel.onClose = function() {
// Change the url fragment to 'close', which signals the native code
// to exit ChromeVox.
- window.location = '#close';
+ Panel.ownerWindow.location =
+ chrome.extension.getURL('cvox2/background/panel.html') + '#close';
};
/**
@@ -834,7 +844,8 @@ Panel.closeMenusAndRestoreFocus = function() {
}
}.bind(this);
- chrome.automation.getDesktop(function(desktop) {
+ var bkgnd = chrome.extension.getBackgroundPage();
+ bkgnd.chrome.automation.getDesktop(function(desktop) {
onFocus = /** @type {function(chrome.automation.AutomationEvent)} */(
onFocus.bind(this, desktop));
desktop.addEventListener(chrome.automation.EventType.FOCUS,
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698