| 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_WIN_H_ | 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
| 6 #define NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ | 6 #define NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
| 7 | 7 |
| 8 // The sole purpose of dns_config_service_win.h is for unittests so we just | 8 // The sole purpose of dns_config_service_win.h is for unittests so we just |
| 9 // include these headers here. | 9 // include these headers here. |
| 10 #include <winsock2.h> | 10 #include <winsock2.h> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 CONFIG_PARSE_WIN_NO_NAMESERVERS, | 115 CONFIG_PARSE_WIN_NO_NAMESERVERS, |
| 116 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. | 116 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // Fills in |dns_config| from |settings|. Exposed for tests. | 119 // Fills in |dns_config| from |settings|. Exposed for tests. |
| 120 ConfigParseWinResult NET_EXPORT_PRIVATE ConvertSettingsToDnsConfig( | 120 ConfigParseWinResult NET_EXPORT_PRIVATE ConvertSettingsToDnsConfig( |
| 121 const DnsSystemSettings& settings, | 121 const DnsSystemSettings& settings, |
| 122 DnsConfig* dns_config); | 122 DnsConfig* dns_config); |
| 123 | 123 |
| 124 // Use DnsConfigService::CreateSystemService to use it outside of tests. | 124 // Use DnsConfigService::CreateSystemService to use it outside of tests. |
| 125 class NET_EXPORT_PRIVATE DnsConfigServiceWin | 125 class NET_EXPORT_PRIVATE DnsConfigServiceWin : public DnsConfigService { |
| 126 : public DnsConfigService, | |
| 127 public NetworkChangeNotifier::IPAddressObserver { | |
| 128 public: | 126 public: |
| 129 DnsConfigServiceWin(); | 127 DnsConfigServiceWin(); |
| 130 virtual ~DnsConfigServiceWin(); | 128 virtual ~DnsConfigServiceWin(); |
| 131 | 129 |
| 132 virtual void Watch(const CallbackType& callback) OVERRIDE; | |
| 133 | |
| 134 private: | 130 private: |
| 131 class Watcher; |
| 135 class ConfigReader; | 132 class ConfigReader; |
| 136 class HostsReader; | 133 class HostsReader; |
| 137 | 134 |
| 138 // NetworkChangeNotifier::DNSObserver: | 135 // DnsConfigService: |
| 139 virtual void OnDNSChanged(unsigned detail) OVERRIDE; | 136 virtual void ReadNow() OVERRIDE; |
| 137 virtual bool StartWatching() OVERRIDE; |
| 140 | 138 |
| 141 // NetworkChangeNotifier::IPAddressObserver: | 139 void OnConfigChanged(bool succeeded); |
| 142 virtual void OnIPAddressChanged() OVERRIDE; | 140 void OnHostsChanged(bool succeeded); |
| 143 | 141 |
| 142 scoped_ptr<Watcher> watcher_; |
| 144 scoped_refptr<ConfigReader> config_reader_; | 143 scoped_refptr<ConfigReader> config_reader_; |
| 145 scoped_refptr<HostsReader> hosts_reader_; | 144 scoped_refptr<HostsReader> hosts_reader_; |
| 146 | 145 |
| 147 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); | 146 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace internal | 149 } // namespace internal |
| 151 | 150 |
| 152 } // namespace net | 151 } // namespace net |
| 153 | 152 |
| 154 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ | 153 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
| 155 | 154 |
| OLD | NEW |