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

Side by Side Diff: chrome/browser/extensions/api/autotest_private/autotest_private_api.h

Issue 2328643003: [Extensions] Convert some ChromeSyncExtensionFunctions (Closed)
Patch Set: Remove GetProfile() usage Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/autotest_private/autotest_private_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/chrome_extension_function.h" 11 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "extensions/browser/browser_context_keyed_api_factory.h" 12 #include "extensions/browser/browser_context_keyed_api_factory.h"
13 #include "ui/message_center/notification_types.h" 13 #include "ui/message_center/notification_types.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction { 17 class AutotestPrivateLogoutFunction : public UIThreadExtensionFunction {
18 public: 18 public:
19 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT) 19 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT)
20 20
21 private: 21 private:
22 ~AutotestPrivateLogoutFunction() override {} 22 ~AutotestPrivateLogoutFunction() override {}
23 bool RunSync() override; 23 ResponseAction Run() override;
24 }; 24 };
25 25
26 class AutotestPrivateRestartFunction : public ChromeSyncExtensionFunction { 26 class AutotestPrivateRestartFunction : public UIThreadExtensionFunction {
27 public: 27 public:
28 DECLARE_EXTENSION_FUNCTION("autotestPrivate.restart", AUTOTESTPRIVATE_RESTART) 28 DECLARE_EXTENSION_FUNCTION("autotestPrivate.restart", AUTOTESTPRIVATE_RESTART)
29 29
30 private: 30 private:
31 ~AutotestPrivateRestartFunction() override {} 31 ~AutotestPrivateRestartFunction() override {}
32 bool RunSync() override; 32 ResponseAction Run() override;
33 }; 33 };
34 34
35 class AutotestPrivateShutdownFunction : public ChromeSyncExtensionFunction { 35 class AutotestPrivateShutdownFunction : public UIThreadExtensionFunction {
36 public: 36 public:
37 DECLARE_EXTENSION_FUNCTION("autotestPrivate.shutdown", 37 DECLARE_EXTENSION_FUNCTION("autotestPrivate.shutdown",
38 AUTOTESTPRIVATE_SHUTDOWN) 38 AUTOTESTPRIVATE_SHUTDOWN)
39 39
40 private: 40 private:
41 ~AutotestPrivateShutdownFunction() override {} 41 ~AutotestPrivateShutdownFunction() override {}
42 bool RunSync() override; 42 ResponseAction Run() override;
43 }; 43 };
44 44
45 class AutotestPrivateLoginStatusFunction : public ChromeSyncExtensionFunction { 45 class AutotestPrivateLoginStatusFunction : public UIThreadExtensionFunction {
46 public: 46 public:
47 DECLARE_EXTENSION_FUNCTION("autotestPrivate.loginStatus", 47 DECLARE_EXTENSION_FUNCTION("autotestPrivate.loginStatus",
48 AUTOTESTPRIVATE_LOGINSTATUS) 48 AUTOTESTPRIVATE_LOGINSTATUS)
49 49
50 private: 50 private:
51 ~AutotestPrivateLoginStatusFunction() override {} 51 ~AutotestPrivateLoginStatusFunction() override {}
52 bool RunSync() override; 52 ResponseAction Run() override;
53 }; 53 };
54 54
55 class AutotestPrivateLockScreenFunction : public ChromeSyncExtensionFunction { 55 class AutotestPrivateLockScreenFunction : public UIThreadExtensionFunction {
56 public: 56 public:
57 DECLARE_EXTENSION_FUNCTION("autotestPrivate.lockScreen", 57 DECLARE_EXTENSION_FUNCTION("autotestPrivate.lockScreen",
58 AUTOTESTPRIVATE_LOCKSCREEN) 58 AUTOTESTPRIVATE_LOCKSCREEN)
59 59
60 private: 60 private:
61 ~AutotestPrivateLockScreenFunction() override {} 61 ~AutotestPrivateLockScreenFunction() override {}
62 bool RunSync() override; 62 ResponseAction Run() override;
63 }; 63 };
64 64
65 class AutotestPrivateGetExtensionsInfoFunction 65 class AutotestPrivateGetExtensionsInfoFunction
66 : public ChromeSyncExtensionFunction { 66 : public UIThreadExtensionFunction {
67 public: 67 public:
68 DECLARE_EXTENSION_FUNCTION("autotestPrivate.getExtensionsInfo", 68 DECLARE_EXTENSION_FUNCTION("autotestPrivate.getExtensionsInfo",
69 AUTOTESTPRIVATE_GETEXTENSIONSINFO) 69 AUTOTESTPRIVATE_GETEXTENSIONSINFO)
70 70
71 private: 71 private:
72 ~AutotestPrivateGetExtensionsInfoFunction() override {} 72 ~AutotestPrivateGetExtensionsInfoFunction() override {}
73 bool RunSync() override; 73 ResponseAction Run() override;
74 }; 74 };
75 75
76 class AutotestPrivateSimulateAsanMemoryBugFunction 76 class AutotestPrivateSimulateAsanMemoryBugFunction
77 : public ChromeSyncExtensionFunction { 77 : public UIThreadExtensionFunction {
78 public: 78 public:
79 DECLARE_EXTENSION_FUNCTION("autotestPrivate.simulateAsanMemoryBug", 79 DECLARE_EXTENSION_FUNCTION("autotestPrivate.simulateAsanMemoryBug",
80 AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG) 80 AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG)
81 81
82 private: 82 private:
83 ~AutotestPrivateSimulateAsanMemoryBugFunction() override {} 83 ~AutotestPrivateSimulateAsanMemoryBugFunction() override {}
84 bool RunSync() override; 84 ResponseAction Run() override;
85 }; 85 };
86 86
87 class AutotestPrivateSetTouchpadSensitivityFunction 87 class AutotestPrivateSetTouchpadSensitivityFunction
88 : public ChromeSyncExtensionFunction { 88 : public UIThreadExtensionFunction {
89 public: 89 public:
90 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTouchpadSensitivity", 90 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTouchpadSensitivity",
91 AUTOTESTPRIVATE_SETTOUCHPADSENSITIVITY) 91 AUTOTESTPRIVATE_SETTOUCHPADSENSITIVITY)
92 92
93 private: 93 private:
94 ~AutotestPrivateSetTouchpadSensitivityFunction() override {} 94 ~AutotestPrivateSetTouchpadSensitivityFunction() override {}
95 bool RunSync() override; 95 ResponseAction Run() override;
96 }; 96 };
97 97
98 class AutotestPrivateSetTapToClickFunction 98 class AutotestPrivateSetTapToClickFunction : public UIThreadExtensionFunction {
99 : public ChromeSyncExtensionFunction {
100 public: 99 public:
101 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapToClick", 100 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapToClick",
102 AUTOTESTPRIVATE_SETTAPTOCLICK) 101 AUTOTESTPRIVATE_SETTAPTOCLICK)
103 102
104 private: 103 private:
105 ~AutotestPrivateSetTapToClickFunction() override {} 104 ~AutotestPrivateSetTapToClickFunction() override {}
106 bool RunSync() override; 105 ResponseAction Run() override;
107 }; 106 };
108 107
109 class AutotestPrivateSetThreeFingerClickFunction 108 class AutotestPrivateSetThreeFingerClickFunction
110 : public ChromeSyncExtensionFunction { 109 : public UIThreadExtensionFunction {
111 public: 110 public:
112 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setThreeFingerClick", 111 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setThreeFingerClick",
113 AUTOTESTPRIVATE_SETTHREEFINGERCLICK) 112 AUTOTESTPRIVATE_SETTHREEFINGERCLICK)
114 113
115 private: 114 private:
116 ~AutotestPrivateSetThreeFingerClickFunction() override {} 115 ~AutotestPrivateSetThreeFingerClickFunction() override {}
117 bool RunSync() override; 116 ResponseAction Run() override;
118 }; 117 };
119 118
120 class AutotestPrivateSetTapDraggingFunction 119 class AutotestPrivateSetTapDraggingFunction : public UIThreadExtensionFunction {
121 : public ChromeSyncExtensionFunction {
122 public: 120 public:
123 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapDragging", 121 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapDragging",
124 AUTOTESTPRIVATE_SETTAPDRAGGING) 122 AUTOTESTPRIVATE_SETTAPDRAGGING)
125 123
126 private: 124 private:
127 ~AutotestPrivateSetTapDraggingFunction() override {} 125 ~AutotestPrivateSetTapDraggingFunction() override {}
128 bool RunSync() override; 126 ResponseAction Run() override;
129 }; 127 };
130 128
131 class AutotestPrivateSetNaturalScrollFunction 129 class AutotestPrivateSetNaturalScrollFunction
132 : public ChromeSyncExtensionFunction { 130 : public UIThreadExtensionFunction {
133 public: 131 public:
134 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setNaturalScroll", 132 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setNaturalScroll",
135 AUTOTESTPRIVATE_SETNATURALSCROLL) 133 AUTOTESTPRIVATE_SETNATURALSCROLL)
136 134
137 private: 135 private:
138 ~AutotestPrivateSetNaturalScrollFunction() override {} 136 ~AutotestPrivateSetNaturalScrollFunction() override {}
139 bool RunSync() override; 137 ResponseAction Run() override;
140 }; 138 };
141 139
142 class AutotestPrivateSetMouseSensitivityFunction 140 class AutotestPrivateSetMouseSensitivityFunction
143 : public ChromeSyncExtensionFunction { 141 : public UIThreadExtensionFunction {
144 public: 142 public:
145 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setMouseSensitivity", 143 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setMouseSensitivity",
146 AUTOTESTPRIVATE_SETMOUSESENSITIVITY) 144 AUTOTESTPRIVATE_SETMOUSESENSITIVITY)
147 145
148 private: 146 private:
149 ~AutotestPrivateSetMouseSensitivityFunction() override {} 147 ~AutotestPrivateSetMouseSensitivityFunction() override {}
150 bool RunSync() override; 148 ResponseAction Run() override;
151 }; 149 };
152 150
153 class AutotestPrivateSetPrimaryButtonRightFunction 151 class AutotestPrivateSetPrimaryButtonRightFunction
154 : public ChromeSyncExtensionFunction { 152 : public UIThreadExtensionFunction {
155 public: 153 public:
156 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setPrimaryButtonRight", 154 DECLARE_EXTENSION_FUNCTION("autotestPrivate.setPrimaryButtonRight",
157 AUTOTESTPRIVATE_SETPRIMARYBUTTONRIGHT) 155 AUTOTESTPRIVATE_SETPRIMARYBUTTONRIGHT)
158 156
159 private: 157 private:
160 ~AutotestPrivateSetPrimaryButtonRightFunction() override {} 158 ~AutotestPrivateSetPrimaryButtonRightFunction() override {}
161 bool RunSync() override; 159 ResponseAction Run() override;
162 }; 160 };
163 161
164 class AutotestPrivateGetVisibleNotificationsFunction 162 class AutotestPrivateGetVisibleNotificationsFunction
165 : public ChromeSyncExtensionFunction { 163 : public UIThreadExtensionFunction {
166 public: 164 public:
167 DECLARE_EXTENSION_FUNCTION("autotestPrivate.getVisibleNotifications", 165 DECLARE_EXTENSION_FUNCTION("autotestPrivate.getVisibleNotifications",
168 AUTOTESTPRIVATE_GETVISIBLENOTIFICATIONS) 166 AUTOTESTPRIVATE_GETVISIBLENOTIFICATIONS)
169 167
170 private: 168 private:
171 static std::string ConvertToString(message_center::NotificationType type); 169 static std::string ConvertToString(message_center::NotificationType type);
172 170
173 ~AutotestPrivateGetVisibleNotificationsFunction() override {} 171 ~AutotestPrivateGetVisibleNotificationsFunction() override {}
174 bool RunSync() override; 172 ResponseAction Run() override;
175 }; 173 };
176 174
177 // Don't kill the browser when we're in a browser test. 175 // Don't kill the browser when we're in a browser test.
178 void SetAutotestPrivateTest(); 176 void SetAutotestPrivateTest();
179 177
180 // The profile-keyed service that manages the autotestPrivate extension API. 178 // The profile-keyed service that manages the autotestPrivate extension API.
181 class AutotestPrivateAPI : public BrowserContextKeyedAPI { 179 class AutotestPrivateAPI : public BrowserContextKeyedAPI {
182 public: 180 public:
183 static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>* 181 static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>*
184 GetFactoryInstance(); 182 GetFactoryInstance();
(...skipping 17 matching lines...) Expand all
202 }; 200 };
203 201
204 template <> 202 template <>
205 KeyedService* 203 KeyedService*
206 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( 204 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor(
207 content::BrowserContext* context) const; 205 content::BrowserContext* context) const;
208 206
209 } // namespace extensions 207 } // namespace extensions
210 208
211 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H _ 209 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/autotest_private/autotest_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698