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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // subscribes to network change notifications fired by the delegate (and | 28 // subscribes to network change notifications fired by the delegate (and |
29 // initiated by the Java side). | 29 // initiated by the Java side). |
30 class Observer { | 30 class Observer { |
31 public: | 31 public: |
32 virtual ~Observer() {} | 32 virtual ~Observer() {} |
33 | 33 |
34 // Updates the current connection type. | 34 // Updates the current connection type. |
35 virtual void OnConnectionTypeChanged() = 0; | 35 virtual void OnConnectionTypeChanged() = 0; |
36 | 36 |
37 // Updates the current max bandwidth. | 37 // Updates the current max bandwidth. |
38 virtual void OnMaxBandwidthChanged(double max_bandwidth_mbps) = 0; | 38 virtual void OnMaxBandwidthChanged(ConnectionType connection_type, |
| 39 double max_bandwidth_mbps) = 0; |
39 }; | 40 }; |
40 | 41 |
41 NetworkChangeNotifierDelegateAndroid(); | 42 NetworkChangeNotifierDelegateAndroid(); |
42 ~NetworkChangeNotifierDelegateAndroid(); | 43 ~NetworkChangeNotifierDelegateAndroid(); |
43 | 44 |
44 // Called from NetworkChangeNotifierAndroid.java on the JNI thread whenever | 45 // Called from NetworkChangeNotifierAndroid.java on the JNI thread whenever |
45 // the connection type changes. This updates the current connection type seen | 46 // the connection type changes. This updates the current connection type seen |
46 // by this class and forwards the notification to the observers that | 47 // by this class and forwards the notification to the observers that |
47 // subscribed through AddObserver(). | 48 // subscribed through AddObserver(). |
48 void NotifyConnectionTypeChanged(JNIEnv* env, | 49 void NotifyConnectionTypeChanged(JNIEnv* env, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 mutable base::Lock connection_lock_; // Protects the state below. | 90 mutable base::Lock connection_lock_; // Protects the state below. |
90 ConnectionType connection_type_; | 91 ConnectionType connection_type_; |
91 double connection_max_bandwidth_; | 92 double connection_max_bandwidth_; |
92 | 93 |
93 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierDelegateAndroid); | 94 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierDelegateAndroid); |
94 }; | 95 }; |
95 | 96 |
96 } // namespace net | 97 } // namespace net |
97 | 98 |
98 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_H_ | 99 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_DELEGATE_H_ |
OLD | NEW |