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

Unified Diff: net/android/network_change_notifier_android.h

Issue 10693068: Refactor Android's NetworckChangeNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: net/android/network_change_notifier_android.h
diff --git a/net/android/network_change_notifier_android.h b/net/android/network_change_notifier_android.h
index c16a7ff10aa6c91d5daeb6088e0d636ceead10aa..ab60ce7e767dd772c5fbfae6eaa2ddc639ca9c0f 100644
--- a/net/android/network_change_notifier_android.h
+++ b/net/android/network_change_notifier_android.h
@@ -6,31 +6,36 @@
#define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
#pragma once
-#include "base/android/scoped_java_ref.h"
-#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "net/base/network_change_notifier.h"
namespace net {
namespace android {
+// On Android this is provided as a 'loop back' implementation, where the
+// embedder chooses how and when to update the current network connection
+// state. Embedders must push the current state down via setConnected().
+//
+// This is a singleton object and the singleton property is enforced by
+// a private constructor here and the friend NetworkChangeNotifierFactory
+// class.
class NetworkChangeNotifier : public net::NetworkChangeNotifier {
public:
- NetworkChangeNotifier();
- virtual ~NetworkChangeNotifier();
-
- void NotifyObservers(JNIEnv* env, jobject obj);
-
- static bool Register(JNIEnv* env);
+ // The embedder must call through to this method to notify the network
+ // stack of the current connection state.
+ void setConnected(bool network_up);
private:
- void CreateJavaObject(JNIEnv* env);
+ NetworkChangeNotifier();
+ virtual ~NetworkChangeNotifier();
// NetworkChangeNotifier:
virtual net::NetworkChangeNotifier::ConnectionType
GetCurrentConnectionType() const OVERRIDE;
- base::android::ScopedJavaGlobalRef<jobject> java_network_change_notifier_;
+ bool is_connected_;
+
+ friend class NetworkChangeNotifierFactory;
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
};

Powered by Google App Engine
This is Rietveld 408576698