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

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

Issue 15686007: Remove Activity Log usage of Extension objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added removed code back to see if that fixes persistent memory errors Created 7 years, 6 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 | « no previous file | chrome/browser/extensions/activity_log/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/activity_log.h
diff --git a/chrome/browser/extensions/activity_log/activity_log.h b/chrome/browser/extensions/activity_log/activity_log.h
index d0f42eedc3dce87f837945026cb0d02d305aaf1c..2314f0e82d01b6e7e74e4971f4c79869f79b1850 100644
--- a/chrome/browser/extensions/activity_log/activity_log.h
+++ b/chrome/browser/extensions/activity_log/activity_log.h
@@ -38,20 +38,10 @@ class Extension;
class ActivityLog : public BrowserContextKeyedService,
public TabHelper::ScriptExecutionObserver {
public:
- 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_EVENT_DISPATCH, // Event sent to listener in extension.
- };
-
// Observers can listen for activity events.
class Observer {
public:
- virtual void OnExtensionActivity(
- const Extension* extension,
- Activity activity,
- const std::string& message) = 0;
+ virtual void OnExtensionActivity(scoped_refptr<Action> activity) = 0;
};
// ActivityLog is a singleton, so don't instantiate it with the constructor;
@@ -68,17 +58,13 @@ class ActivityLog : public BrowserContextKeyedService,
static void RecomputeLoggingIsEnabled();
// Add/remove observer.
- void AddObserver(const Extension* extension, Observer* observer);
- void RemoveObserver(const Extension* extension,
- Observer* observer);
-
- // Check for the existence observer list by extension_id.
- bool HasObservers(const Extension* extension) const;
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
// Log a successful API call made by an extension.
// This will create an APIAction for storage in the database.
// (Note: implemented as a wrapper for LogAPIActionInternal.)
- void LogAPIAction(const Extension* extension,
+ void LogAPIAction(const std::string& extension_id,
const std::string& name, // e.g., tabs.get
ListValue* args, // the argument values e.g. 46
const std::string& extra); // any extra logging info
@@ -86,14 +72,14 @@ class ActivityLog : public BrowserContextKeyedService,
// Log an event notification delivered to an extension.
// This will create an APIAction for storage in the database.
// (Note: implemented as a wrapper for LogAPIActionInternal.)
- void LogEventAction(const Extension* extension,
+ void LogEventAction(const std::string& extension_id,
const std::string& name, // e.g., tabs.onUpdate
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,
+ void LogBlockedAction(const std::string& extension_id,
const std::string& blocked_call, // e.g., tabs.get
ListValue* args, // argument values
const BlockedAction::Reason reason, // why it's blocked
@@ -101,7 +87,7 @@ class ActivityLog : public BrowserContextKeyedService,
// Log an interaction between an extension and a URL.
// This will create a DOMAction for storage in the database.
- void LogDOMAction(const Extension* extension,
+ void LogDOMAction(const std::string& extension_id,
const GURL& url, // target URL
const string16& url_title, // title of the URL
const std::string& api_call, // api call
@@ -111,7 +97,7 @@ class ActivityLog : public BrowserContextKeyedService,
// Log a use of the WebRequest API to redirect, cancel, or modify page
// headers.
- void LogWebRequestAction(const Extension* extension,
+ void LogWebRequestAction(const std::string& extension_id,
const GURL& url,
const std::string& api_call,
scoped_ptr<base::DictionaryValue> details,
@@ -142,7 +128,7 @@ class ActivityLog : public BrowserContextKeyedService,
// We log callbacks and API calls very similarly, so we handle them the same
// way internally.
void LogAPIActionInternal(
- const Extension* extension,
+ const std::string& extension_id,
const std::string& api_call,
ListValue* args,
const std::string& extra,
@@ -159,8 +145,6 @@ class ActivityLog : public BrowserContextKeyedService,
// The callback when initializing the database.
void OnDBInitComplete();
- static const char* ActivityToString(Activity activity);
-
// The Schedule methods dispatch the calls to the database on a
// separate thread. We dispatch to the UI thread if the DB thread doesn't
// exist, which should only happen in tests where there is no DB thread.
@@ -186,10 +170,6 @@ class ActivityLog : public BrowserContextKeyedService,
}
typedef ObserverListThreadSafe<Observer> ObserverList;
- typedef std::map<const Extension*, scoped_refptr<ObserverList> >
- ObserverMap;
- // A map of extensions to activity observers for that extension.
- ObserverMap observers_;
// The database wrapper that does the actual database I/O.
// We initialize this on the same thread as the ActivityLog, but then
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698