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

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

Issue 207183003: Cleanup network event logging, add to ManagedNetworkConfigurationHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 network_handler::RunErrorCallback( 46 network_handler::RunErrorCallback(
47 error_callback, service_path, error_name, error_msg); 47 error_callback, service_path, error_name, error_msg);
48 } 48 }
49 49
50 void GetPropertiesCallback( 50 void GetPropertiesCallback(
51 const network_handler::DictionaryResultCallback& callback, 51 const network_handler::DictionaryResultCallback& callback,
52 const network_handler::ErrorCallback& error_callback, 52 const network_handler::ErrorCallback& error_callback,
53 const std::string& service_path, 53 const std::string& service_path,
54 DBusMethodCallStatus call_status, 54 DBusMethodCallStatus call_status,
55 const base::DictionaryValue& properties) { 55 const base::DictionaryValue& properties) {
56 // Get the correct name from WifiHex if necessary.
57 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
58 std::string name =
59 shill_property_util::GetNameFromProperties(service_path, properties);
60 if (!name.empty()) {
61 properties_copy->SetStringWithoutPathExpansion(shill::kNameProperty, name);
62 }
63 if (call_status != DBUS_METHOD_CALL_SUCCESS) { 56 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
64 // Because network services are added and removed frequently, we will see 57 // Because network services are added and removed frequently, we will see
65 // failures regularly, so don't log these. 58 // failures regularly, so don't log these.
66 network_handler::RunErrorCallback(error_callback, 59 network_handler::RunErrorCallback(error_callback,
67 service_path, 60 service_path,
68 network_handler::kDBusFailedError, 61 network_handler::kDBusFailedError,
69 network_handler::kDBusFailedErrorMessage); 62 network_handler::kDBusFailedErrorMessage);
70 } else if (!callback.is_null()) { 63 return;
71 callback.Run(service_path, *properties_copy.get());
72 } 64 }
65 if (callback.is_null())
66 return;
67
68 // Get the correct name from WifiHex if necessary.
69 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
70 std::string name =
71 shill_property_util::GetNameFromProperties(service_path, properties);
72 if (!name.empty())
73 properties_copy->SetStringWithoutPathExpansion(shill::kNameProperty, name);
74 callback.Run(service_path, *properties_copy.get());
73 } 75 }
74 76
75 void SetNetworkProfileErrorCallback( 77 void SetNetworkProfileErrorCallback(
76 const std::string& service_path, 78 const std::string& service_path,
77 const std::string& profile_path, 79 const std::string& profile_path,
78 const network_handler::ErrorCallback& error_callback, 80 const network_handler::ErrorCallback& error_callback,
79 const std::string& dbus_error_name, 81 const std::string& dbus_error_name,
80 const std::string& dbus_error_message) { 82 const std::string& dbus_error_message) {
81 network_handler::ShillErrorCallbackFunction( 83 network_handler::ShillErrorCallbackFunction(
82 "Config.SetNetworkProfile Failed: " + profile_path, 84 "Config.SetNetworkProfile Failed: " + profile_path,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 262 }
261 263
262 void NetworkConfigurationHandler::CreateConfiguration( 264 void NetworkConfigurationHandler::CreateConfiguration(
263 const base::DictionaryValue& properties, 265 const base::DictionaryValue& properties,
264 const network_handler::StringResultCallback& callback, 266 const network_handler::StringResultCallback& callback,
265 const network_handler::ErrorCallback& error_callback) { 267 const network_handler::ErrorCallback& error_callback) {
266 ShillManagerClient* manager = 268 ShillManagerClient* manager =
267 DBusThreadManager::Get()->GetShillManagerClient(); 269 DBusThreadManager::Get()->GetShillManagerClient();
268 std::string type; 270 std::string type;
269 properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); 271 properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
272 DCHECK(!type.empty());
270 if (NetworkTypePattern::Ethernet().MatchesType(type)) { 273 if (NetworkTypePattern::Ethernet().MatchesType(type)) {
271 InvokeErrorCallback( 274 InvokeErrorCallback(
272 "" /* no service path */, 275 shill_property_util::GetNetworkIdFromProperties(properties),
273 error_callback, 276 error_callback,
274 "ConfigureServiceForProfile is not implemented for Ethernet"); 277 "ConfigureServiceForProfile: Invalid type: " + type);
275 return; 278 return;
276 } 279 }
277 280
278 NET_LOG_USER("CreateConfiguration", type); 281 NET_LOG_USER("CreateConfiguration: " + type,
282 shill_property_util::GetNetworkIdFromProperties(properties));
279 LogConfigProperties("Configure", type, properties); 283 LogConfigProperties("Configure", type, properties);
280 284
281 std::string profile; 285 std::string profile;
282 properties.GetStringWithoutPathExpansion(shill::kProfileProperty, 286 properties.GetStringWithoutPathExpansion(shill::kProfileProperty,
283 &profile); 287 &profile);
284 DCHECK(!profile.empty()); 288 DCHECK(!profile.empty());
285 manager->ConfigureServiceForProfile( 289 manager->ConfigureServiceForProfile(
286 dbus::ObjectPath(profile), 290 dbus::ObjectPath(profile),
287 properties, 291 properties,
288 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback, 292 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 443
440 // static 444 // static
441 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 445 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
442 NetworkStateHandler* network_state_handler) { 446 NetworkStateHandler* network_state_handler) {
443 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 447 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
444 handler->Init(network_state_handler); 448 handler->Init(network_state_handler);
445 return handler; 449 return handler;
446 } 450 }
447 451
448 } // namespace chromeos 452 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_network_configuration_handler_impl.cc ('k') | chromeos/network/network_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698