summaryrefslogtreecommitdiffstats
path: root/net/android/network_change_notifier_android.h
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 12:34:34 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 12:34:34 +0000
commit18eab2d146b6d158992fa6ddc6a266a2a5264c81 (patch)
tree8af2175525100b4eba14d47fa0d5361012be048b /net/android/network_change_notifier_android.h
parent697f88738e456b0eb4291c297095a72f40bdb7b4 (diff)
downloadchromium_src-18eab2d146b6d158992fa6ddc6a266a2a5264c81.zip
chromium_src-18eab2d146b6d158992fa6ddc6a266a2a5264c81.tar.gz
chromium_src-18eab2d146b6d158992fa6ddc6a266a2a5264c81.tar.bz2
Provide NetworkChangeNotifierAndroid with the actual initial connection type.
The Android NetworkChangeNotifier is initialized with connection_type = CONNECTION_UNKNOWN. This means that the result returned by NetworkChangeNotifier::IsOffline() is inaccurate until the first network change happens. This can happen for the whole initialization path if the user starts Chrome after he explicitly disabled WiFi and 3G. This CL updates NetworkChangeNotifier.java to support multiple native observers. This can happen in case NetworkChangeNotifierDelegateAndroid is instantiated multiple times (e.g. when multiple factories are instantiated). Still on the Java side, NetworkChangeNotifier.java was also changed to fetch the actual connection type as soon as the auto-detector (interacting with the Android platform) is enabled. On the native side, NetworkChangeNotifierDelegateAndroid now fetches at construction time the current connection type from the Java side singleton through a direct JNI function call (possible since the delegate is constructed on the JNI thread). NetworkChangeNotifierAndroid::GetCurrentConnectionType() is now a simple wrapper around the delegate's GetCurrentConnectionType() method (which is thread-safe). BUG=166883 Review URL: https://codereview.chromium.org/11628008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/android/network_change_notifier_android.h')
-rw-r--r--net/android/network_change_notifier_android.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/net/android/network_change_notifier_android.h b/net/android/network_change_notifier_android.h
index 4f6180f..f167cfc 100644
--- a/net/android/network_change_notifier_android.h
+++ b/net/android/network_change_notifier_android.h
@@ -8,7 +8,6 @@
#include "base/android/jni_android.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/synchronization/lock.h"
#include "net/android/network_change_notifier_delegate_android.h"
#include "net/base/network_change_notifier.h"
@@ -49,8 +48,7 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid
virtual ConnectionType GetCurrentConnectionType() const OVERRIDE;
// NetworkChangeNotifierDelegateAndroid::Observer:
- virtual void OnConnectionTypeChanged(
- ConnectionType new_connection_type) OVERRIDE;
+ virtual void OnConnectionTypeChanged() OVERRIDE;
static bool Register(JNIEnv* env);
@@ -61,13 +59,9 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierAndroid
explicit NetworkChangeNotifierAndroid(
NetworkChangeNotifierDelegateAndroid* delegate);
- void SetConnectionType(ConnectionType new_connection_type);
-
static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsAndroid();
NetworkChangeNotifierDelegateAndroid* const delegate_;
- mutable base::Lock connection_type_lock_; // Protects the state below.
- ConnectionType connection_type_;
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid);
};