Add more checks to investigate SupervisedUserPrefStore crash at startup.
[chromium-blink-merge.git] / extensions / browser / api / networking_private / networking_private_api.h
blob25be18b886db104539893ff3a6d1c3220c1b43fc
1 // Copyright 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.
5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h"
13 #include "extensions/browser/extension_function.h"
15 namespace extensions {
17 namespace networking_private {
19 extern const char kErrorInvalidNetworkGuid[];
20 extern const char kErrorNetworkUnavailable[];
21 extern const char kErrorEncryptionError[];
22 extern const char kErrorNotReady[];
23 extern const char kErrorNotSupported[];
25 } // namespace networking_private
27 // Implements the chrome.networkingPrivate.getProperties method.
28 class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction {
29 public:
30 NetworkingPrivateGetPropertiesFunction() {}
31 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties",
32 NETWORKINGPRIVATE_GETPROPERTIES);
34 protected:
35 ~NetworkingPrivateGetPropertiesFunction() override;
37 // AsyncExtensionFunction overrides.
38 bool RunAsync() override;
40 private:
41 void Success(scoped_ptr<base::DictionaryValue> result);
42 void Failure(const std::string& error_name);
44 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction);
47 // Implements the chrome.networkingPrivate.getManagedProperties method.
48 class NetworkingPrivateGetManagedPropertiesFunction
49 : public AsyncExtensionFunction {
50 public:
51 NetworkingPrivateGetManagedPropertiesFunction() {}
52 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getManagedProperties",
53 NETWORKINGPRIVATE_GETMANAGEDPROPERTIES);
55 protected:
56 ~NetworkingPrivateGetManagedPropertiesFunction() override;
58 // AsyncExtensionFunction overrides.
59 bool RunAsync() override;
61 private:
62 void Success(scoped_ptr<base::DictionaryValue> result);
63 void Failure(const std::string& error);
65 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetManagedPropertiesFunction);
68 // Implements the chrome.networkingPrivate.getState method.
69 class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction {
70 public:
71 NetworkingPrivateGetStateFunction() {}
72 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getState",
73 NETWORKINGPRIVATE_GETSTATE);
75 protected:
76 ~NetworkingPrivateGetStateFunction() override;
78 // AsyncExtensionFunction overrides.
79 bool RunAsync() override;
81 private:
82 void Success(scoped_ptr<base::DictionaryValue> result);
83 void Failure(const std::string& error);
85 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetStateFunction);
88 // Implements the chrome.networkingPrivate.setProperties method.
89 class NetworkingPrivateSetPropertiesFunction : public AsyncExtensionFunction {
90 public:
91 NetworkingPrivateSetPropertiesFunction() {}
92 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setProperties",
93 NETWORKINGPRIVATE_SETPROPERTIES);
95 protected:
96 ~NetworkingPrivateSetPropertiesFunction() override;
98 // AsyncExtensionFunction overrides.
99 bool RunAsync() override;
101 private:
102 void Success();
103 void Failure(const std::string& error);
105 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetPropertiesFunction);
108 // Implements the chrome.networkingPrivate.createNetwork method.
109 class NetworkingPrivateCreateNetworkFunction : public AsyncExtensionFunction {
110 public:
111 NetworkingPrivateCreateNetworkFunction() {}
112 DECLARE_EXTENSION_FUNCTION("networkingPrivate.createNetwork",
113 NETWORKINGPRIVATE_CREATENETWORK);
115 protected:
116 ~NetworkingPrivateCreateNetworkFunction() override;
118 // AsyncExtensionFunction overrides.
119 bool RunAsync() override;
121 private:
122 void Success(const std::string& guid);
123 void Failure(const std::string& error);
125 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCreateNetworkFunction);
128 // Implements the chrome.networkingPrivate.getNetworks method.
129 class NetworkingPrivateGetNetworksFunction : public AsyncExtensionFunction {
130 public:
131 NetworkingPrivateGetNetworksFunction() {}
132 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks",
133 NETWORKINGPRIVATE_GETNETWORKS);
135 protected:
136 ~NetworkingPrivateGetNetworksFunction() override;
138 // AsyncExtensionFunction overrides.
139 bool RunAsync() override;
141 private:
142 void Success(scoped_ptr<base::ListValue> network_list);
143 void Failure(const std::string& error);
145 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction);
148 // Implements the chrome.networkingPrivate.getVisibleNetworks method.
149 class NetworkingPrivateGetVisibleNetworksFunction
150 : public AsyncExtensionFunction {
151 public:
152 NetworkingPrivateGetVisibleNetworksFunction() {}
153 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
154 NETWORKINGPRIVATE_GETVISIBLENETWORKS);
156 protected:
157 ~NetworkingPrivateGetVisibleNetworksFunction() override;
159 // AsyncExtensionFunction overrides.
160 bool RunAsync() override;
162 private:
163 void Success(scoped_ptr<base::ListValue> network_list);
164 void Failure(const std::string& error);
166 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction);
169 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
170 class NetworkingPrivateGetEnabledNetworkTypesFunction
171 : public SyncExtensionFunction {
172 public:
173 NetworkingPrivateGetEnabledNetworkTypesFunction() {}
174 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
175 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES);
177 protected:
178 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override;
180 // SyncExtensionFunction overrides.
181 bool RunSync() override;
183 private:
184 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction);
187 // Implements the chrome.networkingPrivate.enableNetworkType method.
188 class NetworkingPrivateEnableNetworkTypeFunction
189 : public SyncExtensionFunction {
190 public:
191 NetworkingPrivateEnableNetworkTypeFunction() {}
192 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
193 NETWORKINGPRIVATE_ENABLENETWORKTYPE);
195 protected:
196 ~NetworkingPrivateEnableNetworkTypeFunction() override;
198 // SyncExtensionFunction overrides.
199 bool RunSync() override;
201 private:
202 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction);
205 // Implements the chrome.networkingPrivate.disableNetworkType method.
206 class NetworkingPrivateDisableNetworkTypeFunction
207 : public SyncExtensionFunction {
208 public:
209 NetworkingPrivateDisableNetworkTypeFunction() {}
210 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
211 NETWORKINGPRIVATE_DISABLENETWORKTYPE);
213 protected:
214 ~NetworkingPrivateDisableNetworkTypeFunction() override;
216 // SyncExtensionFunction overrides.
217 bool RunSync() override;
219 private:
220 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction);
223 // Implements the chrome.networkingPrivate.requestNetworkScan method.
224 class NetworkingPrivateRequestNetworkScanFunction
225 : public SyncExtensionFunction {
226 public:
227 NetworkingPrivateRequestNetworkScanFunction() {}
228 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
229 NETWORKINGPRIVATE_REQUESTNETWORKSCAN);
231 protected:
232 ~NetworkingPrivateRequestNetworkScanFunction() override;
234 // SyncExtensionFunction overrides.
235 bool RunSync() override;
237 private:
238 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction);
241 // Implements the chrome.networkingPrivate.startConnect method.
242 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
243 public:
244 NetworkingPrivateStartConnectFunction() {}
245 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
246 NETWORKINGPRIVATE_STARTCONNECT);
248 protected:
249 ~NetworkingPrivateStartConnectFunction() override;
251 // AsyncExtensionFunction overrides.
252 bool RunAsync() override;
254 private:
255 void Success();
256 void Failure(const std::string& error);
258 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction);
261 // Implements the chrome.networkingPrivate.startDisconnect method.
262 class NetworkingPrivateStartDisconnectFunction : public AsyncExtensionFunction {
263 public:
264 NetworkingPrivateStartDisconnectFunction() {}
265 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
266 NETWORKINGPRIVATE_STARTDISCONNECT);
268 protected:
269 ~NetworkingPrivateStartDisconnectFunction() override;
271 // AsyncExtensionFunction overrides.
272 bool RunAsync() override;
274 private:
275 void Success();
276 void Failure(const std::string& error);
278 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction);
281 // Implements the chrome.networkingPrivate.verifyDestination method.
282 class NetworkingPrivateVerifyDestinationFunction
283 : public AsyncExtensionFunction {
284 public:
285 NetworkingPrivateVerifyDestinationFunction() {}
286 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
287 NETWORKINGPRIVATE_VERIFYDESTINATION);
289 protected:
290 ~NetworkingPrivateVerifyDestinationFunction() override;
292 // AsyncExtensionFunction overrides.
293 bool RunAsync() override;
295 void Success(bool result);
296 void Failure(const std::string& error);
298 private:
299 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction);
302 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
303 class NetworkingPrivateVerifyAndEncryptCredentialsFunction
304 : public AsyncExtensionFunction {
305 public:
306 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
307 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
308 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS);
310 protected:
311 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override;
313 // AsyncExtensionFunction overrides.
314 bool RunAsync() override;
316 void Success(const std::string& result);
317 void Failure(const std::string& error);
319 private:
320 DISALLOW_COPY_AND_ASSIGN(
321 NetworkingPrivateVerifyAndEncryptCredentialsFunction);
324 // Implements the chrome.networkingPrivate.verifyAndEncryptData method.
325 class NetworkingPrivateVerifyAndEncryptDataFunction
326 : public AsyncExtensionFunction {
327 public:
328 NetworkingPrivateVerifyAndEncryptDataFunction() {}
329 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
330 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA);
332 protected:
333 ~NetworkingPrivateVerifyAndEncryptDataFunction() override;
335 // AsyncExtensionFunction overrides.
336 bool RunAsync() override;
338 void Success(const std::string& result);
339 void Failure(const std::string& error);
341 private:
342 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction);
345 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method.
346 class NetworkingPrivateSetWifiTDLSEnabledStateFunction
347 : public AsyncExtensionFunction {
348 public:
349 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {}
350 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState",
351 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE);
353 protected:
354 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override;
356 // AsyncExtensionFunction overrides.
357 bool RunAsync() override;
359 void Success(const std::string& result);
360 void Failure(const std::string& error);
362 private:
363 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction);
366 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method.
367 class NetworkingPrivateGetWifiTDLSStatusFunction
368 : public AsyncExtensionFunction {
369 public:
370 NetworkingPrivateGetWifiTDLSStatusFunction() {}
371 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus",
372 NETWORKINGPRIVATE_GETWIFITDLSSTATUS);
374 protected:
375 ~NetworkingPrivateGetWifiTDLSStatusFunction() override;
377 // AsyncExtensionFunction overrides.
378 bool RunAsync() override;
380 void Success(const std::string& result);
381 void Failure(const std::string& error);
383 private:
384 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction);
387 class NetworkingPrivateGetCaptivePortalStatusFunction
388 : public AsyncExtensionFunction {
389 public:
390 NetworkingPrivateGetCaptivePortalStatusFunction() {}
391 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus",
392 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS);
394 // AsyncExtensionFunction overrides.
395 bool RunAsync() override;
397 protected:
398 ~NetworkingPrivateGetCaptivePortalStatusFunction() override;
400 private:
401 void Success(const std::string& result);
402 void Failure(const std::string& error);
404 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction);
407 } // namespace extensions
409 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_