| 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 #ifndef NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ | 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ |
| 6 #define NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ | 6 #define NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ |
| 7 | 7 |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
| 10 #include <resolv.h> | 10 #include <resolv.h> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 #include "net/dns/dns_config_service.h" | 14 #include "net/dns/dns_config_service.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 // Use DnsConfigService::CreateSystemService to use it outside of tests. | 18 // Use DnsConfigService::CreateSystemService to use it outside of tests. |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 class NET_EXPORT_PRIVATE DnsConfigServicePosix : public DnsConfigService { | 21 class NET_EXPORT_PRIVATE DnsConfigServicePosix : public DnsConfigService { |
| 22 public: | 22 public: |
| 23 DnsConfigServicePosix(); | 23 DnsConfigServicePosix(); |
| 24 virtual ~DnsConfigServicePosix(); | 24 virtual ~DnsConfigServicePosix(); |
| 25 | 25 |
| 26 protected: |
| 27 // DnsConfigService: |
| 28 virtual void ReadNow() OVERRIDE; |
| 29 virtual bool StartWatching() OVERRIDE; |
| 30 |
| 26 private: | 31 private: |
| 27 class Watcher; | 32 class Watcher; |
| 28 class ConfigReader; | 33 class ConfigReader; |
| 29 class HostsReader; | 34 class HostsReader; |
| 30 | 35 |
| 31 // DnsConfigService: | |
| 32 virtual void ReadNow() OVERRIDE; | |
| 33 virtual bool StartWatching() OVERRIDE; | |
| 34 | |
| 35 void OnConfigChanged(bool succeeded); | 36 void OnConfigChanged(bool succeeded); |
| 36 void OnHostsChanged(bool succeeded); | 37 void OnHostsChanged(bool succeeded); |
| 37 | 38 |
| 38 scoped_ptr<Watcher> watcher_; | 39 scoped_ptr<Watcher> watcher_; |
| 39 scoped_refptr<ConfigReader> config_reader_; | 40 scoped_refptr<ConfigReader> config_reader_; |
| 40 scoped_refptr<HostsReader> hosts_reader_; | 41 scoped_refptr<HostsReader> hosts_reader_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix); | 43 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix); |
| 43 }; | 44 }; |
| 44 | 45 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 | 58 |
| 58 // Fills in |dns_config| from |res|. | 59 // Fills in |dns_config| from |res|. |
| 59 ConfigParsePosixResult NET_EXPORT_PRIVATE ConvertResStateToDnsConfig( | 60 ConfigParsePosixResult NET_EXPORT_PRIVATE ConvertResStateToDnsConfig( |
| 60 const struct __res_state& res, DnsConfig* dns_config); | 61 const struct __res_state& res, DnsConfig* dns_config); |
| 61 | 62 |
| 62 } // namespace internal | 63 } // namespace internal |
| 63 | 64 |
| 64 } // namespace net | 65 } // namespace net |
| 65 | 66 |
| 66 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ | 67 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ |
| OLD | NEW |