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

Side by Side Diff: chrome/browser/extensions/manager_actions.h

Issue 11421192: Save extension activity log to a file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Another small fix Created 8 years 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // User 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_MANAGER_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_MANAGER_ACTIONS_H_
7
8 #include <string>
9 #include "base/time.h"
10 #include "chrome/browser/extensions/activity_actions.h"
11
12 namespace extensions {
13
14 // This class describes API calls that did not run into permissions or quota
15 // problems. See BlockedActions for API calls that did not succeed.
16 class ManagerAction : public Action,
Matt Perry 2013/01/03 20:53:35 Why "ManagerAction"? Why not APIAction?
felt 2013/01/07 23:44:22 Done.
17 public base::RefCountedThreadSafe<ManagerAction> {
18 public:
19 // TODO(felt): I'll finalize this list when making the UI.
20 enum ManagerActionType {
21 READ,
22 MODIFIED,
23 DELETED,
24 ADDED,
25 ENABLED,
26 DISABLED,
27 CREATED,
28 UNKNOWN_ACTION
29 };
30
31 // TODO(felt): I'll finalize this list when making the UI.
32 enum ManagerTargetType {
33 BOOKMARK,
34 TABS,
35 HISTORY,
36 COOKIES,
37 BROWSER_ACTION,
38 NOTIFICATION,
39 OMNIBOX,
40 UNKNOWN_TARGET
41 };
42
43 static const char* kTableName;
44 static const char* kTableStructure;
45
46 // Create a new ManagerAction to describe a successful API call. All
47 // parameters are required.
48 ManagerAction(const std::string& extension_id,
49 const ManagerActionType verb,
50 const ManagerTargetType target,
51 const std::string& api_call,
52 const base::Time& time);
53
54 // Print a ManagerAction with il8n substitutions for display.
55 virtual std::string PrettyPrintFori18n() OVERRIDE;
56
57 // Print a ManagerAction as a regular string for debugging purposes.
58 virtual std::string PrettyPrintForDebug() OVERRIDE;
59
60 // Helper methods for recording the values into the db.
61 const std::string& extension_id() const { return extension_id_; }
62 const base::Time& time() const { return time_; }
63 const std::string& api_call() const { return api_call_; }
64 std::string VerbAsString() const;
65 std::string TargetAsString() const;
66
67 // Helper methods for creating a ManagerAction.
68 static ManagerActionType StringAsActionType(const std::string& str);
69 static ManagerTargetType StringAsTargetType(const std::string& str);
70
71 protected:
72 virtual ~ManagerAction();
73
74 private:
75 friend class base::RefCountedThreadSafe<ManagerAction>;
76
77 std::string extension_id_;
78 ManagerActionType verb_;
79 ManagerTargetType target_;
80 std::string api_call_;
81 base::Time time_;
82
83 DISALLOW_COPY_AND_ASSIGN(ManagerAction);
84 };
85
86 } // namespace
87
88 #endif // CHROME_BROWSER_EXTENSIONS_MANAGER_ACTIONS_H_
89
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698