Chromium Code Reviews| Index: chrome/browser/extensions/activity_log/activity_actions.h |
| diff --git a/chrome/browser/extensions/activity_log/activity_actions.h b/chrome/browser/extensions/activity_log/activity_actions.h |
| index 2a5d6366d4252f7bc1d31d7068f0484f921cb8c6..0a4af59431093d1c2066be0aa503362a45a65103 100644 |
| --- a/chrome/browser/extensions/activity_log/activity_actions.h |
| +++ b/chrome/browser/extensions/activity_log/activity_actions.h |
| @@ -13,6 +13,7 @@ |
| #include "sql/connection.h" |
| #include "sql/statement.h" |
| #include "sql/transaction.h" |
| +#include "url/gurl.h" |
| namespace extensions { |
| @@ -20,10 +21,18 @@ namespace extensions { |
| // the activity log. |
| class Action : public base::RefCountedThreadSafe<Action> { |
| public: |
| - static const char* kTableBasicFields; |
| - |
| - // Initialize the table for a given action type. |
| - static bool InitializeTableInternal(sql::Connection* db); |
| + // Types of log entries that can be stored. The numeric values are stored in |
| + // the database, so keep them stable. |
|
felt
2013/07/18 17:09:59
Can you make this explicit: "Append only."
mvrable
2013/07/18 18:20:34
Done.
|
| + enum ActionType { |
| + ACTION_API_CALL = 0, |
| + ACTION_API_EVENT = 1, |
| + ACTION_API_BLOCKED = 2, |
| + ACTION_CONTENT_SCRIPT = 3, |
| + ACTION_DOM_ACCESS = 4, |
| + ACTION_DOM_EVENT = 5, |
| + ACTION_DOM_XHR = 6, |
| + ACTION_WEB_REQUEST = 7, |
| + }; |
| // Record the action in the database. |
| virtual bool Record(sql::Connection* db) = 0; |
| @@ -46,17 +55,6 @@ class Action : public base::RefCountedThreadSafe<Action> { |
| api::activity_log_private::ExtensionActivity::ActivityType type); |
| virtual ~Action() {} |
| - // Initialize the table for a given action type. |
| - // The content_fields array should list the names of all of the columns in |
| - // the database. The field_types should specify the types of the corresponding |
| - // columns (e.g., INTEGER or LONGVARCHAR). There should be the same number of |
| - // field_types as content_fields, since the two arrays should correspond. |
| - static bool InitializeTableInternal(sql::Connection* db, |
| - const char* table_name, |
| - const char* content_fields[], |
| - const char* field_types[], |
| - const int num_content_fields); |
| - |
| private: |
| friend class base::RefCountedThreadSafe<Action>; |
| @@ -67,6 +65,38 @@ class Action : public base::RefCountedThreadSafe<Action> { |
| DISALLOW_COPY_AND_ASSIGN(Action); |
| }; |
| +// TODO(mvrable): This is a temporary class used to represent Actions which |
| +// have been loaded from the SQLite database. Soon the entire Action hierarchy |
| +// will be flattened out as the type-specific classes are eliminated, at which |
| +// time some of the logic here will be moved. |
| +class WatchdogAction : public Action { |
| + public: |
| + WatchdogAction(const std::string& extension_id, |
| + const base::Time& time, |
| + const ActionType action_type, |
| + const std::string& api_name, // full method name |
| + scoped_ptr<ListValue> args, // the argument list |
| + const GURL& page_url, // page the action occurred on |
| + const GURL& arg_url, // URL extracted from the argument list |
| + scoped_ptr<DictionaryValue> other); // any extra logging info |
| + |
| + virtual bool Record(sql::Connection* db) OVERRIDE; |
| + virtual scoped_ptr<api::activity_log_private::ExtensionActivity> |
| + ConvertToExtensionActivity() OVERRIDE; |
| + virtual std::string PrintForDebug() OVERRIDE; |
| + |
| + protected: |
| + virtual ~WatchdogAction(); |
| + |
| + private: |
| + ActionType action_type_; |
| + std::string api_name_; |
| + scoped_ptr<ListValue> args_; |
| + GURL page_url_; |
| + GURL arg_url_; |
| + scoped_ptr<DictionaryValue> other_; |
| +}; |
| + |
| } // namespace extensions |
| #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ |