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

Unified Diff: net/base/network_change_notifier.h

Issue 10377092: [net/dns] Isolate DnsConfigWatcher from DnsConfigService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added sanity DCHECK. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/network_change_notifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.h
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h
index f4875015e48532b15d71bd94da6c8d00d9f36da7..477d1f718cd6114710dd1b0ea5e374273025061e 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);
};
« no previous file with comments | « no previous file | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698