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

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

Issue 2557363002: [NTP Snippets] Refactor background scheduling for remote suggestions (Closed)
Patch Set: Rebase Created 4 years 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: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
index 5b84e67138aa47869565ef4b579ac40622e3cb09..8e0878c356d2bfaf4d88a00dcfa3eaa583e089f2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
@@ -69,17 +69,14 @@ public class SnippetsBridge implements SuggestionsSource {
* Reschedules the fetching of snippets.
*/
public static void rescheduleFetching() {
- nativeRescheduleFetching();
+ nativeRemoteSuggestionsSchedulerRescheduleFetching();
}
+ /**
+ * Fetches remote suggestions in background.
+ */
public static void fetchRemoteSuggestionsFromBackground() {
- // Do not force regular background fetches.
- nativeFetchRemoteSuggestionsInTheBackground();
- }
-
- @Override
- public void fetchRemoteSuggestions() {
- nativeFetchRemoteSuggestions();
+ nativeRemoteSuggestionsSchedulerOnFetchDue();
}
@Override
@@ -198,6 +195,11 @@ public class SnippetsBridge implements SuggestionsSource {
nativeFetch(mNativeSnippetsBridge, category, displayedSuggestionIds);
}
+ @Override
+ public void fetchRemoteSuggestions() {
+ nativeReloadSuggestions(mNativeSnippetsBridge);
+ }
+
@CalledByNative
private static List<SnippetArticle> createSuggestionList() {
return new ArrayList<>();
@@ -271,9 +273,8 @@ public class SnippetsBridge implements SuggestionsSource {
private native long nativeInit(Profile profile);
private native void nativeDestroy(long nativeNTPSnippetsBridge);
- private static native void nativeFetchRemoteSuggestions();
- private static native void nativeFetchRemoteSuggestionsInTheBackground();
- private static native void nativeRescheduleFetching();
+ private static native void nativeRemoteSuggestionsSchedulerOnFetchDue();
+ private static native void nativeRemoteSuggestionsSchedulerRescheduleFetching();
private native int[] nativeGetCategories(long nativeNTPSnippetsBridge);
private native int nativeGetCategoryStatus(long nativeNTPSnippetsBridge, int category);
private native SuggestionsCategoryInfo nativeGetCategoryInfo(
@@ -284,6 +285,8 @@ public class SnippetsBridge implements SuggestionsSource {
String idWithinCategory, Callback<Bitmap> callback);
private native void nativeFetch(
long nativeNTPSnippetsBridge, int category, String[] knownSuggestions);
+ private native void nativeReloadSuggestions(
+ long nativeNTPSnippetsBridge);
private native void nativeDismissSuggestion(long nativeNTPSnippetsBridge, String url,
int globalPosition, int category, int categoryPosition, String idWithinCategory);
private native void nativeDismissCategory(long nativeNTPSnippetsBridge, int category);

Powered by Google App Engine
This is Rietveld 408576698