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

Side by Side Diff: extensions/browser/api/networking_private/networking_private_api.cc

Issue 987963002: Add forgetNetwork to networkingPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add to chrome_extensions.js Created 5 years, 9 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
OLDNEW
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
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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 SendResponse(true); 647 SendResponse(true);
619 } 648 }
620 649
621 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( 650 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure(
622 const std::string& error) { 651 const std::string& error) {
623 error_ = error; 652 error_ = error;
624 SendResponse(false); 653 SendResponse(false);
625 } 654 }
626 655
627 } // namespace extensions 656 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698