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

Unified Diff: chrome/browser/extensions/api_actions.h

Issue 11946028: Record event activity to the extension activity log. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update database schema if needed Created 7 years, 11 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
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..a69a8d8c76ff24fcf95746656117c4162245e9e5 100644
--- a/chrome/browser/extensions/api_actions.h
+++ b/chrome/browser/extensions/api_actions.h
@@ -15,6 +15,14 @@ namespace extensions {
// problems. See BlockedActions for API calls that did not succeed.
class APIAction : public Action {
public:
+ // TODO(mvrable): Come up with a good name for this; I'm not entirely happy
Eric Dingle 2013/01/24 16:16:34 Maybe use APIActionType here and use APIActionVerb
mvrable 2013/01/24 18:12:31 That sounds good to me. Adrienne, are you fine wi
+ // with APICategory but "type" is already used.
+ enum APICategory {
+ CALL,
+ EVENT_CALLBACK,
+ UNKNOWN_CATEGORY
+ };
+
// TODO(felt): I'll finalize this list when making the UI.
enum APIActionType {
READ,
@@ -42,10 +50,15 @@ 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 APICategory category, // e.g. "CALL"
const APIActionType verb, // e.g. "ADDED"
const APITargetType target, // e.g. "BOOKMARK"
const std::string& api_call, // full method signature incl args
@@ -64,11 +77,13 @@ 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 CategoryAsString() const;
std::string VerbAsString() const;
std::string TargetAsString() const;
std::string extra() const { return extra_; }
// Helper methods for creating a APIAction.
+ static APICategory StringAsCategory(const std::string& str);
static APIActionType StringAsActionType(const std::string& str);
static APITargetType StringAsTargetType(const std::string& str);
@@ -78,6 +93,7 @@ class APIAction : public Action {
private:
std::string extension_id_;
base::Time time_;
+ APICategory category_;
APIActionType verb_;
APITargetType target_;
std::string api_call_;

Powered by Google App Engine
This is Rietveld 408576698