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(); |