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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 hosts->insert(std::make_pair(DnsHostsKey("localhost", ADDRESS_FAMILY_IPV6), | 233 hosts->insert(std::make_pair(DnsHostsKey("localhost", ADDRESS_FAMILY_IPV6), |
234 loopback_ipv6)); | 234 loopback_ipv6)); |
235 | 235 |
236 WCHAR buffer[MAX_PATH]; | 236 WCHAR buffer[MAX_PATH]; |
237 DWORD size = MAX_PATH; | 237 DWORD size = MAX_PATH; |
238 std::string localname; | 238 std::string localname; |
239 if (!GetComputerNameExW(ComputerNameDnsHostname, buffer, &size) || | 239 if (!GetComputerNameExW(ComputerNameDnsHostname, buffer, &size) || |
240 !ParseDomainASCII(buffer, &localname)) { | 240 !ParseDomainASCII(buffer, &localname)) { |
241 return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED; | 241 return HOSTS_PARSE_WIN_COMPUTER_NAME_FAILED; |
242 } | 242 } |
243 StringToLowerASCII(&localname); | 243 base::StringToLowerASCII(&localname); |
244 | 244 |
245 bool have_ipv4 = | 245 bool have_ipv4 = |
246 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)) > 0; | 246 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)) > 0; |
247 bool have_ipv6 = | 247 bool have_ipv6 = |
248 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)) > 0; | 248 hosts->count(DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)) > 0; |
249 | 249 |
250 if (have_ipv4 && have_ipv6) | 250 if (have_ipv4 && have_ipv6) |
251 return HOSTS_PARSE_WIN_OK; | 251 return HOSTS_PARSE_WIN_OK; |
252 | 252 |
253 scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses = | 253 scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses = |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 } | 758 } |
759 | 759 |
760 } // namespace internal | 760 } // namespace internal |
761 | 761 |
762 // static | 762 // static |
763 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 763 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
764 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 764 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
765 } | 765 } |
766 | 766 |
767 } // namespace net | 767 } // namespace net |
OLD | NEW |