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

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

Issue 19234003: Extension activity log database refactoring (step 2) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address some reviewer comments 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
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_actions.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_actions.h
diff --git a/chrome/browser/extensions/activity_log/activity_actions.h b/chrome/browser/extensions/activity_log/activity_actions.h
index 2a5d6366d4252f7bc1d31d7068f0484f921cb8c6..22a242bb3f151e97764d6298d9174f7092c1c189 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. Append values only.
+ 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_
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698