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

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: sync Created 8 years, 3 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.h » ('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 dd1c6f0f99abbbef9ecfbeb663e389ad2c4d9525..661f537a86c0fa84ff62187a9a78f91da615f2a4 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::internal::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),
@@ -48,12 +70,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;
@@ -127,6 +155,8 @@ void NetworkChangeNotifierChromeos::UpdateNetworkState(
service_path_ = network->service_path();
ip_address_ = network->ip_address();
}
+ // TODO(szym): detect user DNS changes. http://crbug.com/148394
+ dns_config_service_->OnNetworkChange();
UpdateConnectivityState(network);
// If there is an active network, add observer to track its changes.
if (network)
« no previous file with comments | « chrome/browser/chromeos/net/network_change_notifier_chromeos.h ('k') | net/dns/dns_config_service_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698