Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: net/android/network_change_notifier_android.h

Issue 11628008: Provide NetworkChangeNotifierAndroid with the actual initial connection type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Ryan's comments + fix Java comment Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
42 class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid 41 class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid
43 : public NetworkChangeNotifier, 42 : public NetworkChangeNotifier,
44 public NetworkChangeNotifierDelegateAndroid::Observer { 43 public NetworkChangeNotifierDelegateAndroid::Observer {
45 public: 44 public:
46 virtual ~NetworkChangeNotifierAndroid(); 45 virtual ~NetworkChangeNotifierAndroid();
47 46
48 // NetworkChangeNotifier: 47 // NetworkChangeNotifier:
49 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; 48 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE;
50 49
51 // NetworkChangeNotifierDelegateAndroid::Observer: 50 // NetworkChangeNotifierDelegateAndroid::Observer:
52 virtual void OnConnectionTypeChanged( 51 virtual void OnConnectionTypeChanged() OVERRIDE;
53 ConnectionType new_connection_type) OVERRIDE;
54 52
55 static bool Register(JNIEnv* env); 53 static bool Register(JNIEnv* env);
56 54
57 private: 55 private:
58 friend class NetworkChangeNotifierAndroidTest; 56 friend class NetworkChangeNotifierAndroidTest;
59 friend class NetworkChangeNotifierFactoryAndroid; 57 friend class NetworkChangeNotifierFactoryAndroid;
60 58
61 explicit NetworkChangeNotifierAndroid( 59 explicit NetworkChangeNotifierAndroid(
62 NetworkChangeNotifierDelegateAndroid* delegate); 60 NetworkChangeNotifierDelegateAndroid* delegate);
63 61
64 void SetConnectionType(ConnectionType new_connection_type);
65
66 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid(); 62 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid();
67 63
68 NetworkChangeNotifierDelegateAndroid* const delegate_; 64 NetworkChangeNotifierDelegateAndroid* const delegate_;
69 mutable base::Lock connection_type_lock_; // Protects the state below.
70 ConnectionType connection_type_;
71 65
72 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid); 66 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid);
73 }; 67 };
74 68
75 } // namespace net 69 } // namespace net
76 70
77 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_ 71 #endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698