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

Side by Side Diff: chrome/browser/extensions/activity_log/api_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_API_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_
7
8 #include "chrome/browser/extensions/activity_log/activity_actions.h"
9 #include "chrome/browser/profiles/profile.h"
10
11 namespace extensions {
12
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.
15 class APIAction : public Action {
16 public:
17 // These values should not be changed. Append any additional values to the
18 // end with sequential numbers.
19 enum Type {
20 CALL = 0,
21 EVENT_CALLBACK = 1,
22 UNKNOWN_TYPE = 2,
23 };
24
25 static const char* kAlwaysLog[];
26 static const int kSizeAlwaysLog;
27
28 static const char* kIncognitoUrl;
29
30 // Create a new APIAction to describe a successful API call. All
31 // parameters are required.
32 APIAction(const std::string& extension_id,
33 const base::Time& time,
34 const Type type, // e.g. "CALL"
35 const std::string& api_call, // full method name
36 const std::string& args, // the argument list
37 const base::ListValue& args_list, // same as above, as a list
38 const std::string& extra); // any extra logging info
39
40 // Record the action in the database.
41 virtual bool Record(sql::Connection* db) OVERRIDE;
42
43 virtual scoped_ptr<api::activity_log_private::ExtensionActivity>
44 ConvertToExtensionActivity() OVERRIDE;
45
46 // Used to associate tab IDs with URLs. It will swap out the int in args with
47 // a URL as a string. If the tab is in incognito mode, we leave it alone as
48 // the original int. There is a small chance that the URL translation could
49 // be wrong, if the tab has already been navigated by the time of invocation.
50 static void LookupTabId(const std::string& api_call,
51 base::ListValue* args,
52 Profile* profile);
53
54 // Print a APIAction as a regular string for debugging purposes.
55 virtual std::string PrintForDebug() OVERRIDE;
56
57 // Helper methods for recording the values into the db.
58 const std::string& api_call() const { return api_call_; }
59 const std::string& args() const { return args_; }
60 std::string TypeAsString() const;
61 std::string extra() const { return extra_; }
62
63 protected:
64 virtual ~APIAction();
65
66 private:
67 Type type_;
68 std::string api_call_;
69 std::string args_;
70 scoped_ptr<base::ListValue> args_list_;
71 std::string extra_;
72
73 DISALLOW_COPY_AND_ASSIGN(APIAction);
74 };
75
76 } // namespace extensions
77
78 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_API_ACTIONS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_log_unittest.cc ('k') | chrome/browser/extensions/activity_log/api_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698