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_ANDROID_H_ | 5 #ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
6 #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ | 6 #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "net/base/network_change_notifier.h" | 12 #include "net/base/network_change_notifier.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class NetworkChangeNotifierAndroidTest; | 16 class NetworkChangeNotifierAndroidTest; |
17 | 17 |
18 class NetworkChangeNotifierAndroid : public NetworkChangeNotifier { | 18 class NET_EXPORT NetworkChangeNotifierAndroid : public NetworkChangeNotifier { |
19 public: | 19 public: |
20 virtual ~NetworkChangeNotifierAndroid(); | 20 virtual ~NetworkChangeNotifierAndroid(); |
21 | 21 |
22 // Called from Java on the UI thread. | 22 // Called from Java on the UI thread. |
23 void NotifyObserversOfConnectionTypeChange( | 23 void NotifyObserversOfConnectionTypeChange( |
24 JNIEnv* env, jobject obj, jint new_connection_type); | 24 JNIEnv* env, jobject obj, jint new_connection_type); |
25 jint GetConnectionType(JNIEnv* env, jobject obj); | 25 jint GetConnectionType(JNIEnv* env, jobject obj); |
26 | 26 |
27 static bool Register(JNIEnv* env); | 27 static bool Register(JNIEnv* env); |
28 | 28 |
(...skipping 17 matching lines...) Expand all Loading... |
46 mutable base::Lock lock_; // Protects the state below. | 46 mutable base::Lock lock_; // Protects the state below. |
47 // Written from the UI thread, read from any thread. | 47 // Written from the UI thread, read from any thread. |
48 int connection_type_; | 48 int connection_type_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); | 50 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace net | 53 } // namespace net |
54 | 54 |
55 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ | 55 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
OLD | NEW |