Chromium Code Reviews| Index: chrome/browser/extensions/activity_log.cc |
| diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc |
| index afdaa83dae8bfee8917fcbd6bada01b53f920c0c..467de57e098d7c99d9fb26a0d7c1cdd1690f1aa9 100644 |
| --- a/chrome/browser/extensions/activity_log.cc |
| +++ b/chrome/browser/extensions/activity_log.cc |
| @@ -161,6 +161,41 @@ void ActivityLog::LogAPIAction(const Extension* extension, |
| scoped_refptr<APIAction> action = new APIAction( |
| extension->id(), |
| base::Time::Now(), |
| + APIAction::CALL, |
| + APIAction::StringAsActionType(verb), |
| + APIAction::StringAsTargetType(manager), |
| + call_signature, |
| + 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_EVENT_DISPATCH, |
|
felt
2013/01/22 22:45:52
This should be ACTIVITY_EXTENSION_API_CALL
mvrable
2013/01/23 16:54:07
Thanks for catching this--I was having trouble fig
|
| + call_signature); |
| + } |
| + if (log_activity_to_stdout_) { |
| + LOG(INFO) << action->PrettyPrintForDebug(); |
| + } |
| + } else { |
| + LOG(ERROR) << "Unknown API call! " << name; |
| + } |
| +} |
| + |
| +void ActivityLog::LogEventAction(const Extension* extension, |
| + const std::string& name, |
| + const ListValue* args, |
| + const std::string& extra) { |
| + std::string verb, manager; |
| + bool matches = RE2::FullMatch(name, "(.*?)\\.(.*)", &manager, &verb); |
| + if (matches) { |
| + std::string call_signature = MakeCallSignature(name, args); |
| + scoped_refptr<APIAction> action = new APIAction( |
| + extension->id(), |
| + base::Time::Now(), |
| + APIAction::EVENT_CALLBACK, |
| APIAction::StringAsActionType(verb), |
| APIAction::StringAsTargetType(manager), |
| call_signature, |
| @@ -289,6 +324,8 @@ const char* ActivityLog::ActivityToString(Activity activity) { |
| return "api_block"; |
| case ActivityLog::ACTIVITY_CONTENT_SCRIPT: |
| return "content_script"; |
| + case ActivityLog::ACTIVITY_EVENT_DISPATCH: |
| + return "event_dispatch"; |
| default: |
| NOTREACHED(); |
| return ""; |