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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_path_watcher.h" | 14 #include "base/files/file_path_watcher.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
18 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
21 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
22 #include "base/threading/non_thread_safe.h" | 23 #include "base/threading/non_thread_safe.h" |
23 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
25 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 327 |
327 DISALLOW_COPY_AND_ASSIGN(RegistryWatcher); | 328 DISALLOW_COPY_AND_ASSIGN(RegistryWatcher); |
328 }; | 329 }; |
329 | 330 |
330 // Returns true iff |address| is DNS address from IPv6 stateless discovery, | 331 // Returns true iff |address| is DNS address from IPv6 stateless discovery, |
331 // i.e., matches fec0:0:0:ffff::{1,2,3}. | 332 // i.e., matches fec0:0:0:ffff::{1,2,3}. |
332 // http://tools.ietf.org/html/draft-ietf-ipngwg-dns-discovery | 333 // http://tools.ietf.org/html/draft-ietf-ipngwg-dns-discovery |
333 bool IsStatelessDiscoveryAddress(const IPAddressNumber& address) { | 334 bool IsStatelessDiscoveryAddress(const IPAddressNumber& address) { |
334 if (address.size() != kIPv6AddressSize) | 335 if (address.size() != kIPv6AddressSize) |
335 return false; | 336 return false; |
336 const uint8 kPrefix[] = { | 337 const uint8_t kPrefix[] = { |
337 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | 338 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, |
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
339 }; | 340 }; |
340 return std::equal(kPrefix, kPrefix + arraysize(kPrefix), | 341 return std::equal(kPrefix, kPrefix + arraysize(kPrefix), |
341 address.begin()) && (address.back() < 4); | 342 address.begin()) && (address.back() < 4); |
342 } | 343 } |
343 | 344 |
344 // Returns the path to the HOSTS file. | 345 // Returns the path to the HOSTS file. |
345 base::FilePath GetHostsPath() { | 346 base::FilePath GetHostsPath() { |
346 TCHAR buffer[MAX_PATH]; | 347 TCHAR buffer[MAX_PATH]; |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 } | 778 } |
778 | 779 |
779 } // namespace internal | 780 } // namespace internal |
780 | 781 |
781 // static | 782 // static |
782 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 783 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
783 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 784 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
784 } | 785 } |
785 | 786 |
786 } // namespace net | 787 } // namespace net |
OLD | NEW |