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

Unified Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 155514: Implement extension specific events (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/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() {

Powered by Google App Engine
This is Rietveld 408576698