#ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
#define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/synchronization/lock.h"
#include "net/base/network_change_notifier.h"
namespace net {
class NetworkChangeNotifierAndroidTest;
class NetworkChangeNotifierAndroid : public NetworkChangeNotifier {
public:
virtual ~NetworkChangeNotifierAndroid();
void NotifyObserversOfConnectionTypeChange(
JNIEnv* env, jobject obj, jint new_connection_type);
jint GetConnectionType(JNIEnv* env, jobject obj);
static bool Register(JNIEnv* env);
private:
friend class NetworkChangeNotifierAndroidTest;
friend class NetworkChangeNotifierFactoryAndroid;
NetworkChangeNotifierAndroid();
void SetConnectionType(int connection_type);
void ForceConnectivityState(bool state);
virtual ConnectionType GetCurrentConnectionType() const OVERRIDE;
base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_;
mutable base::Lock lock_;
int connection_type_;
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierAndroid);
};
}
#endif