Chromium Code Reviews| 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 3893bfc81128898877d9798faba9ec1075f66c19..38ef3f7e25a1c02a1076f652ddcedb5fe75b392a 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 |
| @@ -10,6 +10,7 @@ import org.chromium.base.Callback; |
| import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.chrome.browser.ntp.cards.SuggestionsCategoryInfo; |
| import org.chromium.chrome.browser.ntp.snippets.CategoryStatus.CategoryStatusEnum; |
| +import org.chromium.chrome.browser.ntp.snippets.KnownCategories.KnownCategoriesEnum; |
| import org.chromium.chrome.browser.profiles.Profile; |
| import java.util.ArrayList; |
| @@ -38,6 +39,10 @@ public class SnippetsBridge implements SuggestionsSource { |
| return status == CategoryStatus.AVAILABLE_LOADING || status == CategoryStatus.INITIALIZING; |
| } |
| + public static boolean isKnownCategory(int category, @KnownCategoriesEnum int knownCategory) { |
| + return category == knownCategory; |
|
Michael van Ouwerkerk
2016/08/10 10:09:29
Is it useful to have a method to perform such a si
Philipp Keck
2016/08/10 13:14:46
I knew some reviewer would ask this ;-)
We have s
Michael van Ouwerkerk
2016/08/10 13:21:09
I see, thanks for the explanation. I think this pa
Philipp Keck
2016/08/10 15:16:41
True. I removed the method.
|
| + } |
| + |
| /** |
| * Creates a SnippetsBridge for getting snippet data for the current user. |
| * |
| @@ -99,7 +104,14 @@ public class SnippetsBridge implements SuggestionsSource { |
| } |
| @Override |
| + public void fetchMoreSuggestions(int category) { |
| + assert mNativeSnippetsBridge != 0; |
| + nativeFetchMoreSuggestions(mNativeSnippetsBridge, category); |
| + } |
| + |
| + @Override |
| public void fetchSuggestionImage(SnippetArticleListItem suggestion, Callback<Bitmap> callback) { |
| + assert mNativeSnippetsBridge != 0; |
| nativeFetchSuggestionImage(mNativeSnippetsBridge, suggestion.mId, callback); |
| } |
| @@ -149,8 +161,8 @@ public class SnippetsBridge implements SuggestionsSource { |
| @CalledByNative |
| private static SuggestionsCategoryInfo createSuggestionsCategoryInfo( |
| - String title, int cardLayout) { |
| - return new SuggestionsCategoryInfo(title, cardLayout); |
| + String title, int cardLayout, boolean hasMoreButton) { |
| + return new SuggestionsCategoryInfo(title, cardLayout, hasMoreButton); |
| } |
| @CalledByNative |
| @@ -175,10 +187,11 @@ public class SnippetsBridge implements SuggestionsSource { |
| long nativeNTPSnippetsBridge, int category); |
| private native List<SnippetArticleListItem> nativeGetSuggestionsForCategory( |
| long nativeNTPSnippetsBridge, int category); |
| + private native void nativeFetchMoreSuggestions(long nativeNTPSnippetsBridge, int category); |
| private native void nativeFetchSuggestionImage( |
| long nativeNTPSnippetsBridge, String suggestionId, Callback<Bitmap> callback); |
| private native void nativeDismissSuggestion(long nativeNTPSnippetsBridge, String suggestionId); |
| - private static native void nativeGetURLVisited( |
| + private native void nativeGetURLVisited( |
| long nativeNTPSnippetsBridge, Callback<Boolean> callback, String url); |
| private native void nativeSetObserver(long nativeNTPSnippetsBridge, SnippetsBridge bridge); |
| } |