| Index: net/android/network_change_notifier_android.cc
|
| diff --git a/net/android/network_change_notifier_android.cc b/net/android/network_change_notifier_android.cc
|
| index 473fa644eca3a15a2904577f4f2df9087c0f5f70..66aacaf1a8edc68402fe0ff6aeaa0313415a1989 100644
|
| --- a/net/android/network_change_notifier_android.cc
|
| +++ b/net/android/network_change_notifier_android.cc
|
| @@ -9,33 +9,35 @@
|
| #include "jni/NetworkChangeNotifier_jni.h"
|
|
|
| namespace net {
|
| -namespace android {
|
|
|
| -NetworkChangeNotifier::NetworkChangeNotifier() {
|
| +NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid() {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| - CreateJavaObject(env);
|
| + java_network_change_notifier_.Reset(
|
| + Java_NetworkChangeNotifier_createInstance(
|
| + env,
|
| + base::android::GetApplicationContext(),
|
| + reinterpret_cast<jint>(this)));
|
| }
|
|
|
| -NetworkChangeNotifier::~NetworkChangeNotifier() {
|
| +NetworkChangeNotifierAndroid::~NetworkChangeNotifierAndroid() {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| - Java_NetworkChangeNotifier_destroy(
|
| - env, java_network_change_notifier_.obj());
|
| + Java_NetworkChangeNotifier_destroyInstance(env);
|
| + java_network_change_notifier_.Reset();
|
| }
|
|
|
| -void NetworkChangeNotifier::CreateJavaObject(JNIEnv* env) {
|
| - java_network_change_notifier_.Reset(
|
| - Java_NetworkChangeNotifier_create(
|
| - env,
|
| - base::android::GetApplicationContext(),
|
| - reinterpret_cast<jint>(this)));
|
| +void NetworkChangeNotifierAndroid::NotifyObserversOfConnectionTypeChange(
|
| + JNIEnv* env,
|
| + jobject obj) {
|
| + NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
|
| }
|
|
|
| -void NetworkChangeNotifier::NotifyObservers(JNIEnv* env, jobject obj) {
|
| - NotifyObserversOfConnectionTypeChange();
|
| +void NetworkChangeNotifierAndroid::ForceConnectivityState(bool state) {
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_NetworkChangeNotifier_forceConnectivityState(env, state);
|
| }
|
|
|
| -net::NetworkChangeNotifier::ConnectionType
|
| - NetworkChangeNotifier::GetCurrentConnectionType() const {
|
| +NetworkChangeNotifier::ConnectionType
|
| + NetworkChangeNotifierAndroid::GetCurrentConnectionType() const {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
|
|
| // Pull the connection type from the Java-side then convert it to a
|
| @@ -64,9 +66,8 @@ net::NetworkChangeNotifier::ConnectionType
|
| }
|
|
|
| // static
|
| -bool NetworkChangeNotifier::Register(JNIEnv* env) {
|
| +bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) {
|
| return RegisterNativesImpl(env);
|
| }
|
|
|
| -} // namespace android
|
| } // namespace net
|
|
|