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

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

Issue 12491012: Improved extension activity logging for the chrome.webRequest API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Support binary header values 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 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 dcf8e8fdd5a54c209d08ffb0492afe6d4533c2bc..8641f619cb84d7627727b133545f2ba42283ab44 100644
--- a/chrome/browser/extensions/activity_log.cc
+++ b/chrome/browser/extensions/activity_log.cc
@@ -357,6 +357,48 @@ void ActivityLog::LogDOMAction(const Extension* extension,
DOMAction::MODIFIED);
}
+void ActivityLog::LogWebRequestAction(const Extension* extension,
+ const GURL& url,
+ const std::string& api_call,
+ scoped_ptr<DictionaryValue> details,
+ const std::string& extra) {
+ string16 null_title;
+ if (!IsLogEnabled()) return;
+
+ if (!log_arguments_) {
felt 2013/04/11 21:13:37 just a heads up: if issue 13726026 lands first thi
mvrable 2013/04/11 21:41:26 Thanks for the advance notice; I'll fix this befor
+ DictionaryValue::Iterator details_iterator(*details);
+ while (!details_iterator.IsAtEnd()) {
+ details->SetBoolean(details_iterator.key(), true);
+ details_iterator.Advance();
+ }
+ }
+ std::string details_string;
+ JSONStringValueSerializer serializer(&details_string);
+ serializer.SerializeAndOmitBinaryValues(*details);
+
+ scoped_refptr<DOMAction> action = new DOMAction(
+ extension->id(),
+ base::Time::Now(),
+ DOMAction::WEBREQUEST,
+ url,
+ null_title,
+ api_call,
+ details_string,
+ extra);
+ ScheduleAndForget(&ActivityDatabase::RecordAction, action);
+
+ // Display the action.
+ ObserverMap::const_iterator iter = observers_.find(extension);
+ if (iter != observers_.end()) {
+ iter->second->Notify(&Observer::OnExtensionActivity,
+ extension,
+ ActivityLog::ACTIVITY_CONTENT_SCRIPT,
+ action->PrettyPrintForDebug());
+ }
+ if (log_activity_to_stdout_)
+ LOG(INFO) << action->PrettyPrintForDebug();
+}
+
void ActivityLog::GetActions(
const std::string& extension_id,
const int day,

Powered by Google App Engine
This is Rietveld 408576698