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

Side by Side Diff: chrome/renderer/resources/extensions/binding.js

Issue 13726026: Added ActivityLog tests and associated bugfixes/extra logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added message passing test and logging Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 require('json_schema'); 5 require('json_schema');
6 require('event_bindings'); 6 require('event_bindings');
7 var chrome = requireNative('chrome').GetChrome(); 7 var chrome = requireNative('chrome').GetChrome();
8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
9 var forEach = require('utils').forEach; 9 var forEach = require('utils').forEach;
10 var GetAvailability = requireNative('v8_context').GetAvailability; 10 var GetAvailability = requireNative('v8_context').GetAvailability;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if (this.unavailableApiFunctions_.hasOwnProperty(apiName)) 46 if (this.unavailableApiFunctions_.hasOwnProperty(apiName))
47 return; 47 return;
48 if (!this.apiFunctions_.hasOwnProperty(apiName)) 48 if (!this.apiFunctions_.hasOwnProperty(apiName))
49 throw new Error('Tried to set hook for unknown API "' + apiName + '"'); 49 throw new Error('Tried to set hook for unknown API "' + apiName + '"');
50 this.apiFunctions_[apiName][propertyName] = customizedFunction; 50 this.apiFunctions_[apiName][propertyName] = customizedFunction;
51 }; 51 };
52 52
53 APIFunctions.prototype.setHandleRequest = 53 APIFunctions.prototype.setHandleRequest =
54 function(apiName, customizedFunction) { 54 function(apiName, customizedFunction) {
55 var prefix = this.namespace; 55 var prefix = this.namespace;
56 var slicer = Array.prototype.slice;
Matt Perry 2013/04/09 20:56:59 why is this necessary?
felt 2013/04/10 22:25:04 Removed for now.
56 return this.setHook_(apiName, 'handleRequest', 57 return this.setHook_(apiName, 'handleRequest',
57 function() { 58 function() {
58 var ret = customizedFunction.apply(this, arguments); 59 var ret = customizedFunction.apply(this, arguments);
59 // Logs API calls to the Activity Log if it doesn't go through an 60 // Logs API calls to the Activity Log if it doesn't go through an
60 // ExtensionFunction. 61 // ExtensionFunction.
61 if (!sendRequestHandler.getCalledSendRequest()) 62 if (!sendRequestHandler.getCalledSendRequest())
62 logActivity(extensionId, prefix + "." + apiName, 63 logActivity("API", extensionId, prefix + "." + apiName,
63 Array.prototype.slice.call(arguments)); 64 slicer.call(arguments));
64 return ret; 65 return ret;
65 }); 66 });
66 }; 67 };
67 68
68 APIFunctions.prototype.setUpdateArgumentsPostValidate = 69 APIFunctions.prototype.setUpdateArgumentsPostValidate =
69 function(apiName, customizedFunction) { 70 function(apiName, customizedFunction) {
70 return this.setHook_( 71 return this.setHook_(
71 apiName, 'updateArgumentsPostValidate', customizedFunction); 72 apiName, 'updateArgumentsPostValidate', customizedFunction);
72 }; 73 };
73 74
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 }); 412 });
412 }; 413 };
413 414
414 addProperties(mod, schema); 415 addProperties(mod, schema);
415 this.runHooks_(mod); 416 this.runHooks_(mod);
416 return mod; 417 return mod;
417 } 418 }
418 }; 419 };
419 420
420 exports.Binding = Binding; 421 exports.Binding = Binding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698