| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/host_resolver_impl_chromeos.h" | 5 #include "chromeos/network/host_resolver_impl_chromeos.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "base/sys_info.h" |
| 8 #include "base/values.h" | 9 #include "base/values.h" |
| 9 #include "chromeos/network/device_state.h" | 10 #include "chromeos/network/device_state.h" |
| 10 #include "chromeos/network/network_handler.h" | 11 #include "chromeos/network/network_handler.h" |
| 11 #include "chromeos/network/network_state.h" | 12 #include "chromeos/network/network_state.h" |
| 12 #include "chromeos/network/network_state_handler.h" | 13 #include "chromeos/network/network_state_handler.h" |
| 13 #include "chromeos/network/network_state_handler_observer.h" | 14 #include "chromeos/network/network_state_handler_observer.h" |
| 14 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
| 15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE { | 55 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE { |
| 55 if (!network) { | 56 if (!network) { |
| 56 DVLOG(2) << "DefaultNetworkChanged: No Network."; | 57 DVLOG(2) << "DefaultNetworkChanged: No Network."; |
| 57 CallResolverSetIpAddress("", ""); | 58 CallResolverSetIpAddress("", ""); |
| 58 return; | 59 return; |
| 59 } | 60 } |
| 60 std::string ipv4_address, ipv6_address; | 61 std::string ipv4_address, ipv6_address; |
| 61 const DeviceState* device_state = | 62 const DeviceState* device_state = |
| 62 network_state_handler_->GetDeviceState(network->device_path()); | 63 network_state_handler_->GetDeviceState(network->device_path()); |
| 63 if (!device_state) { | 64 if (!device_state) { |
| 64 LOG(ERROR) << "DefaultNetworkChanged: Network missing device: " | 65 LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) |
| 65 << network->path(); | 66 << "DefaultNetworkChanged: Network missing device: " |
| 67 << network->path(); |
| 66 CallResolverSetIpAddress("", ""); | 68 CallResolverSetIpAddress("", ""); |
| 67 return; | 69 return; |
| 68 } | 70 } |
| 69 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); | 71 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); |
| 70 !iter.IsAtEnd(); iter.Advance()) { | 72 !iter.IsAtEnd(); iter.Advance()) { |
| 71 const base::DictionaryValue* ip_config; | 73 const base::DictionaryValue* ip_config; |
| 72 if (!iter.value().GetAsDictionary(&ip_config)) { | 74 if (!iter.value().GetAsDictionary(&ip_config)) { |
| 73 LOG(ERROR) << "Badly formatted IPConfigs: " << network->path(); | 75 LOG(ERROR) << "Badly formatted IPConfigs: " << network->path(); |
| 74 continue; | 76 continue; |
| 75 } | 77 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 NetworkStateHandler* network_state_handler) { | 207 NetworkStateHandler* network_state_handler) { |
| 206 Options options; | 208 Options options; |
| 207 return scoped_ptr<net::HostResolver>(new HostResolverImplChromeOS( | 209 return scoped_ptr<net::HostResolver>(new HostResolverImplChromeOS( |
| 208 network_handler_message_loop, | 210 network_handler_message_loop, |
| 209 network_state_handler, | 211 network_state_handler, |
| 210 options, | 212 options, |
| 211 NULL)); | 213 NULL)); |
| 212 } | 214 } |
| 213 | 215 |
| 214 } // namespace chromeos | 216 } // namespace chromeos |
| OLD | NEW |