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

Unified Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.cc

Issue 10909034: [cros/net] Add DnsConfigService to NetworkChangeNotifierChromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « chrome/browser/chromeos/net/network_change_notifier_chromeos.h ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/network_change_notifier_chromeos.cc
diff --git a/chrome/browser/chromeos/net/network_change_notifier_chromeos.cc b/chrome/browser/chromeos/net/network_change_notifier_chromeos.cc
index 2007857481c882223e8470fd075f7715810fe46d..ddd55a1ecbde022add4d9928890d9f99c1b1879a 100644
--- a/chrome/browser/chromeos/net/network_change_notifier_chromeos.cc
+++ b/chrome/browser/chromeos/net/network_change_notifier_chromeos.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "net/dns/dns_config_service_posix.h"
using content::BrowserThread;
@@ -26,6 +27,27 @@ bool IsOnline(chromeos::ConnectionState state) {
namespace chromeos {
+class NetworkChangeNotifierChromeos::DnsConfigServiceChromeos
+ : public net::DnsConfigServicePosix {
+ public:
+ DnsConfigServiceChromeos() {}
+
+ virtual ~DnsConfigServiceChromeos() {}
+
+ // net::DnsConfigServicePosix:
+ virtual bool StartWatching() OVERRIDE {
+ // Notifications from NetworkLibrary are sent to
+ // NetworkChangeNotifierChromeos.
+ return true;
+ }
+
+ void OnNetworkChange() {
+ InvalidateConfig();
+ InvalidateHosts();
+ ReadNow();
+ }
+};
+
NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos()
: has_active_network_(false),
connection_state_(chromeos::STATE_UNKNOWN),
@@ -49,12 +71,18 @@ void NetworkChangeNotifierChromeos::Init() {
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
+ dns_config_service_.reset(new DnsConfigServiceChromeos());
+ dns_config_service_->WatchConfig(
+ base::Bind(NetworkChangeNotifier::SetDnsConfig));
+
UpdateNetworkState(network_library);
}
void NetworkChangeNotifierChromeos::Shutdown() {
weak_factory_.InvalidateWeakPtrs();
+ dns_config_service_.reset();
+
if (!chromeos::CrosLibrary::Get())
return;
@@ -112,6 +140,8 @@ void NetworkChangeNotifierChromeos::UpdateNetworkState(
<< ", state= " << network->state();
}
+ dns_config_service_->OnNetworkChange();
zel 2012/09/04 17:16:11 This will fire way too often for what you are tryi
szym 2012/09/04 17:29:31 How often does this fire? If I correctly understa
zel 2012/09/05 19:26:59 For an active network this will fire when any of i
szym 2012/09/05 19:48:29 That is indeed a bit too often, but note that this
+
// Check if active network was added, removed or changed.
if ((!network && has_active_network_) ||
(network && (!has_active_network_ ||
« no previous file with comments | « chrome/browser/chromeos/net/network_change_notifier_chromeos.h ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698