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

Unified Diff: chrome/browser/extensions/activity_log.cc

Issue 12918020: Removing arguments from the activity log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing include 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/browser/extensions/activity_log.cc
diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc
index 1814ef5caa82fd787ac4ce09b2e2a4a971322865..50f61f67fc7455758e8ea343b9fd846b11590ee3 100644
--- a/chrome/browser/extensions/activity_log.cc
+++ b/chrome/browser/extensions/activity_log.cc
@@ -148,6 +148,17 @@ ActivityLog::ActivityLog(Profile* profile) {
log_activity_to_ui_ = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kEnableExtensionActivityUI);
+ // enable-extension-activity-log-testing
+ // Currently, this just controls whether arguments are collected. In the
+ // future, it may also control other optional activity log features.
+ log_arguments_ = CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kEnableExtensionActivityLogTesting);
+ if (!log_arguments_) {
+ for (int i = 0; i < APIAction::kSizeAlwaysLog; i++) {
+ arg_whitelist_api_.insert(std::string(APIAction::kAlwaysLog[i]));
+ }
+ }
+
// If the database cannot be initialized for some reason, we keep
// chugging along but nothing will get recorded. If the UI is
// available, things will still get sent to the UI even if nothing
@@ -233,7 +244,20 @@ void ActivityLog::LogAPIAction(const Extension* extension,
const ListValue* args,
const std::string& extra) {
if (!IsLogEnabled()) return;
- LogAPIActionInternal(extension, api_call, args, extra, APIAction::CALL);
+ if (log_arguments_ ||
Matt Perry 2013/03/19 01:25:06 nit: more compact: bool log_args = ...; LogAPIAc
+ arg_whitelist_api_.find(api_call) != arg_whitelist_api_.end()) {
+ LogAPIActionInternal(extension,
+ api_call,
+ args,
+ extra,
+ APIAction::CALL);
+ } else {
+ LogAPIActionInternal(extension,
+ api_call,
+ new ListValue(),
+ extra,
+ APIAction::CALL);
+ }
}
// A wrapper around LogAPIActionInternal, but we know it's actually an event
@@ -245,11 +269,18 @@ void ActivityLog::LogEventAction(const Extension* extension,
const ListValue* args,
const std::string& extra) {
if (!IsLogEnabled()) return;
- LogAPIActionInternal(extension,
- api_call,
- args,
- extra,
- APIAction::EVENT_CALLBACK);
+ if (log_arguments_)
+ LogAPIActionInternal(extension,
+ api_call,
+ args,
+ extra,
+ APIAction::EVENT_CALLBACK);
+ else
+ LogAPIActionInternal(extension,
+ api_call,
+ new ListValue(),
+ extra,
+ APIAction::EVENT_CALLBACK);
}
void ActivityLog::LogBlockedAction(const Extension* extension,

Powered by Google App Engine
This is Rietveld 408576698