Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" | 
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 void NetworkConfigurationHandler::RemoveObserver( | 221 void NetworkConfigurationHandler::RemoveObserver( | 
| 222 NetworkConfigurationObserver* observer) { | 222 NetworkConfigurationObserver* observer) { | 
| 223 observers_.RemoveObserver(observer); | 223 observers_.RemoveObserver(observer); | 
| 224 } | 224 } | 
| 225 | 225 | 
| 226 void NetworkConfigurationHandler::GetShillProperties( | 226 void NetworkConfigurationHandler::GetShillProperties( | 
| 227 const std::string& service_path, | 227 const std::string& service_path, | 
| 228 const network_handler::DictionaryResultCallback& callback, | 228 const network_handler::DictionaryResultCallback& callback, | 
| 229 const network_handler::ErrorCallback& error_callback) { | 229 const network_handler::ErrorCallback& error_callback) { | 
| 230 NET_LOG(USER) << "GetShillProperties: " << service_path; | 230 NET_LOG(USER) << "GetShillProperties: " << service_path; | 
| 231 | |
| 232 const NetworkState* network_state = | |
| 233 network_state_handler_->GetNetworkState(service_path); | |
| 234 if (network_state && | |
| 
 
stevenjb
2017/04/24 21:26:41
As long as we are doing this lookup, we can fail e
 
Kyle Horimoto
2017/04/25 01:18:32
I don't think this is the right thing to do. I mad
 
 | |
| 235 NetworkTypePattern::Tether().MatchesType(network_state->type())) { | |
| 236 // If this is a Tether network, use the properties present in the | |
| 237 // NetworkState object provided by NetworkStateHandler. Tether networks are | |
| 238 // not present in Shill, so the Shill call below will not work. | |
| 239 base::DictionaryValue dictionary; | |
| 240 network_state->GetStateProperties(&dictionary); | |
| 241 callback.Run(service_path, dictionary); | |
| 242 return; | |
| 243 } | |
| 244 | |
| 231 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( | 245 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( | 
| 232 dbus::ObjectPath(service_path), | 246 dbus::ObjectPath(service_path), | 
| 233 base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback, | 247 base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback, | 
| 234 weak_ptr_factory_.GetWeakPtr(), callback, error_callback, | 248 weak_ptr_factory_.GetWeakPtr(), callback, error_callback, | 
| 235 service_path)); | 249 service_path)); | 
| 236 } | 250 } | 
| 237 | 251 | 
| 238 void NetworkConfigurationHandler::SetShillProperties( | 252 void NetworkConfigurationHandler::SetShillProperties( | 
| 239 const std::string& service_path, | 253 const std::string& service_path, | 
| 240 const base::DictionaryValue& shill_properties, | 254 const base::DictionaryValue& shill_properties, | 
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 // static | 660 // static | 
| 647 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( | 661 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( | 
| 648 NetworkStateHandler* network_state_handler, | 662 NetworkStateHandler* network_state_handler, | 
| 649 NetworkDeviceHandler* network_device_handler) { | 663 NetworkDeviceHandler* network_device_handler) { | 
| 650 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); | 664 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); | 
| 651 handler->Init(network_state_handler, network_device_handler); | 665 handler->Init(network_state_handler, network_device_handler); | 
| 652 return handler; | 666 return handler; | 
| 653 } | 667 } | 
| 654 | 668 | 
| 655 } // namespace chromeos | 669 } // namespace chromeos | 
| OLD | NEW |