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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 NetworkChangeNotifier::NetworkList* networks) const { | 166 NetworkChangeNotifier::NetworkList* networks) const { |
167 delegate_->GetCurrentlyConnectedNetworks(networks); | 167 delegate_->GetCurrentlyConnectedNetworks(networks); |
168 } | 168 } |
169 | 169 |
170 NetworkChangeNotifier::ConnectionType | 170 NetworkChangeNotifier::ConnectionType |
171 NetworkChangeNotifierAndroid::GetCurrentNetworkConnectionType( | 171 NetworkChangeNotifierAndroid::GetCurrentNetworkConnectionType( |
172 NetworkHandle network) const { | 172 NetworkHandle network) const { |
173 return delegate_->GetNetworkConnectionType(network); | 173 return delegate_->GetNetworkConnectionType(network); |
174 } | 174 } |
175 | 175 |
176 NetworkChangeNotifier::NetworkHandle | 176 int NetworkChangeNotifierAndroid::GetCurrentDefaultNetwork( |
177 NetworkChangeNotifierAndroid::GetCurrentDefaultNetwork() const { | 177 NetworkChangeNotifier::NetworkHandle* network) const { |
178 return delegate_->GetCurrentDefaultNetwork(); | 178 if (base::android::BuildInfo::GetInstance()->sdk_int() < |
| 179 base::android::SDK_VERSION_LOLLIPOP) { |
| 180 return ERR_NOT_IMPLEMENTED; |
| 181 } |
| 182 *network = delegate_->GetCurrentDefaultNetwork(); |
| 183 return OK; |
179 } | 184 } |
180 | 185 |
181 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged() { | 186 void NetworkChangeNotifierAndroid::OnConnectionTypeChanged() { |
182 DnsConfigServiceThread::NotifyNetworkChangeNotifierObservers(); | 187 DnsConfigServiceThread::NotifyNetworkChangeNotifierObservers(); |
183 } | 188 } |
184 | 189 |
185 void NetworkChangeNotifierAndroid::OnMaxBandwidthChanged( | 190 void NetworkChangeNotifierAndroid::OnMaxBandwidthChanged( |
186 double max_bandwidth_mbps, | 191 double max_bandwidth_mbps, |
187 ConnectionType type) { | 192 ConnectionType type) { |
188 NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange(max_bandwidth_mbps, | 193 NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange(max_bandwidth_mbps, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // so delay IPAddressChanged so they get merged with the following | 247 // so delay IPAddressChanged so they get merged with the following |
243 // ConnectionTypeChanged signal. | 248 // ConnectionTypeChanged signal. |
244 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); | 249 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); |
245 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); | 250 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); |
246 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); | 251 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); |
247 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); | 252 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); |
248 return params; | 253 return params; |
249 } | 254 } |
250 | 255 |
251 } // namespace net | 256 } // namespace net |
OLD | NEW |