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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // NetworkChangeNotifierAndroid ('Notifier') - Receives event notifications from | 35 // NetworkChangeNotifierAndroid ('Notifier') - Receives event notifications from |
36 // the Delegate. Processes and forwards these events to the | 36 // the Delegate. Processes and forwards these events to the |
37 // NetworkChangeNotifier observers on their threads. May live on any thread | 37 // NetworkChangeNotifier observers on their threads. May live on any thread |
38 // and be called by any thread. | 38 // and be called by any thread. |
39 // | 39 // |
40 // For more details, see the implementation file. | 40 // For more details, see the implementation file. |
41 class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid | 41 class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid |
42 : public NetworkChangeNotifier, | 42 : public NetworkChangeNotifier, |
43 public NetworkChangeNotifierDelegateAndroid::Observer { | 43 public NetworkChangeNotifierDelegateAndroid::Observer { |
44 public: | 44 public: |
45 virtual ~NetworkChangeNotifierAndroid(); | 45 ~NetworkChangeNotifierAndroid() override; |
46 | 46 |
47 // NetworkChangeNotifier: | 47 // NetworkChangeNotifier: |
48 virtual ConnectionType GetCurrentConnectionType() const override; | 48 ConnectionType GetCurrentConnectionType() const override; |
49 // Requires ACCESS_WIFI_STATE permission in order to provide precise WiFi link | 49 // Requires ACCESS_WIFI_STATE permission in order to provide precise WiFi link |
50 // speed. | 50 // speed. |
51 virtual double GetCurrentMaxBandwidth() const override; | 51 double GetCurrentMaxBandwidth() const override; |
52 | 52 |
53 // NetworkChangeNotifierDelegateAndroid::Observer: | 53 // NetworkChangeNotifierDelegateAndroid::Observer: |
54 virtual void OnConnectionTypeChanged() override; | 54 void OnConnectionTypeChanged() override; |
55 virtual void OnMaxBandwidthChanged(double max_bandwidth_mbps) override; | 55 void OnMaxBandwidthChanged(double max_bandwidth_mbps) override; |
56 | 56 |
57 static bool Register(JNIEnv* env); | 57 static bool Register(JNIEnv* env); |
58 | 58 |
59 // Promote GetMaxBandwidthForConnectionSubtype to public for the Android | 59 // Promote GetMaxBandwidthForConnectionSubtype to public for the Android |
60 // delegate class. | 60 // delegate class. |
61 using NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype; | 61 using NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype; |
62 | 62 |
63 private: | 63 private: |
64 friend class NetworkChangeNotifierAndroidTest; | 64 friend class NetworkChangeNotifierAndroidTest; |
65 friend class NetworkChangeNotifierFactoryAndroid; | 65 friend class NetworkChangeNotifierFactoryAndroid; |
66 | 66 |
67 class DnsConfigServiceThread; | 67 class DnsConfigServiceThread; |
68 | 68 |
69 explicit NetworkChangeNotifierAndroid( | 69 explicit NetworkChangeNotifierAndroid( |
70 NetworkChangeNotifierDelegateAndroid* delegate); | 70 NetworkChangeNotifierDelegateAndroid* delegate); |
71 | 71 |
72 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); | 72 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); |
73 | 73 |
74 NetworkChangeNotifierDelegateAndroid* const delegate_; | 74 NetworkChangeNotifierDelegateAndroid* const delegate_; |
75 scoped_ptr<DnsConfigServiceThread> dns_config_service_thread_; | 75 scoped_ptr<DnsConfigServiceThread> dns_config_service_thread_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); | 77 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace net | 80 } // namespace net |
81 | 81 |
82 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ | 82 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ |
OLD | NEW |