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

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: 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 activity {
13
14 static const std::string manager_table_name_ = "activitylog-managers";
15 static const std::string manager_table_creator_ = "CREATE TABLE " +
16 manager_table_name_ + "("
17 "id INTEGER PRIMARY KEY,"
18 "extension_id LONGVARCHAR NOT NULL,"
19 "time INTEGER NOT NULL,"
20 "manager_action_type LONGVARCHAR NOT NULL,"
21 "target_type LONGVARCHAR NOT NULL"
mvrable 2012/12/04 01:00:13 Include spaces at before the closing quote so that
felt 2012/12/07 19:27:45 Done.
22 "api_call LONGVARCHAR NOT NULL)";
23
24 // This class describes extension actions that pertain to Content Script
25 // insertion, Content Script DOM manipulations, and extension XHRs.
26 class ManagerAction {
27 public:
28 enum ManagerActionType {
29 READ,
30 MODIFIED,
31 DELETED,
32 ADDED,
33 ENABLED,
34 DISABLED,
35 CREATED,
36 UNKNOWN_ACTION
37 };
38
39 enum ManagerTargetType {
40 BOOKMARK,
41 TABS,
42 HISTORY,
43 COOKIES,
44 BROWSER_ACTION,
45 NOTIFICATION,
46 OMNIBOX,
47 UNKNOWN_TARGET
48 };
49
50 // Create a new ManagerAction to describe a ContentScript action
51 // or XHR. All of the parameters should have values except for
52 // url_title, which can be an empty string if the ActionType is XHR.
53 ManagerAction(const std::string& extension_id,
54 const ManagerActionType& verb,
mvrable 2012/12/04 01:00:13 An enum is like an integer so you should pass by v
felt 2012/12/07 19:27:45 Done.
55 const ManagerTargetType& target,
56 const std::string& api_call,
57 const base::Time& time);
58 virtual ~ManagerAction();
59
60 // Print a ManagerAction with il8n substitutions for display.
61 std::string PrettyPrintForil8n();
mvrable 2012/12/04 01:00:13 This (and the following PrettyPrint method) can pr
felt 2012/12/07 19:27:45 Done.
62
63 // Print a ManagerAction as a regular string for debugging purposes.
64 std::string PrettyPrintForDebug();
65
66 // Helper methods for recording the values into the db.
67 const std::string& extension_id() const { return extension_id_; }
68 base::Time time() const { return time_; }
69 const std::string& api_call() { return api_call_; }
70 std::string VerbAsString();
71 std::string TargetAsString();
72
73 // Helper methods for restoring a ManagerAction from the db.
74 static ManagerActionType StringAsManagerActionType(const std::string& str);
75 static ManagerTargetType StringAsManagerTargetType(const std::string& str);
76
77 private:
78 std::string extension_id_;
79 ManagerActionType verb_;
80 ManagerTargetType target_;
81 std::string api_call_;
82 base::Time time_;
83 };
84 }
85
86 #endif // CHROME_BROWSER_EXTENSIONS_MANAGER_ACTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698