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

Side by Side Diff: chromeos/network/network_configuration_handler.cc

Issue 22689003: Use Shill's Manager::ConfigureServiceForProfile for all network types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/network/network_configuration_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/network/network_configuration_handler.h" 5 #include "chromeos/network/network_configuration_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 const network_handler::StringResultCallback& callback, 272 const network_handler::StringResultCallback& callback,
273 const network_handler::ErrorCallback& error_callback) { 273 const network_handler::ErrorCallback& error_callback) {
274 ShillManagerClient* manager = 274 ShillManagerClient* manager =
275 DBusThreadManager::Get()->GetShillManagerClient(); 275 DBusThreadManager::Get()->GetShillManagerClient();
276 std::string type; 276 std::string type;
277 properties.GetStringWithoutPathExpansion(flimflam::kTypeProperty, &type); 277 properties.GetStringWithoutPathExpansion(flimflam::kTypeProperty, &type);
278 278
279 NET_LOG_USER("CreateConfiguration", type); 279 NET_LOG_USER("CreateConfiguration", type);
280 LogConfigProperties("Configure", type, properties); 280 LogConfigProperties("Configure", type, properties);
281 281
282 // Shill supports ConfigureServiceForProfile only for network type WiFi. In 282 std::string profile;
283 // all other cases, we have to rely on GetService for now. This is 283 properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty,
284 // unproblematic for VPN (user profile only), but will lead to inconsistencies 284 &profile);
285 // with WiMax, for example. 285 DCHECK(!profile.empty());
286 if (type == flimflam::kTypeWifi) { 286 manager->ConfigureServiceForProfile(
287 std::string profile; 287 dbus::ObjectPath(profile),
288 properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty, 288 properties,
289 &profile); 289 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
290 manager->ConfigureServiceForProfile( 290 AsWeakPtr(),
291 dbus::ObjectPath(profile), 291 callback),
292 properties, 292 base::Bind(&network_handler::ShillErrorCallbackFunction,
293 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback, 293 "Config.CreateConfiguration Failed",
294 AsWeakPtr(), callback), 294 "",
295 base::Bind(&network_handler::ShillErrorCallbackFunction, 295 error_callback));
296 "Config.CreateConfiguration Failed", "", error_callback));
297 } else {
298 manager->ConfigureService(
299 properties,
300 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
301 AsWeakPtr(), callback),
302 base::Bind(&network_handler::ShillErrorCallbackFunction,
303 "Config.CreateConfiguration Failed", "", error_callback));
304 }
305 } 296 }
306 297
307 void NetworkConfigurationHandler::RemoveConfiguration( 298 void NetworkConfigurationHandler::RemoveConfiguration(
308 const std::string& service_path, 299 const std::string& service_path,
309 const base::Closure& callback, 300 const base::Closure& callback,
310 const network_handler::ErrorCallback& error_callback) { 301 const network_handler::ErrorCallback& error_callback) {
311 // Service.Remove is not reliable. Instead, request the profile entries 302 // Service.Remove is not reliable. Instead, request the profile entries
312 // for the service and remove each entry. 303 // for the service and remove each entry.
313 if (profile_entry_deleters_.count(service_path)) { 304 if (profile_entry_deleters_.count(service_path)) {
314 InvokeErrorCallback( 305 InvokeErrorCallback(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 440
450 // static 441 // static
451 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 442 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
452 NetworkStateHandler* network_state_handler) { 443 NetworkStateHandler* network_state_handler) {
453 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 444 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
454 handler->Init(network_state_handler); 445 handler->Init(network_state_handler);
455 return handler; 446 return handler;
456 } 447 }
457 448
458 } // namespace chromeos 449 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/network/network_configuration_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698