OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "extensions/browser/api/networking_private/networking_private_api.h" | 5 #include "extensions/browser/api/networking_private/networking_private_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "components/onc/onc_constants.h" | 10 #include "components/onc/onc_constants.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 results_ = private_api::CreateNetwork::Results::Create(guid); | 193 results_ = private_api::CreateNetwork::Results::Create(guid); |
194 SendResponse(true); | 194 SendResponse(true); |
195 } | 195 } |
196 | 196 |
197 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { | 197 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { |
198 error_ = error; | 198 error_ = error; |
199 SendResponse(false); | 199 SendResponse(false); |
200 } | 200 } |
201 | 201 |
202 //////////////////////////////////////////////////////////////////////////////// | 202 //////////////////////////////////////////////////////////////////////////////// |
| 203 // NetworkingPrivateForgetNetworkFunction |
| 204 |
| 205 NetworkingPrivateForgetNetworkFunction:: |
| 206 ~NetworkingPrivateForgetNetworkFunction() { |
| 207 } |
| 208 |
| 209 bool NetworkingPrivateForgetNetworkFunction::RunAsync() { |
| 210 scoped_ptr<private_api::ForgetNetwork::Params> params = |
| 211 private_api::ForgetNetwork::Params::Create(*args_); |
| 212 EXTENSION_FUNCTION_VALIDATE(params); |
| 213 |
| 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; |
| 220 } |
| 221 |
| 222 void NetworkingPrivateForgetNetworkFunction::Success() { |
| 223 SendResponse(true); |
| 224 } |
| 225 |
| 226 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) { |
| 227 error_ = error; |
| 228 SendResponse(false); |
| 229 } |
| 230 |
| 231 //////////////////////////////////////////////////////////////////////////////// |
203 // NetworkingPrivateGetNetworksFunction | 232 // NetworkingPrivateGetNetworksFunction |
204 | 233 |
205 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { | 234 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { |
206 } | 235 } |
207 | 236 |
208 bool NetworkingPrivateGetNetworksFunction::RunAsync() { | 237 bool NetworkingPrivateGetNetworksFunction::RunAsync() { |
209 scoped_ptr<private_api::GetNetworks::Params> params = | 238 scoped_ptr<private_api::GetNetworks::Params> params = |
210 private_api::GetNetworks::Params::Create(*args_); | 239 private_api::GetNetworks::Params::Create(*args_); |
211 EXTENSION_FUNCTION_VALIDATE(params); | 240 EXTENSION_FUNCTION_VALIDATE(params); |
212 | 241 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 SendResponse(true); | 676 SendResponse(true); |
648 } | 677 } |
649 | 678 |
650 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( | 679 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( |
651 const std::string& error) { | 680 const std::string& error) { |
652 error_ = error; | 681 error_ = error; |
653 SendResponse(false); | 682 SendResponse(false); |
654 } | 683 } |
655 | 684 |
656 } // namespace extensions | 685 } // namespace extensions |
OLD | NEW |