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

Unified Diff: net/android/network_change_notifier_android.cc

Issue 11628008: Provide NetworkChangeNotifierAndroid with the actual initial connection type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try another approach Created 8 years 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: net/android/network_change_notifier_android.cc
diff --git a/net/android/network_change_notifier_android.cc b/net/android/network_change_notifier_android.cc
index 6dce66981fbd921bc2d1bedbae3e26b73becd735..d297ad5638657c104d2defe45a12352146b95707 100644
--- a/net/android/network_change_notifier_android.cc
+++ b/net/android/network_change_notifier_android.cc
@@ -73,9 +73,12 @@ NetworkChangeNotifierAndroid::GetCurrentConnectionType() const {
void NetworkChangeNotifierAndroid::OnConnectionTypeChanged(
ConnectionType new_connection_type) {
- SetConnectionType(new_connection_type);
- NetworkChangeNotifier::NotifyObserversOfIPAddressChange();
- NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
+ ConnectionType previous_connection_type = SetConnectionType(
+ new_connection_type);
+ if (new_connection_type != previous_connection_type) {
+ NetworkChangeNotifier::NotifyObserversOfIPAddressChange();
+ NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
+ }
}
// static
@@ -105,10 +108,13 @@ NetworkChangeNotifierAndroid::NetworkChangeCalculatorParamsAndroid() {
return params;
}
-void NetworkChangeNotifierAndroid::SetConnectionType(
+NetworkChangeNotifier::ConnectionType
+NetworkChangeNotifierAndroid::SetConnectionType(
ConnectionType new_connection_type) {
base::AutoLock auto_lock(connection_type_lock_);
+ ConnectionType previous_connection_type = connection_type_;
connection_type_ = new_connection_type;
+ return previous_connection_type;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698