Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: net/dns/dns_config_service_posix.h

Issue 10873018: [net] Move DnsConfigService to NetworkChangeNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_config_service.cc ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class SerialWorker;
19
20 // Use DnsConfigService::CreateSystemService to use it outside of tests. 18 // Use DnsConfigService::CreateSystemService to use it outside of tests.
21 namespace internal { 19 namespace internal {
22 20
23 class NET_EXPORT_PRIVATE DnsConfigServicePosix : public DnsConfigService { 21 class NET_EXPORT_PRIVATE DnsConfigServicePosix : public DnsConfigService {
24 public: 22 public:
25 DnsConfigServicePosix(); 23 DnsConfigServicePosix();
26 virtual ~DnsConfigServicePosix(); 24 virtual ~DnsConfigServicePosix();
27 25
28 private: 26 private:
29 // NetworkChangeNotifier::DNSObserver: 27 class Watcher;
30 virtual void OnDNSChanged(unsigned detail) OVERRIDE; 28 class ConfigReader;
29 class HostsReader;
31 30
32 scoped_refptr<SerialWorker> config_reader_; 31 // DnsConfigService:
33 scoped_refptr<SerialWorker> hosts_reader_; 32 virtual void ReadNow() OVERRIDE;
33 virtual bool StartWatching() OVERRIDE;
34
35 void OnConfigChanged(bool succeeded);
36 void OnHostsChanged(bool succeeded);
37
38 scoped_ptr<Watcher> watcher_;
39 scoped_refptr<ConfigReader> config_reader_;
40 scoped_refptr<HostsReader> hosts_reader_;
34 41
35 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix); 42 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix);
36 }; 43 };
37 44
38 enum ConfigParsePosixResult { 45 enum ConfigParsePosixResult {
39 CONFIG_PARSE_POSIX_OK = 0, 46 CONFIG_PARSE_POSIX_OK = 0,
40 CONFIG_PARSE_POSIX_RES_INIT_FAILED, 47 CONFIG_PARSE_POSIX_RES_INIT_FAILED,
41 CONFIG_PARSE_POSIX_RES_INIT_UNSET, 48 CONFIG_PARSE_POSIX_RES_INIT_UNSET,
42 CONFIG_PARSE_POSIX_BAD_ADDRESS, 49 CONFIG_PARSE_POSIX_BAD_ADDRESS,
43 CONFIG_PARSE_POSIX_BAD_EXT_STRUCT, 50 CONFIG_PARSE_POSIX_BAD_EXT_STRUCT,
44 CONFIG_PARSE_POSIX_NULL_ADDRESS, 51 CONFIG_PARSE_POSIX_NULL_ADDRESS,
45 CONFIG_PARSE_POSIX_NO_NAMESERVERS, 52 CONFIG_PARSE_POSIX_NO_NAMESERVERS,
46 CONFIG_PARSE_POSIX_MISSING_OPTIONS, 53 CONFIG_PARSE_POSIX_MISSING_OPTIONS,
47 CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS, 54 CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS,
48 CONFIG_PARSE_POSIX_MAX // Bounding values for enumeration. 55 CONFIG_PARSE_POSIX_MAX // Bounding values for enumeration.
49 }; 56 };
50 57
51 // Fills in |dns_config| from |res|. 58 // Fills in |dns_config| from |res|.
52 ConfigParsePosixResult NET_EXPORT_PRIVATE ConvertResStateToDnsConfig( 59 ConfigParsePosixResult NET_EXPORT_PRIVATE ConvertResStateToDnsConfig(
53 const struct __res_state& res, DnsConfig* dns_config); 60 const struct __res_state& res, DnsConfig* dns_config);
54 61
55 } // namespace internal 62 } // namespace internal
56 63
57 } // namespace net 64 } // namespace net
58 65
59 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ 66 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_
OLDNEW
« no previous file with comments | « net/dns/dns_config_service.cc ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698