OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_DNS_DNS_CONFIG_WATCHER_H_ |
| 6 #define NET_DNS_DNS_CONFIG_WATCHER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 namespace net { |
| 13 namespace internal { |
| 14 |
| 15 // Watches when the system DNS settings have changed. It is used by |
| 16 // NetworkChangeNotifier to provide signals to registered DNSObservers. |
| 17 // Depending on the platform, watches files, Windows registry, or libnotify key. |
| 18 // If some watches fail, we keep the working parts, but NetworkChangeNotifier |
| 19 // will mark notifications to DNSObserver with the CHANGE_DNS_WATCH_FAILED bit. |
| 20 class DnsConfigWatcher { |
| 21 public: |
| 22 DnsConfigWatcher(); |
| 23 ~DnsConfigWatcher(); |
| 24 |
| 25 // Starts watching system configuration for changes. The current thread must |
| 26 // have a MessageLoopForIO. The signals will be delivered directly to |
| 27 // the global NetworkChangeNotifier. |
| 28 void Init(); |
| 29 |
| 30 // Must be called on the same thread as Init. Required if dtor will be called |
| 31 // on a different thread. |
| 32 void CleanUp(); |
| 33 |
| 34 private: |
| 35 // Platform-specific implementation. |
| 36 class Core; |
| 37 scoped_ptr<Core> core_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(DnsConfigWatcher); |
| 40 }; |
| 41 |
| 42 } // namespace internal |
| 43 } // namespace net |
| 44 |
| 45 #endif // NET_DNS_DNS_CONFIG_WATCHER_H_ |
OLD | NEW |