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 20 matching lines...) Expand all Loading... |
31 // to the resolved name. We attempt to replicate this behavior. | 31 // to the resolved name. We attempt to replicate this behavior. |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // Parses |value| as search list (comma-delimited list of domain names) from | 37 // Parses |value| as search list (comma-delimited list of domain names) from |
38 // a registry key and stores it in |out|. Returns true on success. Empty | 38 // a registry key and stores it in |out|. Returns true on success. Empty |
39 // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames | 39 // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames |
40 // are converted to punycode. | 40 // are converted to punycode. |
41 bool NET_EXPORT_PRIVATE ParseSearchList(const base::string16& value, | 41 bool NET_EXPORT_PRIVATE |
42 std::vector<std::string>* out); | 42 ParseSearchList(const base::string16& value, std::vector<std::string>* out); |
43 | 43 |
44 // All relevant settings read from registry and IP Helper. This isolates our | 44 // All relevant settings read from registry and IP Helper. This isolates our |
45 // logic from system calls and is exposed for unit tests. Keep it an aggregate | 45 // logic from system calls and is exposed for unit tests. Keep it an aggregate |
46 // struct for easy initialization. | 46 // struct for easy initialization. |
47 struct NET_EXPORT_PRIVATE DnsSystemSettings { | 47 struct NET_EXPORT_PRIVATE DnsSystemSettings { |
48 // The |set| flag distinguishes between empty and unset values. | 48 // The |set| flag distinguishes between empty and unset values. |
49 struct RegString { | 49 struct RegString { |
50 bool set; | 50 bool set; |
51 base::string16 value; | 51 base::string16 value; |
52 }; | 52 }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 CONFIG_PARSE_WIN_READ_TCPIP_DEVOLUTION, | 102 CONFIG_PARSE_WIN_READ_TCPIP_DEVOLUTION, |
103 CONFIG_PARSE_WIN_READ_APPEND_MULTILABEL, | 103 CONFIG_PARSE_WIN_READ_APPEND_MULTILABEL, |
104 CONFIG_PARSE_WIN_READ_PRIMARY_SUFFIX, | 104 CONFIG_PARSE_WIN_READ_PRIMARY_SUFFIX, |
105 CONFIG_PARSE_WIN_BAD_ADDRESS, | 105 CONFIG_PARSE_WIN_BAD_ADDRESS, |
106 CONFIG_PARSE_WIN_NO_NAMESERVERS, | 106 CONFIG_PARSE_WIN_NO_NAMESERVERS, |
107 CONFIG_PARSE_WIN_UNHANDLED_OPTIONS, | 107 CONFIG_PARSE_WIN_UNHANDLED_OPTIONS, |
108 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. | 108 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. |
109 }; | 109 }; |
110 | 110 |
111 // Fills in |dns_config| from |settings|. Exposed for tests. | 111 // Fills in |dns_config| from |settings|. Exposed for tests. |
112 ConfigParseWinResult NET_EXPORT_PRIVATE ConvertSettingsToDnsConfig( | 112 ConfigParseWinResult NET_EXPORT_PRIVATE |
113 const DnsSystemSettings& settings, | 113 ConvertSettingsToDnsConfig(const DnsSystemSettings& settings, |
114 DnsConfig* dns_config); | 114 DnsConfig* dns_config); |
115 | 115 |
116 // Use DnsConfigService::CreateSystemService to use it outside of tests. | 116 // Use DnsConfigService::CreateSystemService to use it outside of tests. |
117 class NET_EXPORT_PRIVATE DnsConfigServiceWin : public DnsConfigService { | 117 class NET_EXPORT_PRIVATE DnsConfigServiceWin : public DnsConfigService { |
118 public: | 118 public: |
119 DnsConfigServiceWin(); | 119 DnsConfigServiceWin(); |
120 virtual ~DnsConfigServiceWin(); | 120 virtual ~DnsConfigServiceWin(); |
121 | 121 |
122 private: | 122 private: |
123 class Watcher; | 123 class Watcher; |
124 class ConfigReader; | 124 class ConfigReader; |
(...skipping 11 matching lines...) Expand all Loading... |
136 scoped_refptr<HostsReader> hosts_reader_; | 136 scoped_refptr<HostsReader> hosts_reader_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); | 138 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace internal | 141 } // namespace internal |
142 | 142 |
143 } // namespace net | 143 } // namespace net |
144 | 144 |
145 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ | 145 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
146 | |
OLD | NEW |