| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "jni/NetworkChangeNotifier_jni.h" | 8 #include "jni/NetworkChangeNotifier_jni.h" |
| 9 #include "net/android/network_change_notifier_android.h" | 9 #include "net/android/network_change_notifier_android.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 jdouble GetMaxBandwidthForConnectionSubtype(JNIEnv* env, | 47 jdouble GetMaxBandwidthForConnectionSubtype(JNIEnv* env, |
| 48 jclass caller, | 48 jclass caller, |
| 49 jint subtype) { | 49 jint subtype) { |
| 50 return NetworkChangeNotifierAndroid::GetMaxBandwidthForConnectionSubtype( | 50 return NetworkChangeNotifierAndroid::GetMaxBandwidthForConnectionSubtype( |
| 51 ConvertConnectionSubtype(subtype)); | 51 ConvertConnectionSubtype(subtype)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 NetworkChangeNotifierDelegateAndroid::NetworkChangeNotifierDelegateAndroid() | 54 NetworkChangeNotifierDelegateAndroid::NetworkChangeNotifierDelegateAndroid() |
| 55 : observers_(new ObserverListThreadSafe<Observer>()) { | 55 : observers_(new base::ObserverListThreadSafe<Observer>()) { |
| 56 JNIEnv* env = base::android::AttachCurrentThread(); | 56 JNIEnv* env = base::android::AttachCurrentThread(); |
| 57 java_network_change_notifier_.Reset( | 57 java_network_change_notifier_.Reset( |
| 58 Java_NetworkChangeNotifier_init( | 58 Java_NetworkChangeNotifier_init( |
| 59 env, base::android::GetApplicationContext())); | 59 env, base::android::GetApplicationContext())); |
| 60 Java_NetworkChangeNotifier_addNativeObserver( | 60 Java_NetworkChangeNotifier_addNativeObserver( |
| 61 env, java_network_change_notifier_.obj(), | 61 env, java_network_change_notifier_.obj(), |
| 62 reinterpret_cast<intptr_t>(this)); | 62 reinterpret_cast<intptr_t>(this)); |
| 63 SetCurrentConnectionType( | 63 SetCurrentConnectionType( |
| 64 ConvertConnectionType( | 64 ConvertConnectionType( |
| 65 Java_NetworkChangeNotifier_getCurrentConnectionType( | 65 Java_NetworkChangeNotifier_getCurrentConnectionType( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 JNIEnv* env = base::android::AttachCurrentThread(); | 148 JNIEnv* env = base::android::AttachCurrentThread(); |
| 149 Java_NetworkChangeNotifier_forceConnectivityState(env, true); | 149 Java_NetworkChangeNotifier_forceConnectivityState(env, true); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void NetworkChangeNotifierDelegateAndroid::SetOffline() { | 152 void NetworkChangeNotifierDelegateAndroid::SetOffline() { |
| 153 JNIEnv* env = base::android::AttachCurrentThread(); | 153 JNIEnv* env = base::android::AttachCurrentThread(); |
| 154 Java_NetworkChangeNotifier_forceConnectivityState(env, false); | 154 Java_NetworkChangeNotifier_forceConnectivityState(env, false); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace net | 157 } // namespace net |
| OLD | NEW |