Index: chrome/renderer/resources/extension_process_bindings.js |
=================================================================== |
--- chrome/renderer/resources/extension_process_bindings.js (revision 20629) |
+++ chrome/renderer/resources/extension_process_bindings.js (working copy) |
@@ -30,6 +30,7 @@ |
native function GetTabLanguage(); |
native function EnablePageAction(); |
native function DisablePageAction(); |
+ native function GetCurrentPageActions(); |
native function GetBookmarks(); |
native function GetBookmarkChildren(); |
native function GetBookmarkTree(); |
@@ -397,9 +398,15 @@ |
} |
]; |
- // Sends ({pageActionId, tabId, tabUrl}). |
- chrome.pageActions.onExecute = |
- new chrome.Event("page-action-executed"); |
+ // Page action events send (pageActionId, {tabId, tabUrl}). |
+ function setupEventListeners(extensionId) { |
Aaron Boodman
2009/07/14 21:28:52
Rename this to something like setupPageActionEvent
|
+ var pageActions = GetCurrentPageActions(); |
+ for (var i = 0; i < pageActions.length; ++i) { |
+ var eventName = extensionId + "/" + pageActions[i]; |
Aaron Boodman
2009/07/14 21:28:52
Nit: there's no block scope in JavaScript so this
|
+ // Setup events for each extension_id/page_action_id string we find. |
+ chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); |
+ } |
+ } |
//---------------------------------------------------------------------------- |
// Bookmarks |
@@ -548,6 +555,8 @@ |
// TODO(mpcomplete): self.onConnect is deprecated. Remove it at 1.0. |
// http://code.google.com/p/chromium/issues/detail?id=16356 |
chrome.self.onConnect = new chrome.Event("channel-connect:" + extensionId); |
+ |
+ setupEventListeners(extensionId); |
}); |
chrome.self.getViews = function() { |