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

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

Issue 19690003: Extension activity log database refactoring (step 3) (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor2
Patch Set: Do not set bad BlockedChromeActivityDetail::Reason values Created 7 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_
7
8 #include "chrome/browser/extensions/activity_log/activity_actions.h"
9
10 namespace extensions {
11
12 // This class describes API calls that ran into permissions or quota problems.
13 // See APIActions for API calls that succeeded.
14 class BlockedAction : public Action {
15 public:
16 // These values should not be changed. Append any additional values to the
17 // end with sequential numbers.
18 enum Reason {
19 UNKNOWN = 0,
20 ACCESS_DENIED = 1,
21 QUOTA_EXCEEDED = 2,
22 };
23
24 // You must supply the id, time, api_call, and reason.
25 BlockedAction(const std::string& extension_id,
26 const base::Time& time,
27 const std::string& api_call, // the blocked API call
28 const std::string& args, // the arguments
29 const Reason reason, // the reason it's blocked
30 const std::string& extra); // any extra logging info
31
32 // Record the action in the database.
33 virtual bool Record(sql::Connection* db) OVERRIDE;
34
35 virtual scoped_ptr<api::activity_log_private::ExtensionActivity>
36 ConvertToExtensionActivity() OVERRIDE;
37
38 // Print a BlockedAction as a string for debugging purposes.
39 virtual std::string PrintForDebug() OVERRIDE;
40
41 // Helper methods for recording the values into the db.
42 const std::string& api_call() const { return api_call_; }
43 const std::string& args() const { return args_; }
44 const std::string& extra() const { return extra_; }
45
46 // Helper method for debugging.
47 std::string ReasonAsString() const;
48
49 protected:
50 virtual ~BlockedAction();
51
52 private:
53 std::string api_call_;
54 std::string args_;
55 Reason reason_;
56 std::string extra_;
57
58 DISALLOW_COPY_AND_ASSIGN(BlockedAction);
59 };
60
61 } // namespace extensions
62
63 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_BLOCKED_ACTIONS_H_
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