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 "net/dns/dns_config_service_win.h" | 5 #include "net/dns/dns_config_service_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 hosts->insert(std::make_pair(DnsHostsKey("localhost", ADDRESS_FAMILY_IPV6), | 234 hosts->insert(std::make_pair(DnsHostsKey("localhost", ADDRESS_FAMILY_IPV6), |
235 loopback_ipv6)); | 235 loopback_ipv6)); |
236 | 236 |
237 WCHAR buffer[MAX_PATH]; | 237 WCHAR buffer[MAX_PATH]; |
238 DWORD size = MAX_PATH; | 238 DWORD size = MAX_PATH; |
239 std::string localname; | 239 std::string localname; |
240 if (!GetComputerNameExW(ComputerNameDnsHostname, buffer, &size) || | 240 if (!GetComputerNameExW(ComputerNameDnsHostname, buffer, &size) || |
241 !ParseDomainASCII(buffer, &localname)) { | 241 !ParseDomainASCII(buffer, &localname)) { |
242 return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED; | 242 return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED; |
243 } | 243 } |
244 base::StringToLowerASCII(&localname); | 244 localname = base::ToLowerASCII(localname); |
245 | 245 |
246 bool have_ipv4 = | 246 bool have_ipv4 = |
247 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)) > 0; | 247 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)) > 0; |
248 bool have_ipv6 = | 248 bool have_ipv6 = |
249 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)) > 0; | 249 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)) > 0; |
250 | 250 |
251 if (have_ipv4 && have_ipv6) | 251 if (have_ipv4 && have_ipv6) |
252 return HOSTS_PARSE_WIN_OK; | 252 return HOSTS_PARSE_WIN_OK; |
253 | 253 |
254 scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses = | 254 scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses = |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 } | 777 } |
778 | 778 |
779 } // namespace internal | 779 } // namespace internal |
780 | 780 |
781 // static | 781 // static |
782 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 782 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
783 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 783 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
784 } | 784 } |
785 | 785 |
786 } // namespace net | 786 } // namespace net |
OLD | NEW |