OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/common/extensions/api/activity_log_private.h" | 12 #include "chrome/common/extensions/api/activity_log_private.h" |
13 #include "sql/connection.h" | 13 #include "sql/connection.h" |
14 #include "sql/statement.h" | 14 #include "sql/statement.h" |
15 #include "sql/transaction.h" | 15 #include "sql/transaction.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // This is the interface for extension actions that are to be recorded in | 19 // This is the interface for extension actions that are to be recorded in |
20 // the activity log. | 20 // the activity log. |
21 class Action : public base::RefCountedThreadSafe<Action> { | 21 class Action : public base::RefCountedThreadSafe<Action> { |
22 public: | 22 public: |
23 static const char* kTableBasicFields; | 23 static const char* kTableBasicFields; |
24 | 24 |
25 // Initialize the table for a given action type. | 25 // Initialize the table for a given action type. |
26 static bool InitializeTableInternal(sql::Connection* db); | 26 static bool InitializeTableInternal(sql::Connection* db); |
27 | 27 |
28 // Record the action in the database. | 28 // Record the action in the database. |
29 virtual bool Record(sql::Connection* db) = 0; | 29 virtual void Record(sql::Connection* db) = 0; |
30 | 30 |
31 // Flatten the activity's type-specific fields into an ExtensionActivity. | 31 // Flatten the activity's type-specific fields into an ExtensionActivity. |
32 virtual scoped_ptr<api::activity_log_private::ExtensionActivity> | 32 virtual scoped_ptr<api::activity_log_private::ExtensionActivity> |
33 ConvertToExtensionActivity() = 0; | 33 ConvertToExtensionActivity() = 0; |
34 | 34 |
35 // Print an action as a regular string for debugging purposes. | 35 // Print an action as a regular string for debugging purposes. |
36 virtual std::string PrintForDebug() = 0; | 36 virtual std::string PrintForDebug() = 0; |
37 | 37 |
38 const std::string& extension_id() const { return extension_id_; } | 38 const std::string& extension_id() const { return extension_id_; } |
39 const base::Time& time() const { return time_; } | 39 const base::Time& time() const { return time_; } |
(...skipping 24 matching lines...) Expand all Loading... |
64 base::Time time_; | 64 base::Time time_; |
65 api::activity_log_private::ExtensionActivity::ActivityType activity_type_; | 65 api::activity_log_private::ExtensionActivity::ActivityType activity_type_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(Action); | 67 DISALLOW_COPY_AND_ASSIGN(Action); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace extensions | 70 } // namespace extensions |
71 | 71 |
72 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ |
73 | 73 |
OLD | NEW |