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

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

Issue 11946028: Record event activity to the extension activity log. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename ActivityLog::IsLoggingEnabled Created 7 years, 11 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
« no previous file with comments | « chrome/browser/extensions/activity_database_unittest.cc ('k') | chrome/browser/extensions/activity_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/activity_log.h
diff --git a/chrome/browser/extensions/activity_log.h b/chrome/browser/extensions/activity_log.h
index 27761a9c334f39de7d2c74c66943ab990bf053d8..c2f7c24275ac144ca55d3927d25360634a0003ba 100644
--- a/chrome/browser/extensions/activity_log.h
+++ b/chrome/browser/extensions/activity_log.h
@@ -36,7 +36,8 @@ class ActivityLog : public ProfileKeyedService,
enum Activity {
ACTIVITY_EXTENSION_API_CALL, // Extension API invocation is called.
ACTIVITY_EXTENSION_API_BLOCK, // Extension API invocation is blocked.
- ACTIVITY_CONTENT_SCRIPT // Content script is executing.
+ ACTIVITY_CONTENT_SCRIPT, // Content script is executing.
+ ACTIVITY_EVENT_DISPATCH, // Event sent to listener in extension.
};
// Observers can listen for activity events.
@@ -54,7 +55,12 @@ class ActivityLog : public ProfileKeyedService,
// Currently, we only want to record actions if the user has opted in to the
// ActivityLog feature.
- bool IsLoggingEnabled();
+ static bool IsLogEnabled();
+
+ // Recompute whether logging should be enabled (the value of IsLogEnabled is
+ // normally cached). WARNING: This may not be thread-safe, and is only
+ // really intended for use by unit tests.
+ static void RecomputeLoggingIsEnabled();
// Add/remove observer.
void AddObserver(const Extension* extension, Observer* observer);
@@ -67,14 +73,21 @@ class ActivityLog : public ProfileKeyedService,
// Log a successful API call made by an extension.
// This will create an APIAction for storage in the database.
void LogAPIAction(const Extension* extension,
- const std::string& name, // e.g., chrome.tabs.get
+ const std::string& name, // e.g., tabs.get
const ListValue* args, // the argument values e.g. 46
const std::string& extra); // any extra logging info
+ // Log an event notification delivered to an extension.
+ // This will create an APIAction for storage in the database.
+ void LogEventAction(const Extension* extension,
+ const std::string& name, // e.g., tabs.onUpdate
+ const ListValue* args, // arguments to the callback
+ const std::string& extra); // any extra logging info
+
// Log a blocked API call made by an extension.
// This will create a BlockedAction for storage in the database.
void LogBlockedAction(const Extension* extension,
- const std::string& blocked_call, // eg chrome.tabs.get
+ const std::string& blocked_call, // e.g., tabs.get
const ListValue* args, // argument values
const char* reason, // why it's blocked
const std::string& extra); // extra logging info
@@ -84,7 +97,7 @@ class ActivityLog : public ProfileKeyedService,
// The technical message might be the list of content scripts that have been
// injected, or the DOM API call; it's what's shown under "More".
void LogUrlAction(const Extension* extension,
- const UrlAction::UrlActionType verb, // eg XHR
+ const UrlAction::UrlActionType verb, // e.g., XHR
const GURL& url, // target URL
const string16& url_title, // title of the URL,
// can be empty string
@@ -186,4 +199,3 @@ class ActivityLogFactory : public ProfileKeyedServiceFactory {
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_
-
« no previous file with comments | « chrome/browser/extensions/activity_database_unittest.cc ('k') | chrome/browser/extensions/activity_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698