| 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..3b33963fcadf225b1d5e35479fe7a3fbc88f3b31 100644
|
| --- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
|
| +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
|
| @@ -7,31 +7,27 @@
|
|
|
| #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 ActivityDatabase::Delegate {
|
| 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,
|
| const base::ListValue* args,
|
| const base::DictionaryValue* details) OVERRIDE;
|
|
|
| - virtual void SaveState() OVERRIDE {}
|
| -
|
| // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy.
|
| // It assumes that the callback can return a sorted vector of actions. Some
|
| // policies might not do that. For instance, imagine a trivial policy that
|
| @@ -44,12 +40,21 @@ class FullStreamUIPolicy : public ActivityLogPolicy {
|
| <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback)
|
| const OVERRIDE;
|
|
|
| - virtual void SetSaveStateOnRequestOnly() OVERRIDE;
|
| -
|
| // Returns the actual key for a given key type
|
| virtual std::string GetKey(ActivityLogPolicy::KeyType key_id) const OVERRIDE;
|
|
|
| + virtual void Close() OVERRIDE;
|
| +
|
| protected:
|
| + // Only ever run by OnDatabaseClose() below; see the comments on the
|
| + // ActivityDatabase class for an overall discussion of how cleanup works.
|
| + virtual ~FullStreamUIPolicy() {}
|
| +
|
| + // The ActivityDatabase::PolicyDelegate interface. These are always called
|
| + // from the database thread.
|
| + virtual bool OnDatabaseInit(sql::Connection* db) OVERRIDE;
|
| + virtual void OnDatabaseClose() OVERRIDE;
|
| +
|
| // Concatenates arguments
|
| virtual std::string ProcessArguments(ActionType action_type,
|
| const std::string& name,
|
| @@ -59,10 +64,8 @@ class FullStreamUIPolicy : public ActivityLogPolicy {
|
| base::DictionaryValue& details,
|
| std::string& details_string) const;
|
|
|
| - // We initialize this on the same thread as the ActivityLog and policy, but
|
| - // then subsequent operations occur on the DB thread. Instead of destructing
|
| - // the ActivityDatabase, we call its Close() method on the DB thread and it
|
| - // commits suicide.
|
| + // See the comments for the ActivityDatabase class for a discussion of how
|
| + // cleanup runs.
|
| ActivityDatabase* db_;
|
| };
|
|
|
|
|