| 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 #ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_ANDROID_H_ | 5 #ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_ANDROID_H_ |
| 6 #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_ANDROID_H_ | 6 #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/observer_list_threadsafe.h" | 11 #include "base/observer_list_threadsafe.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "net/base/network_change_notifier.h" | 13 #include "net/base/network_change_notifier.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 // Delegate used to thread-safely notify NetworkChangeNotifierAndroid whenever a | 17 // Delegate used to thread-safely notify NetworkChangeNotifierAndroid whenever a |
| 18 // network connection change notification is signaled by the Java side (on the | 18 // network connection change notification is signaled by the Java side (on the |
| 19 // JNI thread). | 19 // JNI thread). |
| 20 // All the methods exposed below must be called exclusively on the JNI thread | 20 // All the methods exposed below must be called exclusively on the JNI thread |
| 21 // unless otherwise stated (e.g. AddObserver()/RemoveObserver()). | 21 // unless otherwise stated (e.g. AddObserver()/RemoveObserver()). |
| 22 class NetworkChangeNotifierDelegateAndroid { | 22 class NET_EXPORT_PRIVATE NetworkChangeNotifierDelegateAndroid { |
| 23 public: | 23 public: |
| 24 enum ConnectivityState { | 24 enum ConnectivityState { |
| 25 OFFLINE, | 25 OFFLINE, |
| 26 ONLINE, | 26 ONLINE, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Observer interface implemented by NetworkChangeNotifierAndroid which | 29 // Observer interface implemented by NetworkChangeNotifierAndroid which |
| 30 // subscribes to network change notifications fired by the delegate (and | 30 // subscribes to network change notifications fired by the delegate (and |
| 31 // initiated by the Java side). | 31 // initiated by the Java side). |
| 32 class Observer { | 32 class Observer { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 scoped_refptr<base::SingleThreadTaskRunner> jni_task_runner_; | 71 scoped_refptr<base::SingleThreadTaskRunner> jni_task_runner_; |
| 72 base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_; | 72 base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_; |
| 73 ConnectionType connection_type_; | 73 ConnectionType connection_type_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierDelegateAndroid); | 75 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierDelegateAndroid); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace net | 78 } // namespace net |
| 79 | 79 |
| 80 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_H_ | 80 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_H_ |
| OLD | NEW |