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