diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 03:24:36 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 03:24:36 +0000 |
commit | cf9a246cf386c7af0fb6524ac5d025c0d4e8563a (patch) | |
tree | 914b55375eee47f6d21f2fc3f106c4ba506637ec /chrome/renderer/resources/extension_process_bindings.js | |
parent | 0c48c17f7ebcc0c8f79eba1aeae56d32b3c2f03f (diff) | |
download | chromium_src-cf9a246cf386c7af0fb6524ac5d025c0d4e8563a.zip chromium_src-cf9a246cf386c7af0fb6524ac5d025c0d4e8563a.tar.gz chromium_src-cf9a246cf386c7af0fb6524ac5d025c0d4e8563a.tar.bz2 |
EFD now notifies EPM of renderviews created, which in turn notifies the renderer of page actions that it knows about.
Remove generic event "page-action-executed" in favor of page action specific event (sent as extension_id/page_action_id).
In the bindings, we now setup events for each page action we know about so we can register for specific events, and not receive broadcast events from all page actions. To setup these events I added a GetCurrentPageActions() to extension_process_bindings.cc and a helper function GetCurrentExtensionId().
And, finally, I simplified the page action background page by removing the check to see if we are already subscribed to the feed (since we now support multiple feed readers, it doesn't make sense anymore to always check Google Reader). This check might make a comeback later in a different form.
BUG=13936
TEST=The RSS sample extension should work as before.
Review URL: http://codereview.chromium.org/155514
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources/extension_process_bindings.js')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 1c8fc9c4..e0dba27 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -30,6 +30,7 @@ var chrome = chrome || {}; native function GetTabLanguage(); native function EnablePageAction(); native function DisablePageAction(); + native function GetCurrentPageActions(); native function GetBookmarks(); native function GetBookmarkChildren(); native function GetBookmarkTree(); @@ -397,9 +398,16 @@ var chrome = chrome || {}; } ]; - // Sends ({pageActionId, tabId, tabUrl}). - chrome.pageActions.onExecute = - new chrome.Event("page-action-executed"); + // Page action events send (pageActionId, {tabId, tabUrl}). + function setupPageActionEvents(extensionId) { + var pageActions = GetCurrentPageActions(); + var eventName = ""; + for (var i = 0; i < pageActions.length; ++i) { + eventName = extensionId + "/" + pageActions[i]; + // Setup events for each extension_id/page_action_id string we find. + chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); + } + } //---------------------------------------------------------------------------- // Bookmarks @@ -548,6 +556,8 @@ var chrome = chrome || {}; // 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); + + setupPageActionEvents(extensionId); }); chrome.self.getViews = function() { |