| 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 #include "net/android/network_change_notifier_delegate_android.h" | 5 #include "net/android/network_change_notifier_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "jni/NetworkChangeNotifier_jni.h" | 10 #include "jni/NetworkChangeNotifier_jni.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return ConnectionType::CONNECTION_UNKNOWN; | 135 return ConnectionType::CONNECTION_UNKNOWN; |
| 136 return network_entry->second; | 136 return network_entry->second; |
| 137 } | 137 } |
| 138 | 138 |
| 139 NetworkChangeNotifier::NetworkHandle | 139 NetworkChangeNotifier::NetworkHandle |
| 140 NetworkChangeNotifierDelegateAndroid::GetCurrentDefaultNetwork() const { | 140 NetworkChangeNotifierDelegateAndroid::GetCurrentDefaultNetwork() const { |
| 141 base::AutoLock auto_lock(connection_lock_); | 141 base::AutoLock auto_lock(connection_lock_); |
| 142 return default_network_; | 142 return default_network_; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool NetworkChangeNotifierDelegateAndroid::GetCurrentNetworkCaptivePortal() |
| 146 const { |
| 147 return Java_NetworkChangeNotifier_getCurrentNetworkCaptivePortal( |
| 148 base::android::AttachCurrentThread(), java_network_change_notifier_); |
| 149 } |
| 150 |
| 145 void NetworkChangeNotifierDelegateAndroid::GetCurrentlyConnectedNetworks( | 151 void NetworkChangeNotifierDelegateAndroid::GetCurrentlyConnectedNetworks( |
| 146 NetworkList* network_list) const { | 152 NetworkList* network_list) const { |
| 147 network_list->clear(); | 153 network_list->clear(); |
| 148 base::AutoLock auto_lock(connection_lock_); | 154 base::AutoLock auto_lock(connection_lock_); |
| 149 for (auto i : network_map_) | 155 for (auto i : network_map_) |
| 150 network_list->push_back(i.first); | 156 network_list->push_back(i.first); |
| 151 } | 157 } |
| 152 | 158 |
| 153 void NetworkChangeNotifierDelegateAndroid::NotifyConnectionTypeChanged( | 159 void NetworkChangeNotifierDelegateAndroid::NotifyConnectionTypeChanged( |
| 154 JNIEnv* env, | 160 JNIEnv* env, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 Java_NetworkChangeNotifier_fakeDefaultNetwork(env, network, type); | 370 Java_NetworkChangeNotifier_fakeDefaultNetwork(env, network, type); |
| 365 } | 371 } |
| 366 | 372 |
| 367 void NetworkChangeNotifierDelegateAndroid::FakeMaxBandwidthChanged( | 373 void NetworkChangeNotifierDelegateAndroid::FakeMaxBandwidthChanged( |
| 368 double max_bandwidth_mbps) { | 374 double max_bandwidth_mbps) { |
| 369 JNIEnv* env = base::android::AttachCurrentThread(); | 375 JNIEnv* env = base::android::AttachCurrentThread(); |
| 370 Java_NetworkChangeNotifier_fakeMaxBandwidthChanged(env, max_bandwidth_mbps); | 376 Java_NetworkChangeNotifier_fakeMaxBandwidthChanged(env, max_bandwidth_mbps); |
| 371 } | 377 } |
| 372 | 378 |
| 373 } // namespace net | 379 } // namespace net |
| OLD | NEW |