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

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

Issue 15520002: Moved DOMActionType information from extras into a real field (ActivityLog) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added prefix Created 7 years, 7 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/activity_log.cc
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index 994d3e20263170e0f3f3cad13a76d9eb4a3dc78c..fda5194ae2c5981d4f1657667008461f3bc4e80d 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -317,17 +317,20 @@ void ActivityLog::LogBlockedAction(const Extension* extension,
LOG(INFO) << action->PrintForDebug();
}
-void ActivityLog::LogDOMActionInternal(const Extension* extension,
- const GURL& url,
- const string16& url_title,
- const std::string& api_call,
- const ListValue* args,
- const std::string& extra,
- DOMAction::DOMActionType verb) {
+void ActivityLog::LogDOMAction(const Extension* extension,
+ const GURL& url,
+ const string16& url_title,
+ const std::string& api_call,
+ const ListValue* args,
+ DomActionType::Type call_type,
+ const std::string& extra) {
+ if (!IsLogEnabled()) return;
+ if (call_type == DomActionType::METHOD && api_call == "XMLHttpRequest.open")
+ call_type = DomActionType::XHR;
scoped_refptr<DOMAction> action = new DOMAction(
extension->id(),
base::Time::Now(),
- verb,
+ call_type,
url,
url_title,
api_call,
@@ -340,7 +343,7 @@ void ActivityLog::LogDOMActionInternal(const Extension* extension,
if (iter != observers_.end()) {
// TODO(felt): This is a kludge, planning to update this when new
// UI is in place.
- if (verb == DOMAction::INSERTED) {
+ if (call_type == DomActionType::INSERTED) {
iter->second->Notify(&Observer::OnExtensionActivity,
extension,
ActivityLog::ACTIVITY_CONTENT_SCRIPT,
@@ -356,33 +359,6 @@ void ActivityLog::LogDOMActionInternal(const Extension* extension,
LOG(INFO) << action->PrintForDebug();
}
-void ActivityLog::LogDOMAction(const Extension* extension,
- const GURL& url,
- const string16& url_title,
- const std::string& api_call,
- const ListValue* args,
- const std::string& extra) {
- if (!IsLogEnabled()) return;
- DOMAction::DOMActionType action = DOMAction::MODIFIED;
- if (extra == "Getter") {
- action = DOMAction::GETTER;
- } else if (extra == "Setter") {
- action = DOMAction::SETTER;
- } else if (api_call == "XMLHttpRequest.open") {
- // Has to come before the Method check because XHR is also a Method.
- action = DOMAction::XHR;
- } else if (extra == "Method") {
- action = DOMAction::METHOD;
- }
- LogDOMActionInternal(extension,
- url,
- url_title,
- api_call,
- args,
- extra,
- action);
-}
-
void ActivityLog::LogWebRequestAction(const Extension* extension,
const GURL& url,
const std::string& api_call,
@@ -407,7 +383,7 @@ void ActivityLog::LogWebRequestAction(const Extension* extension,
scoped_refptr<DOMAction> action = new DOMAction(
extension->id(),
base::Time::Now(),
- DOMAction::WEBREQUEST,
+ DomActionType::WEBREQUEST,
url,
null_title,
api_call,
@@ -473,13 +449,13 @@ void ActivityLog::OnScriptsExecuted(
}
scoped_ptr<ListValue> script_names(new ListValue());
script_names->Set(0, new StringValue(ext_scripts_str));
- LogDOMActionInternal(extension,
- on_url,
- web_contents->GetTitle(),
- std::string(), // no api call here
- script_names.get(),
- std::string(), // no extras either
- DOMAction::INSERTED);
+ LogDOMAction(extension,
+ on_url,
+ web_contents->GetTitle(),
+ std::string(), // no api call here
+ script_names.get(),
+ DomActionType::INSERTED,
+ std::string()); // no extras either
}
}
}
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_log.h ('k') | chrome/browser/extensions/activity_log/activity_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698