| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 NetworkChangeNotifierAndroid::~NetworkChangeNotifierAndroid() { | 138 NetworkChangeNotifierAndroid::~NetworkChangeNotifierAndroid() { |
| 139 delegate_->RemoveObserver(this); | 139 delegate_->RemoveObserver(this); |
| 140 } | 140 } |
| 141 | 141 |
| 142 NetworkChangeNotifier::ConnectionType | 142 NetworkChangeNotifier::ConnectionType |
| 143 NetworkChangeNotifierAndroid::GetCurrentConnectionType() const { | 143 NetworkChangeNotifierAndroid::GetCurrentConnectionType() const { |
| 144 return delegate_->GetCurrentConnectionType(); | 144 return delegate_->GetCurrentConnectionType(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 double NetworkChangeNotifierAndroid::GetCurrentMaxBandwidth() const { | 147 void NetworkChangeNotifierAndroid::GetCurrentMaxBandwidthAndConnectionType( |
| 148 return delegate_->GetCurrentMaxBandwidth(); | 148 double* max_bandwidth_mbps, |
| 149 ConnectionType* connection_type) const { |
| 150 delegate_->GetCurrentMaxBandwidthAndConnectionType(max_bandwidth_mbps, |
| 151 connection_type); |
| 149 } | 152 } |
| 150 | 153 |
| 151 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged() { | 154 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged() { |
| 152 DnsConfigServiceThread::NotifyNetworkChangeNotifierObservers(); | 155 DnsConfigServiceThread::NotifyNetworkChangeNotifierObservers(); |
| 153 } | 156 } |
| 154 | 157 |
| 155 void NetworkChangeNotifierAndroid::OnMaxBandwidthChanged( | 158 void NetworkChangeNotifierAndroid::OnMaxBandwidthChanged( |
| 159 ConnectionType type, |
| 156 double max_bandwidth_mbps) { | 160 double max_bandwidth_mbps) { |
| 157 NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange( | 161 NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange( |
| 158 max_bandwidth_mbps); | 162 type, max_bandwidth_mbps); |
| 159 } | 163 } |
| 160 | 164 |
| 161 // static | 165 // static |
| 162 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) { | 166 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) { |
| 163 return NetworkChangeNotifierDelegateAndroid::Register(env); | 167 return NetworkChangeNotifierDelegateAndroid::Register(env); |
| 164 } | 168 } |
| 165 | 169 |
| 166 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid( | 170 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid( |
| 167 NetworkChangeNotifierDelegateAndroid* delegate, | 171 NetworkChangeNotifierDelegateAndroid* delegate, |
| 168 const DnsConfig* dns_config_for_testing) | 172 const DnsConfig* dns_config_for_testing) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 187 // so delay IPAddressChanged so they get merged with the following | 191 // so delay IPAddressChanged so they get merged with the following |
| 188 // ConnectionTypeChanged signal. | 192 // ConnectionTypeChanged signal. |
| 189 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); | 193 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); |
| 190 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); | 194 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); |
| 191 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); | 195 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); |
| 192 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); | 196 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); |
| 193 return params; | 197 return params; |
| 194 } | 198 } |
| 195 | 199 |
| 196 } // namespace net | 200 } // namespace net |
| OLD | NEW |