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

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

Issue 165323: Add chrome.extension to extension_api.json and docs (Closed)
Patch Set: precommit Created 11 years, 4 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
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extension_process_bindings.js
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index 1e33cb984a849c7f5b237b545464c2951143aaea..e828bd5c70f310dffee845196376db77e16cdb00 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -150,12 +150,17 @@ var chrome = chrome || {};
}
forEach(apiDefinitions, function(apiDef) {
- var module = {};
- chrome[apiDef.namespace] = module;
+ chrome[apiDef.namespace] = chrome[apiDef.namespace] || {};
+ var module = chrome[apiDef.namespace];
// Setup Functions.
if (apiDef.functions) {
forEach(apiDef.functions, function(functionDef) {
+ // Module functions may have been defined earlier by hand. Don't clobber
+ // them.
+ if (module[functionDef.name])
+ return;
+
var apiFunction = {};
apiFunction.definition = functionDef;
apiFunction.name = apiDef.namespace + "." + functionDef.name;;
@@ -176,6 +181,11 @@ var chrome = chrome || {};
// Setup Events
if (apiDef.events) {
forEach(apiDef.events, function(eventDef) {
+ // Module events may have been defined earlier by hand. Don't clobber
+ // them.
+ if (module[eventDef.name])
+ return;
+
var eventName = apiDef.namespace + "." + eventDef.name;
module[eventDef.name] = new chrome.Event(eventName);
});
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698