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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 private: | 29 private: |
30 friend class NetworkChangeNotifierAndroidTest; | 30 friend class NetworkChangeNotifierAndroidTest; |
31 friend class NetworkChangeNotifierFactoryAndroid; | 31 friend class NetworkChangeNotifierFactoryAndroid; |
32 | 32 |
33 NetworkChangeNotifierAndroid(); | 33 NetworkChangeNotifierAndroid(); |
34 | 34 |
35 void SetConnectionType(int connection_type); | 35 void SetConnectionType(int connection_type); |
36 | 36 |
37 void ForceConnectivityState(bool state); | 37 void ForceConnectivityState(bool state); |
38 | 38 |
| 39 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); |
| 40 |
39 // NetworkChangeNotifier: | 41 // NetworkChangeNotifier: |
40 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; | 42 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; |
41 | 43 |
42 base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_; | 44 base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_; |
43 // TODO(pliard): http://crbug.com/150867. Use an atomic integer for the | 45 // TODO(pliard): http://crbug.com/150867. Use an atomic integer for the |
44 // connection type without the lock once a non-subtle atomic integer is | 46 // connection type without the lock once a non-subtle atomic integer is |
45 // available under base/. That might never happen though. | 47 // available under base/. That might never happen though. |
46 mutable base::Lock lock_; // Protects the state below. | 48 mutable base::Lock lock_; // Protects the state below. |
47 // Written from the UI thread, read from any thread. | 49 // Written from the UI thread, read from any thread. |
48 int connection_type_; | 50 int connection_type_; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); | 52 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); |
51 }; | 53 }; |
52 | 54 |
53 } // namespace net | 55 } // namespace net |
54 | 56 |
55 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ | 57 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
OLD | NEW |