OLD | NEW |
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 Loading... |
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 |
OLD | NEW |