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

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

Issue 18660004: Extension activity log database refactoring (step 1) (Closed) Base URL: http://git.chromium.org/chromium/src.git@incognito-tests
Patch Set: Change lifetime management for policies Created 7 years, 5 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/fullstream_ui_policy.h
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
index 88bb0293fac04489739abc5a751a9aed63e855b7..9c5fefe66406418757195d591e29eed5c6a3a72e 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
@@ -7,23 +7,21 @@
#include <string>
#include <vector>
+#include "chrome/browser/extensions/activity_log/activity_database.h"
#include "chrome/browser/extensions/activity_log/activity_log_policy.h"
class GURL;
namespace extensions {
-class ActivityDatabase;
-
// A policy for logging the full stream of actions, including all arguments.
// It's mostly intended to be used in testing and analysis.
-class FullStreamUIPolicy : public ActivityLogPolicy {
+class FullStreamUIPolicy : public ActivityLogPolicy,
+ public ActivityPolicyCallbacks {
felt 2013/07/09 22:14:51 Maybe the name should have both Database and Polic
mvrable 2013/07/09 23:03:22 ActivityLogPolicyDatabaseCallbacks? That's gettin
felt 2013/07/10 00:14:36 ActivityDatabasePolicyCallback? 3 characters short
mvrable 2013/07/10 17:49:17 I'm going to change this to ActivityDatabaseCallba
felt 2013/07/10 18:35:17 Thanks, sorry to be picky on this. :)
mvrable 2013/07/10 20:48:41 Not a problem, coming up with good names is import
public:
// For more info about these member functions, see the super class.
explicit FullStreamUIPolicy(Profile* profile);
- virtual ~FullStreamUIPolicy();
-
virtual void ProcessAction(ActionType action_type,
const std::string& extension_id,
const std::string& name, const GURL& gurl,
@@ -49,7 +47,15 @@ class FullStreamUIPolicy : public ActivityLogPolicy {
// Returns the actual key for a given key type
virtual std::string GetKey(ActivityLogPolicy::KeyType key_id) const OVERRIDE;
+ virtual void Close() OVERRIDE;
+
protected:
+ virtual ~FullStreamUIPolicy() {}
+
+ // The ActivityPolicyCallbacks interface.
+ virtual bool DatabaseInitCallback(sql::Connection* db) OVERRIDE;
+ virtual void DatabaseCloseCallback() OVERRIDE;
+
// Concatenates arguments
virtual std::string ProcessArguments(ActionType action_type,
const std::string& name,
@@ -64,6 +70,14 @@ class FullStreamUIPolicy : public ActivityLogPolicy {
// the ActivityDatabase, we call its Close() method on the DB thread and it
// commits suicide.
ActivityDatabase* db_;
+
+ private:
+ friend class ActivityDatabaseTest;
+
+ // Initializes the database tables. This is called by the ActivityDatabase,
+ // on the database thread, after opening the database. Returns true on
+ // success.
+ static bool InitializeTables(sql::Connection* db);
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698