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

Unified Diff: chromeos/network/network_change_notifier_chromeos.cc

Issue 12634019: NetworkChangeNotifierChromeos: Handle IPConfig property changes on the default network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 9 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
Index: chromeos/network/network_change_notifier_chromeos.cc
diff --git a/chromeos/network/network_change_notifier_chromeos.cc b/chromeos/network/network_change_notifier_chromeos.cc
index 2510735562d5b098570b174192672c9fb259553d..2980ff82d5900e58592ffc024320638b9e2bc49f 100644
--- a/chromeos/network/network_change_notifier_chromeos.cc
+++ b/chromeos/network/network_change_notifier_chromeos.cc
@@ -111,21 +111,19 @@ void NetworkChangeNotifierChromeos::UpdateState(
*connection_type_changed = false;
*ip_address_changed = false;
*dns_changed = false;
- // TODO(gauravsh): DNS changes will be detected once ip config
- // support is hooked into NetworkStateHandler. For now,
- // we report a DNS change on changes to the default network (including
- // loss).
if (!default_network || !default_network->IsConnectedState()) {
// If we lost a default network, we must update our state and notify
- // observers, otherwise we have nothing do. (Under normal circumstances,
+ // observers, otherwise we have nothing to do. (Under normal circumstances,
// we should never get duplicate no default network notifications).
if (connection_type_ != CONNECTION_NONE) {
+ VLOG(1) << "Lost default network!";
*ip_address_changed = true;
*dns_changed = true;
*connection_type_changed = true;
connection_type_ = CONNECTION_NONE;
service_path_.clear();
ip_address_.clear();
+ dns_servers_.clear();
}
return;
}
@@ -138,20 +136,31 @@ void NetworkChangeNotifierChromeos::UpdateState(
VLOG(1) << "Connection type changed from " << connection_type_ << " -> "
<< new_connection_type;
*connection_type_changed = true;
- *dns_changed = true;
}
- if (default_network->path() != service_path_ ||
- default_network->ip_address() != ip_address_) {
+ if (default_network->path() != service_path_) {
VLOG(1) << "Service path changed from " << service_path_ << " -> "
<< default_network->path();
+ // If we had a default network service change, network resources
+ // must always be invalidated.
+ *ip_address_changed = true;
+ *dns_changed = true;
+ }
+ if (default_network->ip_address() != ip_address_) {
VLOG(1) << "IP Address changed from " << ip_address_ << " -> "
<< default_network->ip_address();
*ip_address_changed = true;
+ }
+ if (default_network->dns_servers() != dns_servers_) {
+ VLOG(1) <<"DNS servers changed. New DNS servers are:";
+ for (size_t i = 0; i < default_network->dns_servers().size(); ++i)
+ VLOG(1) << default_network->dns_servers()[i] << ",";
stevenjb 2013/03/29 00:21:36 Hey look: base::JoinString(default_network->dns_se
gauravsh 2013/03/29 00:41:50 Done.
*dns_changed = true;
}
+
connection_type_ = new_connection_type;
service_path_ = default_network->path();
ip_address_ = default_network->ip_address();
+ dns_servers_ = default_network->dns_servers();
}
// static

Powered by Google App Engine
This is Rietveld 408576698