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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java

Issue 2794313002: [Remote suggestions] Prioritize wifi for soft fetches. (Closed)
Patch Set: Fix an error in rebase 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
« no previous file with comments | « no previous file | chrome/browser/android/ntp/ntp_snippets_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
index bd2fcefb860146f412713c3f80405c988f4f1af0..e69cd5945be63f4cf5cbe321d153150c8792025b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
@@ -4,6 +4,9 @@
package org.chromium.chrome.browser.ntp.snippets;
+import android.content.Context;
+import android.net.ConnectivityManager;
+
import com.google.android.gms.gcm.GcmNetworkManager;
import com.google.android.gms.gcm.PeriodicTask;
import com.google.android.gms.gcm.Task;
@@ -165,6 +168,14 @@ public class SnippetsLauncher {
return schedule(0, 0);
}
+ @CalledByNative
+ public boolean isOnUnmeteredConnection() {
+ Context context = ContextUtils.getApplicationContext();
+ ConnectivityManager manager =
+ (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ return !manager.isActiveNetworkMetered();
+ }
+
public static boolean shouldRescheduleTasksOnUpgrade() {
// Reschedule the periodic tasks if they were enabled previously.
return ContextUtils.getAppSharedPreferences().getBoolean(PREF_IS_SCHEDULED, false);
« no previous file with comments | « no previous file | chrome/browser/android/ntp/ntp_snippets_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698