| 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/jni_android.h" | 8 #include "base/android/jni_android.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" | |
| 12 #include "net/android/network_change_notifier_delegate_android.h" | 11 #include "net/android/network_change_notifier_delegate_android.h" |
| 13 #include "net/base/network_change_notifier.h" | 12 #include "net/base/network_change_notifier.h" |
| 14 | 13 |
| 15 namespace net { | 14 namespace net { |
| 16 | 15 |
| 17 class NetworkChangeNotifierAndroidTest; | 16 class NetworkChangeNotifierAndroidTest; |
| 18 class NetworkChangeNotifierFactoryAndroid; | 17 class NetworkChangeNotifierFactoryAndroid; |
| 19 | 18 |
| 20 // NetworkChangeNotifierAndroid observes network events from the Android | 19 // NetworkChangeNotifierAndroid observes network events from the Android |
| 21 // notification system and forwards them to observers. | 20 // notification system and forwards them to observers. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 53 |
| 55 static bool Register(JNIEnv* env); | 54 static bool Register(JNIEnv* env); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 friend class NetworkChangeNotifierAndroidTest; | 57 friend class NetworkChangeNotifierAndroidTest; |
| 59 friend class NetworkChangeNotifierFactoryAndroid; | 58 friend class NetworkChangeNotifierFactoryAndroid; |
| 60 | 59 |
| 61 explicit NetworkChangeNotifierAndroid( | 60 explicit NetworkChangeNotifierAndroid( |
| 62 NetworkChangeNotifierDelegateAndroid* delegate); | 61 NetworkChangeNotifierDelegateAndroid* delegate); |
| 63 | 62 |
| 64 void SetConnectionType(ConnectionType new_connection_type); | |
| 65 | |
| 66 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); | 63 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); |
| 67 | 64 |
| 68 NetworkChangeNotifierDelegateAndroid* const delegate_; | 65 NetworkChangeNotifierDelegateAndroid* const delegate_; |
| 69 mutable base::Lock connection_type_lock_; // Protects the state below. | |
| 70 ConnectionType connection_type_; | |
| 71 | 66 |
| 72 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); | 67 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); |
| 73 }; | 68 }; |
| 74 | 69 |
| 75 } // namespace net | 70 } // namespace net |
| 76 | 71 |
| 77 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ | 72 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
| OLD | NEW |