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

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

Issue 1779633002: Invoke createNetwork() callback with GUID, not service name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass both service_path and guid arguments to all callbacks Created 4 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_chromeos. h" 5 #include "extensions/browser/api/networking_private/networking_private_chromeos. 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 "base/logging.h" 10 #include "base/logging.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 GetManagedConfigurationHandler()->SetProperties( 300 GetManagedConfigurationHandler()->SetProperties(
301 service_path, *properties, success_callback, 301 service_path, *properties, success_callback,
302 base::Bind(&NetworkHandlerFailureCallback, failure_callback)); 302 base::Bind(&NetworkHandlerFailureCallback, failure_callback));
303 } 303 }
304 304
305 void NetworkingPrivateChromeOS::CreateNetwork( 305 void NetworkingPrivateChromeOS::CreateNetwork(
306 bool shared, 306 bool shared,
307 scoped_ptr<base::DictionaryValue> properties, 307 scoped_ptr<base::DictionaryValue> properties,
308 const StringCallback& success_callback, 308 const ServiceCallback& success_callback,
309 const FailureCallback& failure_callback) { 309 const FailureCallback& failure_callback) {
310 std::string user_id_hash, error; 310 std::string user_id_hash, error;
311 // Do not allow configuring a non-shared network from a non-primary user. 311 // Do not allow configuring a non-shared network from a non-primary user.
312 if (!shared && 312 if (!shared &&
313 !GetPrimaryUserIdHash(browser_context_, &user_id_hash, &error)) { 313 !GetPrimaryUserIdHash(browser_context_, &user_id_hash, &error)) {
314 failure_callback.Run(error); 314 failure_callback.Run(error);
315 return; 315 return;
316 } 316 }
317 317
318 GetManagedConfigurationHandler()->CreateConfiguration( 318 GetManagedConfigurationHandler()->CreateConfiguration(
319 user_id_hash, *properties, success_callback, 319 user_id_hash, *properties, success_callback,
stevenjb 2016/03/10 01:49:10 By passing |success_callback| here directly, we ar
Kevin Cernekee 2016/03/11 01:53:57 Done.
320 base::Bind(&NetworkHandlerFailureCallback, failure_callback)); 320 base::Bind(&NetworkHandlerFailureCallback, failure_callback));
321 } 321 }
322 322
323 void NetworkingPrivateChromeOS::ForgetNetwork( 323 void NetworkingPrivateChromeOS::ForgetNetwork(
324 const std::string& guid, 324 const std::string& guid,
325 const VoidCallback& success_callback, 325 const VoidCallback& success_callback,
326 const FailureCallback& failure_callback) { 326 const FailureCallback& failure_callback) {
327 std::string service_path, error; 327 std::string service_path, error;
328 if (!GetServicePathFromGuid(guid, &service_path, &error)) { 328 if (!GetServicePathFromGuid(guid, &service_path, &error)) {
329 failure_callback.Run(error); 329 failure_callback.Run(error);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 // Eventually the caller (e.g. Settings) should handle any failures and 657 // Eventually the caller (e.g. Settings) should handle any failures and
658 // show its own configuration UI. crbug.com/380937. 658 // show its own configuration UI. crbug.com/380937.
659 if (ui_delegate()->HandleConnectFailed(guid, error_name)) { 659 if (ui_delegate()->HandleConnectFailed(guid, error_name)) {
660 success_callback.Run(); 660 success_callback.Run();
661 return; 661 return;
662 } 662 }
663 failure_callback.Run(error_name); 663 failure_callback.Run(error_name);
664 } 664 }
665 665
666 } // namespace extensions 666 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698