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

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

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifier.java ('k') | net/base/address_tracker_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
index 5a46a6c2d3489e4cfe00d02c5dcad22febaa21e9..1e72da91d8fbe013d616e16e985c926fedb30486 100644
--- a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
+++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
@@ -101,14 +101,24 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver
public void onConnectionTypeChanged(int newConnectionType);
}
- public NetworkChangeNotifierAutoDetect(Observer observer, Context context) {
+ /**
+ * Constructs a NetworkChangeNotifierAutoDetect.
+ * @param alwaysWatchForChanges If true, always watch for network changes.
+ * Otherwise, only watch if app is in foreground.
+ */
+ public NetworkChangeNotifierAutoDetect(Observer observer, Context context,
+ boolean alwaysWatchForChanges) {
mObserver = observer;
mContext = context.getApplicationContext();
mConnectivityManagerDelegate = new ConnectivityManagerDelegate(context);
mWifiManagerDelegate = new WifiManagerDelegate(context);
mConnectionType = getCurrentConnectionType();
mWifiSSID = getCurrentWifiSSID();
- ApplicationStatus.registerApplicationStateListener(this);
+ if (alwaysWatchForChanges) {
+ registerReceiver();
+ } else {
+ ApplicationStatus.registerApplicationStateListener(this);
+ }
}
/**
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifier.java ('k') | net/base/address_tracker_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698