Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / extensions / browser / api / networking_private / networking_private_api.h
blob07a13e7fb6bc6477952c51ebfce609e8dc00ee10
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.createNetwork method.
129 class NetworkingPrivateForgetNetworkFunction : public AsyncExtensionFunction {
130 public:
131 NetworkingPrivateForgetNetworkFunction() {}
132 DECLARE_EXTENSION_FUNCTION("networkingPrivate.forgetNetwork",
133 NETWORKINGPRIVATE_FORGETNETWORK);
135 protected:
136 ~NetworkingPrivateForgetNetworkFunction() override;
138 // AsyncExtensionFunction overrides.
139 bool RunAsync() override;
141 private:
142 void Success();
143 void Failure(const std::string& error);
145 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateForgetNetworkFunction);
148 // Implements the chrome.networkingPrivate.getNetworks method.
149 class NetworkingPrivateGetNetworksFunction : public AsyncExtensionFunction {
150 public:
151 NetworkingPrivateGetNetworksFunction() {}
152 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks",
153 NETWORKINGPRIVATE_GETNETWORKS);
155 protected:
156 ~NetworkingPrivateGetNetworksFunction() override;
158 // AsyncExtensionFunction overrides.
159 bool RunAsync() override;
161 private:
162 void Success(scoped_ptr<base::ListValue> network_list);
163 void Failure(const std::string& error);
165 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction);
168 // Implements the chrome.networkingPrivate.getVisibleNetworks method.
169 class NetworkingPrivateGetVisibleNetworksFunction
170 : public AsyncExtensionFunction {
171 public:
172 NetworkingPrivateGetVisibleNetworksFunction() {}
173 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
174 NETWORKINGPRIVATE_GETVISIBLENETWORKS);
176 protected:
177 ~NetworkingPrivateGetVisibleNetworksFunction() override;
179 // AsyncExtensionFunction overrides.
180 bool RunAsync() override;
182 private:
183 void Success(scoped_ptr<base::ListValue> network_list);
184 void Failure(const std::string& error);
186 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction);
189 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
190 class NetworkingPrivateGetEnabledNetworkTypesFunction
191 : public SyncExtensionFunction {
192 public:
193 NetworkingPrivateGetEnabledNetworkTypesFunction() {}
194 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
195 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES);
197 protected:
198 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override;
200 // SyncExtensionFunction overrides.
201 bool RunSync() override;
203 private:
204 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction);
207 // Implements the chrome.networkingPrivate.getDeviceStates method.
208 class NetworkingPrivateGetDeviceStatesFunction : public SyncExtensionFunction {
209 public:
210 NetworkingPrivateGetDeviceStatesFunction() {}
211 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getDeviceStates",
212 NETWORKINGPRIVATE_GETDEVICESTATES);
214 protected:
215 ~NetworkingPrivateGetDeviceStatesFunction() override;
217 // SyncExtensionFunction overrides.
218 bool RunSync() override;
220 private:
221 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetDeviceStatesFunction);
224 // Implements the chrome.networkingPrivate.enableNetworkType method.
225 class NetworkingPrivateEnableNetworkTypeFunction
226 : public SyncExtensionFunction {
227 public:
228 NetworkingPrivateEnableNetworkTypeFunction() {}
229 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
230 NETWORKINGPRIVATE_ENABLENETWORKTYPE);
232 protected:
233 ~NetworkingPrivateEnableNetworkTypeFunction() override;
235 // SyncExtensionFunction overrides.
236 bool RunSync() override;
238 private:
239 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction);
242 // Implements the chrome.networkingPrivate.disableNetworkType method.
243 class NetworkingPrivateDisableNetworkTypeFunction
244 : public SyncExtensionFunction {
245 public:
246 NetworkingPrivateDisableNetworkTypeFunction() {}
247 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
248 NETWORKINGPRIVATE_DISABLENETWORKTYPE);
250 protected:
251 ~NetworkingPrivateDisableNetworkTypeFunction() override;
253 // SyncExtensionFunction overrides.
254 bool RunSync() override;
256 private:
257 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction);
260 // Implements the chrome.networkingPrivate.requestNetworkScan method.
261 class NetworkingPrivateRequestNetworkScanFunction
262 : public SyncExtensionFunction {
263 public:
264 NetworkingPrivateRequestNetworkScanFunction() {}
265 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
266 NETWORKINGPRIVATE_REQUESTNETWORKSCAN);
268 protected:
269 ~NetworkingPrivateRequestNetworkScanFunction() override;
271 // SyncExtensionFunction overrides.
272 bool RunSync() override;
274 private:
275 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction);
278 // Implements the chrome.networkingPrivate.startConnect method.
279 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
280 public:
281 NetworkingPrivateStartConnectFunction() {}
282 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
283 NETWORKINGPRIVATE_STARTCONNECT);
285 protected:
286 ~NetworkingPrivateStartConnectFunction() override;
288 // AsyncExtensionFunction overrides.
289 bool RunAsync() override;
291 private:
292 void Success();
293 void Failure(const std::string& error);
295 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction);
298 // Implements the chrome.networkingPrivate.startDisconnect method.
299 class NetworkingPrivateStartDisconnectFunction : public AsyncExtensionFunction {
300 public:
301 NetworkingPrivateStartDisconnectFunction() {}
302 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
303 NETWORKINGPRIVATE_STARTDISCONNECT);
305 protected:
306 ~NetworkingPrivateStartDisconnectFunction() override;
308 // AsyncExtensionFunction overrides.
309 bool RunAsync() override;
311 private:
312 void Success();
313 void Failure(const std::string& error);
315 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction);
318 // Implements the chrome.networkingPrivate.startActivate method.
319 class NetworkingPrivateStartActivateFunction : public AsyncExtensionFunction {
320 public:
321 NetworkingPrivateStartActivateFunction() {}
322 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startActivate",
323 NETWORKINGPRIVATE_STARTACTIVATE);
325 protected:
326 ~NetworkingPrivateStartActivateFunction() override;
328 // AsyncExtensionFunction overrides.
329 bool RunAsync() override;
331 private:
332 void Success();
333 void Failure(const std::string& error);
335 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartActivateFunction);
338 // Implements the chrome.networkingPrivate.verifyDestination method.
339 class NetworkingPrivateVerifyDestinationFunction
340 : public AsyncExtensionFunction {
341 public:
342 NetworkingPrivateVerifyDestinationFunction() {}
343 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
344 NETWORKINGPRIVATE_VERIFYDESTINATION);
346 protected:
347 ~NetworkingPrivateVerifyDestinationFunction() override;
349 // AsyncExtensionFunction overrides.
350 bool RunAsync() override;
352 void Success(bool result);
353 void Failure(const std::string& error);
355 private:
356 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction);
359 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
360 class NetworkingPrivateVerifyAndEncryptCredentialsFunction
361 : public AsyncExtensionFunction {
362 public:
363 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
364 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
365 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS);
367 protected:
368 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override;
370 // AsyncExtensionFunction overrides.
371 bool RunAsync() override;
373 void Success(const std::string& result);
374 void Failure(const std::string& error);
376 private:
377 DISALLOW_COPY_AND_ASSIGN(
378 NetworkingPrivateVerifyAndEncryptCredentialsFunction);
381 // Implements the chrome.networkingPrivate.verifyAndEncryptData method.
382 class NetworkingPrivateVerifyAndEncryptDataFunction
383 : public AsyncExtensionFunction {
384 public:
385 NetworkingPrivateVerifyAndEncryptDataFunction() {}
386 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
387 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA);
389 protected:
390 ~NetworkingPrivateVerifyAndEncryptDataFunction() override;
392 // AsyncExtensionFunction overrides.
393 bool RunAsync() override;
395 void Success(const std::string& result);
396 void Failure(const std::string& error);
398 private:
399 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction);
402 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method.
403 class NetworkingPrivateSetWifiTDLSEnabledStateFunction
404 : public AsyncExtensionFunction {
405 public:
406 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {}
407 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState",
408 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE);
410 protected:
411 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override;
413 // AsyncExtensionFunction overrides.
414 bool RunAsync() override;
416 void Success(const std::string& result);
417 void Failure(const std::string& error);
419 private:
420 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction);
423 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method.
424 class NetworkingPrivateGetWifiTDLSStatusFunction
425 : public AsyncExtensionFunction {
426 public:
427 NetworkingPrivateGetWifiTDLSStatusFunction() {}
428 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus",
429 NETWORKINGPRIVATE_GETWIFITDLSSTATUS);
431 protected:
432 ~NetworkingPrivateGetWifiTDLSStatusFunction() override;
434 // AsyncExtensionFunction overrides.
435 bool RunAsync() override;
437 void Success(const std::string& result);
438 void Failure(const std::string& error);
440 private:
441 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction);
444 class NetworkingPrivateGetCaptivePortalStatusFunction
445 : public AsyncExtensionFunction {
446 public:
447 NetworkingPrivateGetCaptivePortalStatusFunction() {}
448 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus",
449 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS);
451 // AsyncExtensionFunction overrides.
452 bool RunAsync() override;
454 protected:
455 ~NetworkingPrivateGetCaptivePortalStatusFunction() override;
457 private:
458 void Success(const std::string& result);
459 void Failure(const std::string& error);
461 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction);
464 } // namespace extensions
466 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_