summaryrefslogtreecommitdiffstats
path: root/net/base/network_change_notifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/network_change_notifier.h')
-rw-r--r--net/base/network_change_notifier.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h
index f487501..477d1f7 100644
--- a/net/base/network_change_notifier.h
+++ b/net/base/network_change_notifier.h
@@ -8,12 +8,17 @@
#include "base/basictypes.h"
#include "base/observer_list_threadsafe.h"
+#include "base/synchronization/lock.h"
#include "net/base/net_export.h"
namespace net {
class NetworkChangeNotifierFactory;
+namespace internal {
+class DnsConfigWatcher;
+}
+
// NetworkChangeNotifier monitors the system for network changes, and notifies
// registered observers of those events. Observers may register on any thread,
// and will be called back on the thread from which they registered.
@@ -27,8 +32,10 @@ class NET_EXPORT NetworkChangeNotifier {
CHANGE_DNS_SETTINGS = 1 << 0,
// The HOSTS file has changed.
CHANGE_DNS_HOSTS = 1 << 1,
- // Computer name has changed.
- CHANGE_DNS_LOCALHOST = 1 << 2,
+ // The watcher has started.
+ CHANGE_DNS_WATCH_STARTED = 1 << 2,
+ // The watcher has failed and will not be available until further notice.
+ CHANGE_DNS_WATCH_FAILED = 1 << 3,
};
class NET_EXPORT IPAddressObserver {
@@ -105,6 +112,9 @@ class NET_EXPORT NetworkChangeNotifier {
// will be successfully.
static bool IsOffline();
+ // Returns true if DNS watcher is operational.
+ static bool IsWatchingDNS();
+
// Like Create(), but for use in tests. The mock object doesn't monitor any
// events, it merely rebroadcasts notifications when requested.
static NetworkChangeNotifier* CreateMock();
@@ -135,6 +145,8 @@ class NET_EXPORT NetworkChangeNotifier {
}
protected:
+ friend class internal::DnsConfigWatcher;
+
NetworkChangeNotifier();
// Broadcasts a notification to all registered observers. Note that this
@@ -172,6 +184,13 @@ class NET_EXPORT NetworkChangeNotifier {
const scoped_refptr<ObserverListThreadSafe<DNSObserver> >
resolver_state_observer_list_;
+ // True iff DNS watchers are operational.
+ // Otherwise, OnDNSChanged might not be issued for future changes.
+ // TODO(szym): This is a temporary interface, consider restarting them.
+ // http://crbug.com/116139
+ base::Lock watching_dns_lock_;
+ bool watching_dns_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
};