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

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: . 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()); 56 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
58 std::string name = 57 if (properties.HasKey(shill::kTypeProperty)) {
pneubeck (no reviews) 2014/03/21 09:33:42 isn't this a major error and should stop the conne
stevenjb 2014/03/21 17:08:51 This one happens regularly, but it's because somet
59 shill_property_util::GetNameFromProperties(service_path, properties); 58 // Get the correct name from WifiHex if necessary.
60 if (!name.empty()) { 59 std::string name =
61 properties_copy->SetStringWithoutPathExpansion(shill::kNameProperty, name); 60 shill_property_util::GetNameFromProperties(service_path, properties);
61 if (!name.empty()) {
62 properties_copy->SetStringWithoutPathExpansion(
63 shill::kNameProperty, name);
64 }
62 } 65 }
63 if (call_status != DBUS_METHOD_CALL_SUCCESS) { 66 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
64 // Because network services are added and removed frequently, we will see 67 // Because network services are added and removed frequently, we will see
65 // failures regularly, so don't log these. 68 // failures regularly, so don't log these.
66 network_handler::RunErrorCallback(error_callback, 69 network_handler::RunErrorCallback(error_callback,
67 service_path, 70 service_path,
68 network_handler::kDBusFailedError, 71 network_handler::kDBusFailedError,
69 network_handler::kDBusFailedErrorMessage); 72 network_handler::kDBusFailedErrorMessage);
70 } else if (!callback.is_null()) { 73 } else if (!callback.is_null()) {
71 callback.Run(service_path, *properties_copy.get()); 74 callback.Run(service_path, *properties_copy.get());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 275 }
273 276
274 void NetworkConfigurationHandler::CreateConfiguration( 277 void NetworkConfigurationHandler::CreateConfiguration(
275 const base::DictionaryValue& properties, 278 const base::DictionaryValue& properties,
276 const network_handler::StringResultCallback& callback, 279 const network_handler::StringResultCallback& callback,
277 const network_handler::ErrorCallback& error_callback) { 280 const network_handler::ErrorCallback& error_callback) {
278 ShillManagerClient* manager = 281 ShillManagerClient* manager =
279 DBusThreadManager::Get()->GetShillManagerClient(); 282 DBusThreadManager::Get()->GetShillManagerClient();
280 std::string type; 283 std::string type;
281 properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); 284 properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type);
285 DCHECK(!type.empty());
282 if (NetworkTypePattern::Ethernet().MatchesType(type)) { 286 if (NetworkTypePattern::Ethernet().MatchesType(type)) {
283 InvokeErrorCallback( 287 InvokeErrorCallback(
284 "" /* no service path */, 288 shill_property_util::GetNetworkIdFromProperties(properties),
285 error_callback, 289 error_callback,
286 "ConfigureServiceForProfile is not implemented for Ethernet"); 290 "ConfigureServiceForProfile: Invalid type: " + type);
287 return; 291 return;
288 } 292 }
289 293
290 NET_LOG_USER("CreateConfiguration", type); 294 NET_LOG_USER("CreateConfiguration: " + type,
295 shill_property_util::GetNetworkIdFromProperties(properties));
291 LogConfigProperties("Configure", type, properties); 296 LogConfigProperties("Configure", type, properties);
292 297
293 std::string profile; 298 std::string profile;
294 properties.GetStringWithoutPathExpansion(shill::kProfileProperty, 299 properties.GetStringWithoutPathExpansion(shill::kProfileProperty,
295 &profile); 300 &profile);
296 DCHECK(!profile.empty()); 301 DCHECK(!profile.empty());
297 manager->ConfigureServiceForProfile( 302 manager->ConfigureServiceForProfile(
298 dbus::ObjectPath(profile), 303 dbus::ObjectPath(profile),
299 properties, 304 properties,
300 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback, 305 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 456
452 // static 457 // static
453 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 458 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
454 NetworkStateHandler* network_state_handler) { 459 NetworkStateHandler* network_state_handler) {
455 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 460 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
456 handler->Init(network_state_handler); 461 handler->Init(network_state_handler);
457 return handler; 462 return handler;
458 } 463 }
459 464
460 } // namespace chromeos 465 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698