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

Unified Diff: chrome/renderer/resources/extensions/binding.js

Issue 12517011: Added activity logging for ext APIs with custom bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified it to work with another CL that happened while I was working on it Created 7 years, 9 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/extensions/binding.js
diff --git a/chrome/renderer/resources/extensions/binding.js b/chrome/renderer/resources/extensions/binding.js
index 9fdb392e9aae13d9e6bee6836718a4ecaecd2efa..9e2725a0e2adae16215d284915388e29dae35778 100644
--- a/chrome/renderer/resources/extensions/binding.js
+++ b/chrome/renderer/resources/extensions/binding.js
@@ -17,13 +17,15 @@ var schemaRegistry = requireNative('schema_registry');
var schemaUtils = require('schemaUtils');
var sendRequest = require('sendRequest').sendRequest;
var utils = require('utils');
+var logActivity = requireNative('activityLogger').LogActivity;
// Stores the name and definition of each API function, with methods to
// modify their behaviour (such as a custom way to handle requests to the
// API, a custom callback, etc).
-function APIFunctions() {
+function APIFunctions(namespace) {
this.apiFunctions_ = {};
this.unavailableApiFunctions_ = {};
+ this.namespace = namespace;
}
APIFunctions.prototype.register = function(apiName, apiFunction) {
@@ -48,7 +50,14 @@ APIFunctions.prototype.setHook_ =
APIFunctions.prototype.setHandleRequest =
function(apiName, customizedFunction) {
- return this.setHook_(apiName, 'handleRequest', customizedFunction);
+ var ext_id = extensionId;
Matt Perry 2013/03/14 20:32:31 is this temporary needed?
felt 2013/03/15 00:04:47 Done.
+ var prefix = this.namespace;
+ return this.setHook_(apiName, 'handleRequest',
+ function() {
+ logActivity(ext_id, prefix + "." + apiName,
+ Array.prototype.slice.call(arguments));
+ return customizedFunction.apply(this, arguments);
+ });
};
APIFunctions.prototype.setUpdateArgumentsPostValidate =
@@ -121,7 +130,7 @@ var platform = getPlatform();
function Binding(schema) {
this.schema_ = schema;
- this.apiFunctions_ = new APIFunctions();
+ this.apiFunctions_ = new APIFunctions(schema.namespace);
this.customEvent_ = null;
this.customTypes_ = {};
this.customHooks_ = [];
« no previous file with comments | « chrome/renderer/extensions/dom_activity_logger.h ('k') | chrome/test/data/extensions/activity_log/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698