We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / extensions / browser / api / networking_private / networking_private_api.cc
blob92270e905f94cd65367e26bb4c6afa04c6f2a1e1
1 // Copyright 2014 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 #include "extensions/browser/api/networking_private/networking_private_api.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/callback.h"
10 #include "components/onc/onc_constants.h"
11 #include "extensions/browser/api/networking_private/networking_private_delegate.h"
12 #include "extensions/browser/api/networking_private/networking_private_delegate_factory.h"
13 #include "extensions/browser/extension_function_registry.h"
14 #include "extensions/common/api/networking_private.h"
16 namespace {
18 const int kDefaultNetworkListLimit = 1000;
20 extensions::NetworkingPrivateDelegate* GetDelegate(
21 content::BrowserContext* browser_context) {
22 return extensions::NetworkingPrivateDelegateFactory::GetForBrowserContext(
23 browser_context);
26 } // namespace
28 namespace extensions {
30 namespace private_api = core_api::networking_private;
32 namespace networking_private {
34 // static
35 const char kErrorInvalidNetworkGuid[] = "Error.InvalidNetworkGuid";
36 const char kErrorNetworkUnavailable[] = "Error.NetworkUnavailable";
37 const char kErrorEncryptionError[] = "Error.EncryptionError";
38 const char kErrorNotReady[] = "Error.NotReady";
39 const char kErrorNotSupported[] = "Error.NotSupported";
41 } // namespace networking_private
43 ////////////////////////////////////////////////////////////////////////////////
44 // NetworkingPrivateGetPropertiesFunction
46 NetworkingPrivateGetPropertiesFunction::
47 ~NetworkingPrivateGetPropertiesFunction() {
50 bool NetworkingPrivateGetPropertiesFunction::RunAsync() {
51 scoped_ptr<private_api::GetProperties::Params> params =
52 private_api::GetProperties::Params::Create(*args_);
53 EXTENSION_FUNCTION_VALIDATE(params);
55 GetDelegate(browser_context())
56 ->GetProperties(
57 params->network_guid,
58 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this),
59 base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this));
60 return true;
63 void NetworkingPrivateGetPropertiesFunction::Success(
64 scoped_ptr<base::DictionaryValue> result) {
65 SetResult(result.release());
66 SendResponse(true);
69 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) {
70 error_ = error;
71 SendResponse(false);
74 ////////////////////////////////////////////////////////////////////////////////
75 // NetworkingPrivateGetManagedPropertiesFunction
77 NetworkingPrivateGetManagedPropertiesFunction::
78 ~NetworkingPrivateGetManagedPropertiesFunction() {
81 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() {
82 scoped_ptr<private_api::GetManagedProperties::Params> params =
83 private_api::GetManagedProperties::Params::Create(*args_);
84 EXTENSION_FUNCTION_VALIDATE(params);
86 GetDelegate(browser_context())
87 ->GetManagedProperties(
88 params->network_guid,
89 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success,
90 this),
91 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure,
92 this));
93 return true;
96 void NetworkingPrivateGetManagedPropertiesFunction::Success(
97 scoped_ptr<base::DictionaryValue> result) {
98 SetResult(result.release());
99 SendResponse(true);
102 void NetworkingPrivateGetManagedPropertiesFunction::Failure(
103 const std::string& error) {
104 error_ = error;
105 SendResponse(false);
108 ////////////////////////////////////////////////////////////////////////////////
109 // NetworkingPrivateGetStateFunction
111 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() {
114 bool NetworkingPrivateGetStateFunction::RunAsync() {
115 scoped_ptr<private_api::GetState::Params> params =
116 private_api::GetState::Params::Create(*args_);
117 EXTENSION_FUNCTION_VALIDATE(params);
119 GetDelegate(browser_context())
120 ->GetState(params->network_guid,
121 base::Bind(&NetworkingPrivateGetStateFunction::Success, this),
122 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this));
123 return true;
126 void NetworkingPrivateGetStateFunction::Success(
127 scoped_ptr<base::DictionaryValue> result) {
128 SetResult(result.release());
129 SendResponse(true);
132 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) {
133 error_ = error;
134 SendResponse(false);
137 ////////////////////////////////////////////////////////////////////////////////
138 // NetworkingPrivateSetPropertiesFunction
140 NetworkingPrivateSetPropertiesFunction::
141 ~NetworkingPrivateSetPropertiesFunction() {
144 bool NetworkingPrivateSetPropertiesFunction::RunAsync() {
145 scoped_ptr<private_api::SetProperties::Params> params =
146 private_api::SetProperties::Params::Create(*args_);
147 EXTENSION_FUNCTION_VALIDATE(params);
149 scoped_ptr<base::DictionaryValue> properties_dict(
150 params->properties.ToValue());
152 GetDelegate(browser_context())
153 ->SetProperties(
154 params->network_guid, properties_dict.Pass(),
155 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this),
156 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this));
157 return true;
160 void NetworkingPrivateSetPropertiesFunction::Success() {
161 SendResponse(true);
164 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) {
165 error_ = error;
166 SendResponse(false);
169 ////////////////////////////////////////////////////////////////////////////////
170 // NetworkingPrivateCreateNetworkFunction
172 NetworkingPrivateCreateNetworkFunction::
173 ~NetworkingPrivateCreateNetworkFunction() {
176 bool NetworkingPrivateCreateNetworkFunction::RunAsync() {
177 scoped_ptr<private_api::CreateNetwork::Params> params =
178 private_api::CreateNetwork::Params::Create(*args_);
179 EXTENSION_FUNCTION_VALIDATE(params);
181 scoped_ptr<base::DictionaryValue> properties_dict(
182 params->properties.ToValue());
184 GetDelegate(browser_context())
185 ->CreateNetwork(
186 params->shared, properties_dict.Pass(),
187 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this),
188 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this));
189 return true;
192 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) {
193 results_ = private_api::CreateNetwork::Results::Create(guid);
194 SendResponse(true);
197 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) {
198 error_ = error;
199 SendResponse(false);
202 ////////////////////////////////////////////////////////////////////////////////
203 // NetworkingPrivateForgetNetworkFunction
205 NetworkingPrivateForgetNetworkFunction::
206 ~NetworkingPrivateForgetNetworkFunction() {
209 bool NetworkingPrivateForgetNetworkFunction::RunAsync() {
210 scoped_ptr<private_api::ForgetNetwork::Params> params =
211 private_api::ForgetNetwork::Params::Create(*args_);
212 EXTENSION_FUNCTION_VALIDATE(params);
214 GetDelegate(browser_context())
215 ->ForgetNetwork(
216 params->network_guid,
217 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this),
218 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this));
219 return true;
222 void NetworkingPrivateForgetNetworkFunction::Success() {
223 SendResponse(true);
226 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) {
227 error_ = error;
228 SendResponse(false);
231 ////////////////////////////////////////////////////////////////////////////////
232 // NetworkingPrivateGetNetworksFunction
234 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() {
237 bool NetworkingPrivateGetNetworksFunction::RunAsync() {
238 scoped_ptr<private_api::GetNetworks::Params> params =
239 private_api::GetNetworks::Params::Create(*args_);
240 EXTENSION_FUNCTION_VALIDATE(params);
242 std::string network_type = private_api::ToString(params->filter.network_type);
243 const bool configured_only =
244 params->filter.configured ? *params->filter.configured : false;
245 const bool visible_only =
246 params->filter.visible ? *params->filter.visible : false;
247 const int limit =
248 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit;
250 GetDelegate(browser_context())
251 ->GetNetworks(
252 network_type, configured_only, visible_only, limit,
253 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this),
254 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this));
255 return true;
258 void NetworkingPrivateGetNetworksFunction::Success(
259 scoped_ptr<base::ListValue> network_list) {
260 SetResult(network_list.release());
261 SendResponse(true);
264 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) {
265 error_ = error;
266 SendResponse(false);
269 ////////////////////////////////////////////////////////////////////////////////
270 // NetworkingPrivateGetVisibleNetworksFunction
272 NetworkingPrivateGetVisibleNetworksFunction::
273 ~NetworkingPrivateGetVisibleNetworksFunction() {
276 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() {
277 scoped_ptr<private_api::GetVisibleNetworks::Params> params =
278 private_api::GetVisibleNetworks::Params::Create(*args_);
279 EXTENSION_FUNCTION_VALIDATE(params);
281 std::string network_type = private_api::ToString(params->network_type);
282 const bool configured_only = false;
283 const bool visible_only = true;
285 GetDelegate(browser_context())
286 ->GetNetworks(
287 network_type, configured_only, visible_only, kDefaultNetworkListLimit,
288 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success,
289 this),
290 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure,
291 this));
292 return true;
295 void NetworkingPrivateGetVisibleNetworksFunction::Success(
296 scoped_ptr<base::ListValue> network_properties_list) {
297 SetResult(network_properties_list.release());
298 SendResponse(true);
301 void NetworkingPrivateGetVisibleNetworksFunction::Failure(
302 const std::string& error) {
303 error_ = error;
304 SendResponse(false);
307 ////////////////////////////////////////////////////////////////////////////////
308 // NetworkingPrivateGetEnabledNetworkTypesFunction
310 NetworkingPrivateGetEnabledNetworkTypesFunction::
311 ~NetworkingPrivateGetEnabledNetworkTypesFunction() {
314 bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() {
315 scoped_ptr<base::ListValue> enabled_networks_onc_types(
316 GetDelegate(browser_context())->GetEnabledNetworkTypes());
317 if (!enabled_networks_onc_types) {
318 error_ = networking_private::kErrorNotSupported;
319 return false;
321 scoped_ptr<base::ListValue> enabled_networks_list(new base::ListValue);
322 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin();
323 iter != enabled_networks_onc_types->end(); ++iter) {
324 std::string type;
325 if (!(*iter)->GetAsString(&type))
326 NOTREACHED();
327 if (type == ::onc::network_type::kEthernet) {
328 enabled_networks_list->AppendString(
329 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET));
330 } else if (type == ::onc::network_type::kWiFi) {
331 enabled_networks_list->AppendString(
332 private_api::ToString(private_api::NETWORK_TYPE_WIFI));
333 } else if (type == ::onc::network_type::kWimax) {
334 enabled_networks_list->AppendString(
335 private_api::ToString(private_api::NETWORK_TYPE_WIMAX));
336 } else if (type == ::onc::network_type::kCellular) {
337 enabled_networks_list->AppendString(
338 private_api::ToString(private_api::NETWORK_TYPE_CELLULAR));
339 } else {
340 LOG(ERROR) << "networkingPrivate: Unexpected type: " << type;
343 SetResult(enabled_networks_list.release());
344 return true;
347 ////////////////////////////////////////////////////////////////////////////////
348 // NetworkingPrivateEnableNetworkTypeFunction
350 NetworkingPrivateEnableNetworkTypeFunction::
351 ~NetworkingPrivateEnableNetworkTypeFunction() {
354 bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() {
355 scoped_ptr<private_api::EnableNetworkType::Params> params =
356 private_api::EnableNetworkType::Params::Create(*args_);
357 EXTENSION_FUNCTION_VALIDATE(params);
359 return GetDelegate(browser_context())
360 ->EnableNetworkType(private_api::ToString(params->network_type));
363 ////////////////////////////////////////////////////////////////////////////////
364 // NetworkingPrivateDisableNetworkTypeFunction
366 NetworkingPrivateDisableNetworkTypeFunction::
367 ~NetworkingPrivateDisableNetworkTypeFunction() {
370 bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() {
371 scoped_ptr<private_api::DisableNetworkType::Params> params =
372 private_api::DisableNetworkType::Params::Create(*args_);
374 return GetDelegate(browser_context())
375 ->DisableNetworkType(private_api::ToString(params->network_type));
378 ////////////////////////////////////////////////////////////////////////////////
379 // NetworkingPrivateRequestNetworkScanFunction
381 NetworkingPrivateRequestNetworkScanFunction::
382 ~NetworkingPrivateRequestNetworkScanFunction() {
385 bool NetworkingPrivateRequestNetworkScanFunction::RunSync() {
386 return GetDelegate(browser_context())->RequestScan();
389 ////////////////////////////////////////////////////////////////////////////////
390 // NetworkingPrivateStartConnectFunction
392 NetworkingPrivateStartConnectFunction::
393 ~NetworkingPrivateStartConnectFunction() {
396 bool NetworkingPrivateStartConnectFunction::RunAsync() {
397 scoped_ptr<private_api::StartConnect::Params> params =
398 private_api::StartConnect::Params::Create(*args_);
399 EXTENSION_FUNCTION_VALIDATE(params);
401 GetDelegate(browser_context())
402 ->StartConnect(
403 params->network_guid,
404 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this),
405 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this));
406 return true;
409 void NetworkingPrivateStartConnectFunction::Success() {
410 SendResponse(true);
413 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) {
414 error_ = error;
415 SendResponse(false);
418 ////////////////////////////////////////////////////////////////////////////////
419 // NetworkingPrivateStartDisconnectFunction
421 NetworkingPrivateStartDisconnectFunction::
422 ~NetworkingPrivateStartDisconnectFunction() {
425 bool NetworkingPrivateStartDisconnectFunction::RunAsync() {
426 scoped_ptr<private_api::StartDisconnect::Params> params =
427 private_api::StartDisconnect::Params::Create(*args_);
428 EXTENSION_FUNCTION_VALIDATE(params);
430 GetDelegate(browser_context())
431 ->StartDisconnect(
432 params->network_guid,
433 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this),
434 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this));
435 return true;
438 void NetworkingPrivateStartDisconnectFunction::Success() {
439 SendResponse(true);
442 void NetworkingPrivateStartDisconnectFunction::Failure(
443 const std::string& error) {
444 error_ = error;
445 SendResponse(false);
448 ////////////////////////////////////////////////////////////////////////////////
449 // NetworkingPrivateStartActivateFunction
451 NetworkingPrivateStartActivateFunction::
452 ~NetworkingPrivateStartActivateFunction() {
455 bool NetworkingPrivateStartActivateFunction::RunAsync() {
456 scoped_ptr<private_api::StartActivate::Params> params =
457 private_api::StartActivate::Params::Create(*args_);
458 EXTENSION_FUNCTION_VALIDATE(params);
460 GetDelegate(browser_context())
461 ->StartActivate(
462 params->network_guid, params->carrier ? *params->carrier : "",
463 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this),
464 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this));
465 return true;
468 void NetworkingPrivateStartActivateFunction::Success() {
469 SendResponse(true);
472 void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) {
473 error_ = error;
474 SendResponse(false);
477 ////////////////////////////////////////////////////////////////////////////////
478 // NetworkingPrivateVerifyDestinationFunction
480 NetworkingPrivateVerifyDestinationFunction::
481 ~NetworkingPrivateVerifyDestinationFunction() {
484 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() {
485 scoped_ptr<private_api::VerifyDestination::Params> params =
486 private_api::VerifyDestination::Params::Create(*args_);
487 EXTENSION_FUNCTION_VALIDATE(params);
489 GetDelegate(browser_context())
490 ->VerifyDestination(
491 params->properties,
492 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success,
493 this),
494 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure,
495 this));
496 return true;
499 void NetworkingPrivateVerifyDestinationFunction::Success(bool result) {
500 results_ = private_api::VerifyDestination::Results::Create(result);
501 SendResponse(true);
504 void NetworkingPrivateVerifyDestinationFunction::Failure(
505 const std::string& error) {
506 error_ = error;
507 SendResponse(false);
510 ////////////////////////////////////////////////////////////////////////////////
511 // NetworkingPrivateVerifyAndEncryptCredentialsFunction
513 NetworkingPrivateVerifyAndEncryptCredentialsFunction::
514 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() {
517 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() {
518 scoped_ptr<private_api::VerifyAndEncryptCredentials::Params> params =
519 private_api::VerifyAndEncryptCredentials::Params::Create(*args_);
520 EXTENSION_FUNCTION_VALIDATE(params);
522 GetDelegate(browser_context())
523 ->VerifyAndEncryptCredentials(
524 params->network_guid, params->properties,
525 base::Bind(
526 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success,
527 this),
528 base::Bind(
529 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure,
530 this));
531 return true;
534 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success(
535 const std::string& result) {
536 results_ = private_api::VerifyAndEncryptCredentials::Results::Create(result);
537 SendResponse(true);
540 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure(
541 const std::string& error) {
542 error_ = error;
543 SendResponse(false);
546 ////////////////////////////////////////////////////////////////////////////////
547 // NetworkingPrivateVerifyAndEncryptDataFunction
549 NetworkingPrivateVerifyAndEncryptDataFunction::
550 ~NetworkingPrivateVerifyAndEncryptDataFunction() {
553 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() {
554 scoped_ptr<private_api::VerifyAndEncryptData::Params> params =
555 private_api::VerifyAndEncryptData::Params::Create(*args_);
556 EXTENSION_FUNCTION_VALIDATE(params);
558 GetDelegate(browser_context())
559 ->VerifyAndEncryptData(
560 params->properties, params->data,
561 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success,
562 this),
563 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure,
564 this));
565 return true;
568 void NetworkingPrivateVerifyAndEncryptDataFunction::Success(
569 const std::string& result) {
570 results_ = private_api::VerifyAndEncryptData::Results::Create(result);
571 SendResponse(true);
574 void NetworkingPrivateVerifyAndEncryptDataFunction::Failure(
575 const std::string& error) {
576 error_ = error;
577 SendResponse(false);
580 ////////////////////////////////////////////////////////////////////////////////
581 // NetworkingPrivateSetWifiTDLSEnabledStateFunction
583 NetworkingPrivateSetWifiTDLSEnabledStateFunction::
584 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() {
587 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() {
588 scoped_ptr<private_api::SetWifiTDLSEnabledState::Params> params =
589 private_api::SetWifiTDLSEnabledState::Params::Create(*args_);
590 EXTENSION_FUNCTION_VALIDATE(params);
592 GetDelegate(browser_context())
593 ->SetWifiTDLSEnabledState(
594 params->ip_or_mac_address, params->enabled,
595 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success,
596 this),
597 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure,
598 this));
600 return true;
603 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success(
604 const std::string& result) {
605 results_ = private_api::SetWifiTDLSEnabledState::Results::Create(result);
606 SendResponse(true);
609 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure(
610 const std::string& error) {
611 error_ = error;
612 SendResponse(false);
615 ////////////////////////////////////////////////////////////////////////////////
616 // NetworkingPrivateGetWifiTDLSStatusFunction
618 NetworkingPrivateGetWifiTDLSStatusFunction::
619 ~NetworkingPrivateGetWifiTDLSStatusFunction() {
622 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() {
623 scoped_ptr<private_api::GetWifiTDLSStatus::Params> params =
624 private_api::GetWifiTDLSStatus::Params::Create(*args_);
625 EXTENSION_FUNCTION_VALIDATE(params);
627 GetDelegate(browser_context())
628 ->GetWifiTDLSStatus(
629 params->ip_or_mac_address,
630 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success,
631 this),
632 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure,
633 this));
635 return true;
638 void NetworkingPrivateGetWifiTDLSStatusFunction::Success(
639 const std::string& result) {
640 results_ = private_api::GetWifiTDLSStatus::Results::Create(result);
641 SendResponse(true);
644 void NetworkingPrivateGetWifiTDLSStatusFunction::Failure(
645 const std::string& error) {
646 error_ = error;
647 SendResponse(false);
650 ////////////////////////////////////////////////////////////////////////////////
651 // NetworkingPrivateGetCaptivePortalStatusFunction
653 NetworkingPrivateGetCaptivePortalStatusFunction::
654 ~NetworkingPrivateGetCaptivePortalStatusFunction() {
657 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() {
658 scoped_ptr<private_api::GetCaptivePortalStatus::Params> params =
659 private_api::GetCaptivePortalStatus::Params::Create(*args_);
660 EXTENSION_FUNCTION_VALIDATE(params);
662 GetDelegate(browser_context())
663 ->GetCaptivePortalStatus(
664 params->network_guid,
665 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success,
666 this),
667 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure,
668 this));
669 return true;
672 void NetworkingPrivateGetCaptivePortalStatusFunction::Success(
673 const std::string& result) {
674 results_ = private_api::GetCaptivePortalStatus::Results::Create(
675 private_api::ParseCaptivePortalStatus(result));
676 SendResponse(true);
679 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure(
680 const std::string& error) {
681 error_ = error;
682 SendResponse(false);
685 } // namespace extensions