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

Side by Side Diff: net/android/network_change_notifier_android.cc

Issue 11411287: Send 'IP address changed' events on Android when connection type changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 //////////////////////////////////////////////////////////////////////////////// 5 ////////////////////////////////////////////////////////////////////////////////
6 // Threading considerations: 6 // Threading considerations:
7 // 7 //
8 // This class is designed to meet various threading guarantees starting from the 8 // This class is designed to meet various threading guarantees starting from the
9 // ones imposed by NetworkChangeNotifier: 9 // ones imposed by NetworkChangeNotifier:
10 // - The notifier can be constructed on any thread. 10 // - The notifier can be constructed on any thread.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 NetworkChangeNotifier::ConnectionType 68 NetworkChangeNotifier::ConnectionType
69 NetworkChangeNotifierAndroid::GetCurrentConnectionType() const { 69 NetworkChangeNotifierAndroid::GetCurrentConnectionType() const {
70 base::AutoLock auto_lock(connection_type_lock_); 70 base::AutoLock auto_lock(connection_type_lock_);
71 return connection_type_; 71 return connection_type_;
72 } 72 }
73 73
74 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged( 74 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged(
75 ConnectionType new_connection_type) { 75 ConnectionType new_connection_type) {
76 SetConnectionType(new_connection_type); 76 SetConnectionType(new_connection_type);
77 NetworkChangeNotifier::NotifyObserversOfIPAddressChange();
77 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); 78 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
78 } 79 }
79 80
80 // static 81 // static
81 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) { 82 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) {
82 return NetworkChangeNotifierDelegateAndroid::Register(env); 83 return NetworkChangeNotifierDelegateAndroid::Register(env);
83 } 84 }
84 85
85 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid( 86 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid(
86 NetworkChangeNotifierDelegateAndroid* delegate) 87 NetworkChangeNotifierDelegateAndroid* delegate)
87 : delegate_(delegate) { 88 : delegate_(delegate) {
88 SetConnectionType(NetworkChangeNotifier::CONNECTION_UNKNOWN); 89 SetConnectionType(NetworkChangeNotifier::CONNECTION_UNKNOWN);
89 delegate_->AddObserver(this); 90 delegate_->AddObserver(this);
90 } 91 }
91 92
92 void NetworkChangeNotifierAndroid::SetConnectionType( 93 void NetworkChangeNotifierAndroid::SetConnectionType(
93 ConnectionType new_connection_type) { 94 ConnectionType new_connection_type) {
94 base::AutoLock auto_lock(connection_type_lock_); 95 base::AutoLock auto_lock(connection_type_lock_);
95 connection_type_ = new_connection_type; 96 connection_type_ = new_connection_type;
96 } 97 }
97 98
98 } // namespace net 99 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698