summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/resources
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 20:21:58 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 20:21:58 +0000
commit4577622518be7c7ddd4f3b45016d4fa68d253802 (patch)
treee09db89fdb34063d7dcb6ffc013821792ab3f38e /chrome/renderer/resources
parent631d1ab9de83c531ca43b8134226eb247a4ee3aa (diff)
downloadchromium_src-4577622518be7c7ddd4f3b45016d4fa68d253802.zip
chromium_src-4577622518be7c7ddd4f3b45016d4fa68d253802.tar.gz
chromium_src-4577622518be7c7ddd4f3b45016d4fa68d253802.tar.bz2
Retrying this patch. This was already reviewed by mpcomplete and the
only change is a fix for the UI test that broke and a small change to event_bindings.cc (reviewed in-person). ExtensionFunctionDispatcher now notifies ExtensionProcessManager 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. TBR=mpcomplete BUG=13936 TEST=The RSS sample extension should work as before. Review URL: http://codereview.chromium.org/149683 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources')
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js16
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() {