Index: chrome/browser/extensions/api_actions.h |
diff --git a/chrome/browser/extensions/api_actions.h b/chrome/browser/extensions/api_actions.h |
index 3cbd5ff15a9ac3c1156830eddecfc1f4811eeb6d..7bcbbe8a40462f9b879b32fd08f0b29e6a790cce 100644 |
--- a/chrome/browser/extensions/api_actions.h |
+++ b/chrome/browser/extensions/api_actions.h |
@@ -15,8 +15,14 @@ namespace extensions { |
// problems. See BlockedActions for API calls that did not succeed. |
class APIAction : public Action { |
public: |
+ enum Type { |
+ CALL, |
+ EVENT_CALLBACK, |
+ UNKNOWN_TYPE |
+ }; |
+ |
// TODO(felt): I'll finalize this list when making the UI. |
- enum APIActionType { |
+ enum Verb { |
READ, |
MODIFIED, |
DELETED, |
@@ -24,11 +30,11 @@ class APIAction : public Action { |
ENABLED, |
DISABLED, |
CREATED, |
- UNKNOWN_ACTION |
+ UNKNOWN_VERB |
}; |
// TODO(felt): I'll finalize this list when making the UI. |
- enum APITargetType { |
+ enum Target { |
BOOKMARK, |
TABS, |
HISTORY, |
@@ -42,14 +48,19 @@ class APIAction : public Action { |
static const char* kTableName; |
static const char* kTableStructure; |
+ // Create the database table for storing APIActions, or update the schema if |
+ // it is out of date. Any existing data is preserved. |
+ static bool InitializeTable(sql::Connection* db); |
+ |
// Create a new APIAction to describe a successful API call. All |
// parameters are required. |
APIAction(const std::string& extension_id, |
const base::Time& time, |
- const APIActionType verb, // e.g. "ADDED" |
- const APITargetType target, // e.g. "BOOKMARK" |
- const std::string& api_call, // full method signature incl args |
- const std::string& extra); // any extra logging info |
+ const Type type, // e.g. "CALL" |
+ const Verb verb, // e.g. "ADDED" |
+ const Target target, // e.g. "BOOKMARK" |
+ const std::string& api_call, // full method signature incl args |
+ const std::string& extra); // any extra logging info |
// Record the action in the database. |
virtual void Record(sql::Connection* db) OVERRIDE; |
@@ -64,13 +75,15 @@ class APIAction : public Action { |
const std::string& extension_id() const { return extension_id_; } |
const base::Time& time() const { return time_; } |
const std::string& api_call() const { return api_call_; } |
+ std::string TypeAsString() const; |
std::string VerbAsString() const; |
std::string TargetAsString() const; |
std::string extra() const { return extra_; } |
// Helper methods for creating a APIAction. |
- static APIActionType StringAsActionType(const std::string& str); |
- static APITargetType StringAsTargetType(const std::string& str); |
+ static Type StringAsType(const std::string& str); |
+ static Verb StringAsVerb(const std::string& str); |
+ static Target StringAsTarget(const std::string& str); |
protected: |
virtual ~APIAction(); |
@@ -78,8 +91,9 @@ class APIAction : public Action { |
private: |
std::string extension_id_; |
base::Time time_; |
- APIActionType verb_; |
- APITargetType target_; |
+ Type type_; |
+ Verb verb_; |
+ Target target_; |
std::string api_call_; |
std::string extra_; |
@@ -89,4 +103,3 @@ class APIAction : public Action { |
} // namespace |
#endif // CHROME_BROWSER_EXTENSIONS_API_ACTIONS_H_ |
- |