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

Unified Diff: net/android/java/src/org/chromium/net/NetworkChangeNotifier.java

Issue 2828353002: Android: Remove GetApplicationContext part 3 (Closed)
Patch Set: Fix android webview tests Created 3 years, 8 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/java/src/org/chromium/net/NetworkChangeNotifier.java
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
index 9aab28d75761b9586a5285c31aaf8bcfe3641f11..2d0fe8d6ed246d6910ac1cd31317854db462d1ee 100644
--- a/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
+++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
@@ -34,7 +34,6 @@ public class NetworkChangeNotifier {
public void onConnectionTypeChanged(int connectionType);
}
- private final Context mContext;
private final ArrayList<Long> mNativeChangeNotifiers;
private final ObserverList<ConnectionTypeObserver> mConnectionTypeObservers;
private NetworkChangeNotifierAutoDetect mAutoDetector;
@@ -45,19 +44,23 @@ public class NetworkChangeNotifier {
private static NetworkChangeNotifier sInstance;
@VisibleForTesting
- protected NetworkChangeNotifier(Context context) {
- mContext = context.getApplicationContext();
+ protected NetworkChangeNotifier() {
mNativeChangeNotifiers = new ArrayList<Long>();
mConnectionTypeObservers = new ObserverList<ConnectionTypeObserver>();
}
+ // TODO(wnwen): Remove after downstream no longer depends on this.
+ public static NetworkChangeNotifier init(Context context) {
+ return init();
+ }
+
/**
* Initializes the singleton once.
*/
@CalledByNative
- public static NetworkChangeNotifier init(Context context) {
+ public static NetworkChangeNotifier init() {
if (sInstance == null) {
- sInstance = new NetworkChangeNotifier(context);
+ sInstance = new NetworkChangeNotifier();
}
return sInstance;
}
@@ -214,7 +217,7 @@ public class NetworkChangeNotifier {
notifyObserversToPurgeActiveNetworkList(activeNetIds);
}
},
- mContext, policy);
+ policy);
final NetworkChangeNotifierAutoDetect.NetworkState networkState =
mAutoDetector.getCurrentNetworkState();
updateCurrentConnectionType(

Powered by Google App Engine
This is Rietveld 408576698