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

Side by Side Diff: chrome/browser/extensions/activity_log/blocked_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 unified diff | Download patch
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_BLOCKED_ACTIONS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_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 9
10 namespace extensions { 10 namespace extensions {
11 11
12 // This class describes API calls that ran into permissions or quota problems. 12 // This class describes API calls that ran into permissions or quota problems.
13 // See APIActions for API calls that succeeded. 13 // See APIActions for API calls that succeeded.
14 class BlockedAction : public Action { 14 class BlockedAction : public Action {
15 public: 15 public:
16 // These values should not be changed. Append any additional values to the 16 // These values should not be changed. Append any additional values to the
17 // end with sequential numbers. 17 // end with sequential numbers.
18 enum Reason { 18 enum Reason {
19 UNKNOWN = 0, 19 UNKNOWN = 0,
20 ACCESS_DENIED = 1, 20 ACCESS_DENIED = 1,
21 QUOTA_EXCEEDED = 2, 21 QUOTA_EXCEEDED = 2,
22 }; 22 };
23 23
24 static const char* kTableName;
25 static const char* kTableContentFields[];
26 static const char* kTableFieldTypes[];
27
28 // Create a new database table for storing BlockedActions, or update the
29 // schema if it is out of date. Any existing data is preserved.
30 static bool InitializeTable(sql::Connection* db);
31
32 // You must supply the id, time, api_call, and reason. 24 // You must supply the id, time, api_call, and reason.
33 BlockedAction(const std::string& extension_id, 25 BlockedAction(const std::string& extension_id,
34 const base::Time& time, 26 const base::Time& time,
35 const std::string& api_call, // the blocked API call 27 const std::string& api_call, // the blocked API call
36 const std::string& args, // the arguments 28 const std::string& args, // the arguments
37 const Reason reason, // the reason it's blocked 29 const Reason reason, // the reason it's blocked
38 const std::string& extra); // any extra logging info 30 const std::string& extra); // any extra logging info
39 31
40 // Create a new BlockedAction from a database row.
41 explicit BlockedAction(const sql::Statement& s);
42
43 // Record the action in the database. 32 // Record the action in the database.
44 virtual bool Record(sql::Connection* db) OVERRIDE; 33 virtual bool Record(sql::Connection* db) OVERRIDE;
45 34
46 virtual scoped_ptr<api::activity_log_private::ExtensionActivity> 35 virtual scoped_ptr<api::activity_log_private::ExtensionActivity>
47 ConvertToExtensionActivity() OVERRIDE; 36 ConvertToExtensionActivity() OVERRIDE;
48 37
49 // Print a BlockedAction as a string for debugging purposes. 38 // Print a BlockedAction as a string for debugging purposes.
50 virtual std::string PrintForDebug() OVERRIDE; 39 virtual std::string PrintForDebug() OVERRIDE;
51 40
52 // Helper methods for recording the values into the db. 41 // Helper methods for recording the values into the db.
(...skipping 13 matching lines...) Expand all
66 Reason reason_; 55 Reason reason_;
67 std::string extra_; 56 std::string extra_;
68 57
69 DISALLOW_COPY_AND_ASSIGN(BlockedAction); 58 DISALLOW_COPY_AND_ASSIGN(BlockedAction);
70 }; 59 };
71 60
72 } // namespace extensions 61 } // namespace extensions
73 62
74 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_ 63 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_
75 64
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/api_actions.cc ('k') | chrome/browser/extensions/activity_log/blocked_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698