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

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

Issue 24348002: Migrate DBus service constants from flimflam namespace to shill namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased to ToT Created 7 years, 3 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 (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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const network_handler::DictionaryResultCallback& callback, 53 const network_handler::DictionaryResultCallback& callback,
54 const network_handler::ErrorCallback& error_callback, 54 const network_handler::ErrorCallback& error_callback,
55 const std::string& service_path, 55 const std::string& service_path,
56 DBusMethodCallStatus call_status, 56 DBusMethodCallStatus call_status,
57 const base::DictionaryValue& properties) { 57 const base::DictionaryValue& properties) {
58 // Get the correct name from WifiHex if necessary. 58 // Get the correct name from WifiHex if necessary.
59 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy()); 59 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
60 std::string name = 60 std::string name =
61 shill_property_util::GetNameFromProperties(service_path, properties); 61 shill_property_util::GetNameFromProperties(service_path, properties);
62 if (!name.empty()) { 62 if (!name.empty()) {
63 properties_copy->SetStringWithoutPathExpansion( 63 properties_copy->SetStringWithoutPathExpansion(shill::kNameProperty, name);
64 flimflam::kNameProperty, name);
65 } 64 }
66 if (call_status != DBUS_METHOD_CALL_SUCCESS) { 65 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
67 // Because network services are added and removed frequently, we will see 66 // Because network services are added and removed frequently, we will see
68 // failures regularly, so don't log these. 67 // failures regularly, so don't log these.
69 if (!error_callback.is_null()) { 68 if (!error_callback.is_null()) {
70 scoped_ptr<base::DictionaryValue> error_data( 69 scoped_ptr<base::DictionaryValue> error_data(
71 network_handler::CreateErrorData( 70 network_handler::CreateErrorData(
72 service_path, 71 service_path,
73 network_handler::kDBusFailedError, 72 network_handler::kDBusFailedError,
74 network_handler::kDBusFailedErrorMessage)); 73 network_handler::kDBusFailedErrorMessage));
(...skipping 10 matching lines...) Expand all
85 const network_handler::ErrorCallback& error_callback, 84 const network_handler::ErrorCallback& error_callback,
86 const std::string& dbus_error_name, 85 const std::string& dbus_error_name,
87 const std::string& dbus_error_message) { 86 const std::string& dbus_error_message) {
88 network_handler::ShillErrorCallbackFunction( 87 network_handler::ShillErrorCallbackFunction(
89 "Config.SetNetworkProfile Failed: " + profile_path, 88 "Config.SetNetworkProfile Failed: " + profile_path,
90 service_path, error_callback, 89 service_path, error_callback,
91 dbus_error_name, dbus_error_message); 90 dbus_error_name, dbus_error_message);
92 } 91 }
93 92
94 bool IsPassphrase(const std::string& key) { 93 bool IsPassphrase(const std::string& key) {
95 return key == flimflam::kEapPrivateKeyPasswordProperty || 94 return key == shill::kEapPrivateKeyPasswordProperty ||
96 key == flimflam::kEapPasswordProperty || 95 key == shill::kEapPasswordProperty ||
97 key == flimflam::kL2tpIpsecPasswordProperty || 96 key == shill::kL2tpIpsecPasswordProperty ||
98 key == flimflam::kOpenVPNPasswordProperty || 97 key == shill::kOpenVPNPasswordProperty ||
99 key == flimflam::kPassphraseProperty || 98 key == shill::kPassphraseProperty ||
100 key == flimflam::kOpenVPNOTPProperty || 99 key == shill::kOpenVPNOTPProperty ||
101 key == flimflam::kEapPrivateKeyProperty || 100 key == shill::kEapPrivateKeyProperty ||
102 key == flimflam::kEapPinProperty || 101 key == shill::kEapPinProperty ||
103 key == flimflam::kApnPasswordProperty; 102 key == shill::kApnPasswordProperty;
104 } 103 }
105 104
106 void LogConfigProperties(const std::string& desc, 105 void LogConfigProperties(const std::string& desc,
107 const std::string& path, 106 const std::string& path,
108 const base::DictionaryValue& properties) { 107 const base::DictionaryValue& properties) {
109 for (base::DictionaryValue::Iterator iter(properties); 108 for (base::DictionaryValue::Iterator iter(properties);
110 !iter.IsAtEnd(); iter.Advance()) { 109 !iter.IsAtEnd(); iter.Advance()) {
111 std::string v = "******"; 110 std::string v = "******";
112 if (!IsPassphrase(iter.key())) 111 if (!IsPassphrase(iter.key()))
113 base::JSONWriter::Write(&iter.value(), &v); 112 base::JSONWriter::Write(&iter.value(), &v);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 AsWeakPtr(), service_path, error_callback)); 277 AsWeakPtr(), service_path, error_callback));
279 } 278 }
280 279
281 void NetworkConfigurationHandler::CreateConfiguration( 280 void NetworkConfigurationHandler::CreateConfiguration(
282 const base::DictionaryValue& properties, 281 const base::DictionaryValue& properties,
283 const network_handler::StringResultCallback& callback, 282 const network_handler::StringResultCallback& callback,
284 const network_handler::ErrorCallback& error_callback) { 283 const network_handler::ErrorCallback& error_callback) {
285 ShillManagerClient* manager = 284 ShillManagerClient* manager =
286 DBusThreadManager::Get()->GetShillManagerClient(); 285 DBusThreadManager::Get()->GetShillManagerClient();
287 std::string type; 286 std::string type;
288 properties.GetStringWithoutPathExpansion(flimflam::kTypeProperty, &type); 287 properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
289 288
290 NET_LOG_USER("CreateConfiguration", type); 289 NET_LOG_USER("CreateConfiguration", type);
291 LogConfigProperties("Configure", type, properties); 290 LogConfigProperties("Configure", type, properties);
292 291
293 std::string profile; 292 std::string profile;
294 properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty, 293 properties.GetStringWithoutPathExpansion(shill::kProfileProperty,
295 &profile); 294 &profile);
296 DCHECK(!profile.empty()); 295 DCHECK(!profile.empty());
297 manager->ConfigureServiceForProfile( 296 manager->ConfigureServiceForProfile(
298 dbus::ObjectPath(profile), 297 dbus::ObjectPath(profile),
299 properties, 298 properties,
300 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback, 299 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
301 AsWeakPtr(), 300 AsWeakPtr(),
302 callback), 301 callback),
303 base::Bind(&network_handler::ShillErrorCallbackFunction, 302 base::Bind(&network_handler::ShillErrorCallbackFunction,
304 "Config.CreateConfiguration Failed", 303 "Config.CreateConfiguration Failed",
(...skipping 21 matching lines...) Expand all
326 325
327 void NetworkConfigurationHandler::SetNetworkProfile( 326 void NetworkConfigurationHandler::SetNetworkProfile(
328 const std::string& service_path, 327 const std::string& service_path,
329 const std::string& profile_path, 328 const std::string& profile_path,
330 const base::Closure& callback, 329 const base::Closure& callback,
331 const network_handler::ErrorCallback& error_callback) { 330 const network_handler::ErrorCallback& error_callback) {
332 NET_LOG_USER("SetNetworkProfile", service_path + ": " + profile_path); 331 NET_LOG_USER("SetNetworkProfile", service_path + ": " + profile_path);
333 base::StringValue profile_path_value(profile_path); 332 base::StringValue profile_path_value(profile_path);
334 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 333 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
335 dbus::ObjectPath(service_path), 334 dbus::ObjectPath(service_path),
336 flimflam::kProfileProperty, 335 shill::kProfileProperty,
337 profile_path_value, 336 profile_path_value,
338 callback, 337 callback,
339 base::Bind(&SetNetworkProfileErrorCallback, 338 base::Bind(&SetNetworkProfileErrorCallback,
340 service_path, profile_path, error_callback)); 339 service_path, profile_path, error_callback));
341 } 340 }
342 341
343 // NetworkConfigurationHandler Private methods 342 // NetworkConfigurationHandler Private methods
344 343
345 NetworkConfigurationHandler::NetworkConfigurationHandler() 344 NetworkConfigurationHandler::NetworkConfigurationHandler()
346 : network_state_handler_(NULL) { 345 : network_state_handler_(NULL) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 450
452 // static 451 // static
453 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 452 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
454 NetworkStateHandler* network_state_handler) { 453 NetworkStateHandler* network_state_handler) {
455 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 454 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
456 handler->Init(network_state_handler); 455 handler->Init(network_state_handler);
457 return handler; 456 return handler;
458 } 457 }
459 458
460 } // namespace chromeos 459 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698