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

Unified Diff: chrome/renderer/resources/extensions/browser_action_custom_bindings.js

Issue 25305002: Implement initial chrome.browserAction.openPopup API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to interactive_ui_test Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/browser_action_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/browser_action_custom_bindings.js b/chrome/renderer/resources/extensions/browser_action_custom_bindings.js
index d90ab18235c3e7ac53f9429e0b8c9edc1c44ffa8..9a9fae08eea5eea998faef958d0bc7d7e026d969 100644
--- a/chrome/renderer/resources/extensions/browser_action_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/browser_action_custom_bindings.js
@@ -7,6 +7,7 @@
var binding = require('binding').Binding.create('browserAction');
var setIcon = require('setIcon').setIcon;
+var getExtensionViews = requireNative('extension').GetExtensionViews;
binding.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
@@ -15,6 +16,19 @@ binding.registerCustomHook(function(bindingsAPI) {
setIcon(details, callback, this.name, this.definition.parameters,
'browser action');
});
+
+ apiFunctions.setCustomCallback('openPopup',
+ function(name, request, response) {
+ if (chrome.runtime.lastError)
+ throw new Error(chrome.runtime.lastError.message);
not at google - send to devlin 2013/10/23 23:18:42 don't throw an error here. chrome.runtime.lastErro
justinlin 2013/10/24 00:01:38 Ah thanks. https://codereview.chromium.org/3228300
+
+ if (!request.callback)
+ return;
+
+ var views = getExtensionViews(-1, 'POPUP');
+ request.callback(views.length > 0 ? views[0] : null);
+ request.callback = null;
+ });
});
exports.binding = binding.generate();

Powered by Google App Engine
This is Rietveld 408576698