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

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

Issue 12517011: Added activity logging for ext APIs with custom bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint fix 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/schema_generated_bindings.js
diff --git a/chrome/renderer/resources/extensions/schema_generated_bindings.js b/chrome/renderer/resources/extensions/schema_generated_bindings.js
index 65d5cad57b2ddd836beb76b60bb2b3c799c1b35d..ff2e3e829eb837303cde317548a0a122b63d0622 100644
--- a/chrome/renderer/resources/extensions/schema_generated_bindings.js
+++ b/chrome/renderer/resources/extensions/schema_generated_bindings.js
@@ -15,6 +15,7 @@
var utils = require('utils');
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var schemaUtils = require('schemaUtils');
+ var logActivity = requireNative('activityLogger').LogActivity;
// The object to generate the bindings for "internal" APIs in, so that
// extensions can't directly call them (without access to chromeHidden),
@@ -31,6 +32,7 @@
function APIFunctions() {
this._apiFunctions = {};
this._unavailableApiFunctions = {};
+ this.extensionId = "unknown";
}
APIFunctions.prototype.register = function(apiName, apiFunction) {
this._apiFunctions[apiName] = apiFunction;
@@ -51,7 +53,13 @@
};
APIFunctions.prototype.setHandleRequest =
function(apiName, customizedFunction) {
- return this._setHook(apiName, 'handleRequest', customizedFunction);
+ var ext_id = this.extensionId;
+ return this._setHook(apiName, 'handleRequest',
+ function() {
+ logActivity(ext_id, apiName,
Matt Perry 2013/03/14 20:32:31 Unfortunately, some APIs that use setHandleRequest
felt 2013/03/15 00:04:47 Good catch. OK, I did a version of the second one
+ Array.prototype.slice.call(arguments));
+ return customizedFunction.apply(this, arguments);
+ });
};
APIFunctions.prototype.setUpdateArgumentsPostValidate =
function(apiName, customizedFunction) {
@@ -257,6 +265,7 @@
// Setup Functions.
if (apiDef.functions) {
+ apiFunctions.extensionId = extensionId;
apiDef.functions.forEach(function(functionDef) {
if (functionDef.name in mod) {
throw new Error('Function ' + functionDef.name +

Powered by Google App Engine
This is Rietveld 408576698