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

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

Issue 9969190: [net/dns] Watch configd notifications to detect DnsConfig changes on Mac. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added comments. Created 8 years, 8 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
« no previous file with comments | « no previous file | net/dns/dns_config_service_posix.cc » ('j') | net/dns/dns_config_service_posix.cc » ('J')
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 #pragma once 7 #pragma once
8 8
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <netinet/in.h> 10 #include <netinet/in.h>
11 #include <resolv.h> 11 #include <resolv.h>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
16 #include "net/dns/dns_config_service.h" 16 #include "net/dns/dns_config_service.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class FilePathWatcherWrapper; 20 class FilePathWatcherWrapper;
21 class NotifyWatcherMac;
21 22
22 // Use DnsConfigService::CreateSystemService to use it outside of tests. 23 // Use DnsConfigService::CreateSystemService to use it outside of tests.
23 namespace internal { 24 namespace internal {
24 25
25 class NET_EXPORT_PRIVATE DnsConfigServicePosix 26 class NET_EXPORT_PRIVATE DnsConfigServicePosix
26 : NON_EXPORTED_BASE(public DnsConfigService) { 27 : NON_EXPORTED_BASE(public DnsConfigService) {
27 public: 28 public:
28 DnsConfigServicePosix(); 29 DnsConfigServicePosix();
29 virtual ~DnsConfigServicePosix(); 30 virtual ~DnsConfigServicePosix();
30 31
31 virtual void Watch(const CallbackType& callback) OVERRIDE; 32 virtual void Watch(const CallbackType& callback) OVERRIDE;
32 33
33 private: 34 private:
34 void OnConfigChanged(bool watch_succeeded); 35 void OnConfigChanged(bool watch_succeeded);
35 void OnHostsChanged(bool watch_succeeded); 36 void OnHostsChanged(bool watch_succeeded);
36 37
37 scoped_ptr<FilePathWatcherWrapper> config_watcher_; 38 scoped_ptr<FilePathWatcherWrapper> config_watcher_;
38 scoped_ptr<FilePathWatcherWrapper> hosts_watcher_; 39 scoped_ptr<FilePathWatcherWrapper> hosts_watcher_;
40 #if defined(OS_MACOSX)
41 scoped_ptr<NotifyWatcherMac> notify_watcher_;
42 #endif
39 43
40 scoped_refptr<SerialWorker> config_reader_; 44 scoped_refptr<SerialWorker> config_reader_;
41 scoped_refptr<SerialWorker> hosts_reader_; 45 scoped_refptr<SerialWorker> hosts_reader_;
42 46
43 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix); 47 DISALLOW_COPY_AND_ASSIGN(DnsConfigServicePosix);
44 }; 48 };
45 49
46 // Fills in |dns_config| from |res|. 50 // Fills in |dns_config| from |res|.
47 bool NET_EXPORT_PRIVATE ConvertResStateToDnsConfig( 51 bool NET_EXPORT_PRIVATE ConvertResStateToDnsConfig(
48 const struct __res_state& res, DnsConfig* dns_config); 52 const struct __res_state& res, DnsConfig* dns_config);
49 53
50 } // namespace internal 54 } // namespace internal
51 55
52 } // namespace net 56 } // namespace net
53 57
54 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_ 58 #endif // NET_DNS_DNS_CONFIG_SERVICE_POSIX_H_
OLDNEW
« no previous file with comments | « no previous file | net/dns/dns_config_service_posix.cc » ('j') | net/dns/dns_config_service_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698