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

Side by Side Diff: chrome/browser/extensions/activity_log/api_actions.h

Issue 14774012: Replaced enum strings with ints in Activity Log database (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved a comment (pre-review) Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_API_ACTIONS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_
7 7
8 #include "chrome/browser/extensions/activity_log/activity_actions.h" 8 #include "chrome/browser/extensions/activity_log/activity_actions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 10
11 namespace extensions { 11 namespace extensions {
12 12
13 // This class describes API calls that did not run into permissions or quota 13 // This class describes API calls that did not run into permissions or quota
14 // problems. See BlockedActions for API calls that did not succeed. 14 // problems. See BlockedActions for API calls that did not succeed.
15 class APIAction : public Action { 15 class APIAction : public Action {
16 public: 16 public:
17 enum Type { 17 enum Type {
Matt Perry 2013/05/17 19:08:55 Add a comment here warning that these values shoul
felt 2013/05/18 00:27:18 Done.
18 CALL, 18 CALL = 0,
19 EVENT_CALLBACK, 19 EVENT_CALLBACK = 1,
20 UNKNOWN_TYPE 20 UNKNOWN_TYPE = 2,
21 }; 21 };
22 22
23 static const char* kTableName; 23 static const char* kTableName;
24 static const char* kTableContentFields[]; 24 static const char* kTableContentFields[];
25 static const char* kTableFieldTypes[];
25 static const char* kAlwaysLog[]; 26 static const char* kAlwaysLog[];
26 static const int kSizeAlwaysLog; 27 static const int kSizeAlwaysLog;
27 28
28 // Create the database table for storing APIActions, or update the schema if 29 // Create the database table for storing APIActions, or update the schema if
29 // it is out of date. Any existing data is preserved. 30 // it is out of date. Any existing data is preserved.
30 static bool InitializeTable(sql::Connection* db); 31 static bool InitializeTable(sql::Connection* db);
31 32
32 // Create a new APIAction to describe a successful API call. All 33 // Create a new APIAction to describe a successful API call. All
33 // parameters are required. 34 // parameters are required.
34 APIAction(const std::string& extension_id, 35 APIAction(const std::string& extension_id,
(...skipping 19 matching lines...) Expand all
54 55
55 // Print a APIAction as a regular string for debugging purposes. 56 // Print a APIAction as a regular string for debugging purposes.
56 virtual std::string PrintForDebug() OVERRIDE; 57 virtual std::string PrintForDebug() OVERRIDE;
57 58
58 // Helper methods for recording the values into the db. 59 // Helper methods for recording the values into the db.
59 const std::string& api_call() const { return api_call_; } 60 const std::string& api_call() const { return api_call_; }
60 const std::string& args() const { return args_; } 61 const std::string& args() const { return args_; }
61 std::string TypeAsString() const; 62 std::string TypeAsString() const;
62 std::string extra() const { return extra_; } 63 std::string extra() const { return extra_; }
63 64
64 // Helper method(s) for creating a APIAction.
65 static Type StringAsType(const std::string& str);
66
67 protected: 65 protected:
68 virtual ~APIAction(); 66 virtual ~APIAction();
69 67
70 private: 68 private:
71 Type type_; 69 Type type_;
72 std::string api_call_; 70 std::string api_call_;
73 std::string args_; 71 std::string args_;
74 std::string extra_; 72 std::string extra_;
75 73
76 DISALLOW_COPY_AND_ASSIGN(APIAction); 74 DISALLOW_COPY_AND_ASSIGN(APIAction);
77 }; 75 };
78 76
79 } // namespace 77 } // namespace
80 78
81 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_ 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698