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_posix.h" | 5 #include "net/dns/dns_config_service_posix.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 void DnsConfigServicePosix::Watch() { | 78 void DnsConfigServicePosix::Watch() { |
79 DCHECK(CalledOnValidThread()); | 79 DCHECK(CalledOnValidThread()); |
80 config_watcher_->StartWatch(FilePath(FILE_PATH_LITERAL(_PATH_RESCONF)), | 80 config_watcher_->StartWatch(FilePath(FILE_PATH_LITERAL(_PATH_RESCONF)), |
81 new ConfigReader(this)); | 81 new ConfigReader(this)); |
82 FilePath hosts_path(FILE_PATH_LITERAL("/etc/hosts")); | 82 FilePath hosts_path(FILE_PATH_LITERAL("/etc/hosts")); |
83 hosts_watcher_->StartWatch(hosts_path, new DnsHostsReader(hosts_path, this)); | 83 hosts_watcher_->StartWatch(hosts_path, new DnsHostsReader(hosts_path, this)); |
84 } | 84 } |
85 | 85 |
86 // static | 86 // static |
87 DnsConfigService* DnsConfigService::CreateSystemService() { | 87 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
88 return new DnsConfigServicePosix(); | 88 return scoped_ptr<DnsConfigService>(new DnsConfigServicePosix()); |
89 } | 89 } |
90 | 90 |
91 #if !defined(OS_ANDROID) | 91 #if !defined(OS_ANDROID) |
92 bool ConvertResStateToDnsConfig(const struct __res_state& res, | 92 bool ConvertResStateToDnsConfig(const struct __res_state& res, |
93 DnsConfig* dns_config) { | 93 DnsConfig* dns_config) { |
94 CHECK(dns_config != NULL); | 94 CHECK(dns_config != NULL); |
95 DCHECK(res.options & RES_INIT); | 95 DCHECK(res.options & RES_INIT); |
96 | 96 |
97 dns_config->nameservers.clear(); | 97 dns_config->nameservers.clear(); |
98 | 98 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 #if defined(RES_ROTATE) | 138 #if defined(RES_ROTATE) |
139 dns_config->rotate = res.options & RES_ROTATE; | 139 dns_config->rotate = res.options & RES_ROTATE; |
140 #endif | 140 #endif |
141 dns_config->edns0 = res.options & RES_USE_EDNS0; | 141 dns_config->edns0 = res.options & RES_USE_EDNS0; |
142 | 142 |
143 return true; | 143 return true; |
144 } | 144 } |
145 #endif // !defined(OS_ANDROID) | 145 #endif // !defined(OS_ANDROID) |
146 | 146 |
147 } // namespace net | 147 } // namespace net |
OLD | NEW |