OLD | NEW |
---|---|
(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 #include <string> | |
6 #include "chrome/browser/extensions/manager_actions.h" | |
7 | |
8 namespace activity { | |
9 | |
10 ManagerAction::ManagerAction(const std::string& extension_id, | |
11 const ManagerActionType& verb, | |
12 const ManagerTargetType& target, | |
13 const std::string& api_call, | |
14 const base::Time& time) | |
15 : extension_id_(extension_id), | |
mvrable
2012/12/04 01:00:13
There should be four spaces of indentation before
felt
2012/12/07 19:27:45
Done.
| |
16 verb_(verb), | |
17 target_(target), | |
18 api_call_(api_call), | |
19 time_(time) { } | |
20 | |
21 std::string ManagerAction::PrettyPrintForil8n() { | |
22 // TODO(felt): implement this. | |
23 return "hi"; | |
24 } | |
25 | |
26 std::string ManagerAction::PrettyPrintForDebug() { | |
27 // TODO(felt): implement this. | |
28 return "hi"; | |
29 } | |
30 | |
31 std::string ManagerAction::VerbAsString() { | |
32 switch (verb_) { | |
mvrable
2012/12/04 01:00:13
The identation for the switch statement is correct
felt
2012/12/07 19:27:45
Done.
| |
33 case READ: | |
34 return "READ"; | |
35 case MODIFIED: | |
36 return "MODIFIED"; | |
37 case DELETED: | |
38 return "DELETED"; | |
39 case ADDED: | |
40 return "ADDED"; | |
41 case ENABLED: | |
42 return "ENABLED"; | |
43 case DISABLED: | |
44 return "DISABLED"; | |
45 case CREATED: | |
46 return "CREATED"; | |
47 default: | |
48 return "UNKNOWN_ACTION"; | |
49 } | |
50 } | |
51 | |
52 std::string ManagerAction::TargetAsString() { | |
53 switch (target_) { | |
54 case BOOKMARK: | |
55 return "BOOKMARK"; | |
56 case TABS: | |
57 return "TABS"; | |
58 case HISTORY: | |
59 return "HISTORY"; | |
60 case COOKIES: | |
61 return "COOKIES"; | |
62 case BROWSER_ACTION: | |
63 return "BROWSER_ACTION"; | |
64 case NOTIFICATION: | |
65 return "NOTIFICATION"; | |
66 case OMNIBOX: | |
67 return "OMNIBOX"; | |
68 default: | |
69 return "UNKNOWN_TARGET"; | |
70 } | |
71 } | |
72 | |
73 ManagerAction::ManagerActionType ManagerAction::StringAsManagerActionType( | |
74 const std::string& str) { | |
75 if (str == "READ") { | |
76 return READ; | |
77 } else if (str == "MODIFIED") { | |
78 return MODIFIED; | |
79 } else if (str == "DELETED") { | |
80 return DELETED; | |
81 } else if (str == "ADDED") { | |
82 return ADDED; | |
83 } else if (str == "ENABLED") { | |
84 return ENABLED; | |
85 } else if (str == "DISABLED") { | |
86 return DISABLED; | |
87 } else if (str == "CREATED") { | |
88 return CREATED; | |
89 } else { | |
90 return UNKNOWN_ACTION; | |
91 } | |
92 } | |
93 | |
94 ManagerAction::ManagerTargetType ManagerAction::StringAsManagerTargetType( | |
95 const std::string& str) { | |
96 if (str == "BOOKMARK") { | |
97 return BOOKMARK; | |
98 } else if (str == "TABS") { | |
99 return TABS; | |
100 } else if (str == "HISTORY") { | |
101 return HISTORY; | |
102 } else if (str == "COOKIES") { | |
103 return COOKIES; | |
104 } else if (str == "BROWSER_ACTION") { | |
105 return BROWSER_ACTION; | |
106 } else if (str == "NOTIFICATION") { | |
107 return NOTIFICATION; | |
108 } else if (str == "OMNIBOX") { | |
109 return OMNIBOX; | |
110 } else { | |
111 return UNKNOWN_TARGET; | |
112 } | |
113 } | |
114 } // namespace | |
OLD | NEW |