| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/local_discovery/endpoint_resolver.h" | 5 #include "chrome/browser/local_discovery/endpoint_resolver.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/dump_without_crashing.h" | 8 #include "base/debug/dump_without_crashing.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 10 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (result != ServiceResolver::STATUS_SUCCESS) | 35 if (result != ServiceResolver::STATUS_SUCCESS) |
| 36 return callback.Run(net::IPEndPoint()); | 36 return callback.Run(net::IPEndPoint()); |
| 37 | 37 |
| 38 Start(description.address, callback); | 38 Start(description.address, callback); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void EndpointResolver::Start(const net::HostPortPair& address, | 41 void EndpointResolver::Start(const net::HostPortPair& address, |
| 42 const ResultCallback& callback) { | 42 const ResultCallback& callback) { |
| 43 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
| 44 net::IPAddress ip_address; | 44 net::IPAddress ip_address; |
| 45 if (!net::IPAddress::FromIPLiteral(address.host(), &ip_address)) { | 45 if (!ip_address.AssignFromIPLiteral(address.host())) { |
| 46 NOTREACHED() << address.ToString(); | 46 NOTREACHED() << address.ToString(); |
| 47 // Unexpected, but could be a reason for crbug.com/513505 | 47 // Unexpected, but could be a reason for crbug.com/513505 |
| 48 base::debug::DumpWithoutCrashing(); | 48 base::debug::DumpWithoutCrashing(); |
| 49 return callback.Run(net::IPEndPoint()); | 49 return callback.Run(net::IPEndPoint()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // OSX already has IP there. | 52 // OSX already has IP there. |
| 53 callback.Run(net::IPEndPoint(ip_address, address.port())); | 53 callback.Run(net::IPEndPoint(ip_address, address.port())); |
| 54 #else // OS_MACOSX | 54 #else // OS_MACOSX |
| 55 net::AddressFamily address_family = net::ADDRESS_FAMILY_UNSPECIFIED; | 55 net::AddressFamily address_family = net::ADDRESS_FAMILY_UNSPECIFIED; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 78 net::IPAddress address = address_ipv4; | 78 net::IPAddress address = address_ipv4; |
| 79 if (!address.IsValid()) | 79 if (!address.IsValid()) |
| 80 address = address_ipv6; | 80 address = address_ipv6; |
| 81 | 81 |
| 82 DCHECK(address.IsValid()); | 82 DCHECK(address.IsValid()); |
| 83 | 83 |
| 84 callback.Run(net::IPEndPoint(address, port)); | 84 callback.Run(net::IPEndPoint(address, port)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace local_discovery | 87 } // namespace local_discovery |
| OLD | NEW |