Chromium Code Reviews| 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. |
| 11 // - GetCurrentConnectionType() can be called on any thread. | 11 // - GetCurrentConnectionType() can be called on any thread. |
|
Not at Google. Contact bengr
2016/06/23 20:08:56
Should GetCurrentWiFiSSID be added here as well? A
tbansal1
2016/06/27 19:48:20
Not sure if it is necessary since this is sort of
| |
| 12 // | 12 // |
| 13 // The fact that this implementation of NetworkChangeNotifier is backed by a | 13 // The fact that this implementation of NetworkChangeNotifier is backed by a |
| 14 // Java side singleton class (see NetworkChangeNotifier.java) adds another | 14 // Java side singleton class (see NetworkChangeNotifier.java) adds another |
| 15 // threading constraint: | 15 // threading constraint: |
| 16 // - The calls to the Java side (stateful) object must be performed from a | 16 // - The calls to the Java side (stateful) object must be performed from a |
| 17 // single thread. This object happens to be a singleton which is used on the | 17 // single thread. This object happens to be a singleton which is used on the |
| 18 // application side on the main thread. Therefore all the method calls from | 18 // application side on the main thread. Therefore all the method calls from |
| 19 // the native NetworkChangeNotifierAndroid class to its Java counterpart are | 19 // the native NetworkChangeNotifierAndroid class to its Java counterpart are |
| 20 // performed on the main thread. | 20 // performed on the main thread. |
| 21 // | 21 // |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 return delegate_->GetCurrentConnectionType(); | 160 return delegate_->GetCurrentConnectionType(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void NetworkChangeNotifierAndroid::GetCurrentMaxBandwidthAndConnectionType( | 163 void NetworkChangeNotifierAndroid::GetCurrentMaxBandwidthAndConnectionType( |
| 164 double* max_bandwidth_mbps, | 164 double* max_bandwidth_mbps, |
| 165 ConnectionType* connection_type) const { | 165 ConnectionType* connection_type) const { |
| 166 delegate_->GetCurrentMaxBandwidthAndConnectionType(max_bandwidth_mbps, | 166 delegate_->GetCurrentMaxBandwidthAndConnectionType(max_bandwidth_mbps, |
| 167 connection_type); | 167 connection_type); |
| 168 } | 168 } |
| 169 | 169 |
| 170 std::string NetworkChangeNotifierAndroid::GetCurrentWiFiSSID() const { | |
| 171 return delegate_->GetCurrentWiFiSSID(); | |
| 172 } | |
| 173 | |
| 170 void NetworkChangeNotifierAndroid::ForceNetworkHandlesSupportedForTesting() { | 174 void NetworkChangeNotifierAndroid::ForceNetworkHandlesSupportedForTesting() { |
| 171 force_network_handles_supported_for_testing_ = true; | 175 force_network_handles_supported_for_testing_ = true; |
| 172 } | 176 } |
| 173 | 177 |
| 174 bool NetworkChangeNotifierAndroid::AreNetworkHandlesCurrentlySupported() const { | 178 bool NetworkChangeNotifierAndroid::AreNetworkHandlesCurrentlySupported() const { |
| 175 // Notifications for API using NetworkHandles and querying using | 179 // Notifications for API using NetworkHandles and querying using |
| 176 // NetworkHandles only implemented for Android versions >= L. | 180 // NetworkHandles only implemented for Android versions >= L. |
| 177 return force_network_handles_supported_for_testing_ || | 181 return force_network_handles_supported_for_testing_ || |
| 178 (base::android::BuildInfo::GetInstance()->sdk_int() >= | 182 (base::android::BuildInfo::GetInstance()->sdk_int() >= |
| 179 base::android::SDK_VERSION_LOLLIPOP); | 183 base::android::SDK_VERSION_LOLLIPOP); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 NetworkChangeNotifier::GetConnectionType(); | 279 NetworkChangeNotifier::GetConnectionType(); |
| 276 NetworkChangeNotifier::LogOperatorCodeHistogram(type); | 280 NetworkChangeNotifier::LogOperatorCodeHistogram(type); |
| 277 if (NetworkChangeNotifier::IsConnectionCellular(type)) { | 281 if (NetworkChangeNotifier::IsConnectionCellular(type)) { |
| 278 UMA_HISTOGRAM_ENUMERATION("NCN.CellularConnectionSubtype", | 282 UMA_HISTOGRAM_ENUMERATION("NCN.CellularConnectionSubtype", |
| 279 delegate_->GetCurrentConnectionSubtype(), | 283 delegate_->GetCurrentConnectionSubtype(), |
| 280 SUBTYPE_LAST + 1); | 284 SUBTYPE_LAST + 1); |
| 281 } | 285 } |
| 282 } | 286 } |
| 283 | 287 |
| 284 } // namespace net | 288 } // namespace net |
| OLD | NEW |