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

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

Issue 2514343003: [NTP] Cleanup: specific category related data and bridge. (Closed)
Patch Set: rebase & mvanouerwerk@ nits. Created 4 years, 1 month 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 96cedecc07c0fdc6a9f6eeb3e72e5d60f4c5322c..ad1f02d206bfebd6fd366c46abe9468b9531002e 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
@@ -204,35 +204,31 @@ public class SnippetsBridge implements SuggestionsSource {
}
@CalledByNative
- private static void addSuggestion(List<SnippetArticle> suggestions, int category, String id,
- String title, String publisher, String previewText, String url, String ampUrl,
- long timestamp, float score, int cardLayout) {
+ private static SnippetArticle addSuggestion(List<SnippetArticle> suggestions, int category,
+ String id, String title, String publisher, String previewText, String url,
+ String ampUrl, long timestamp, float score, int cardLayout) {
int position = suggestions.size();
suggestions.add(new SnippetArticle(category, id, title, publisher, previewText, url, ampUrl,
timestamp, score, position, cardLayout));
+ return suggestions.get(position);
}
- // TODO(vitaliii): Remove all |.*ForLastSuggestion| methods and instead make |addSuggestion|
- // return the suggestion and set the values there.
@CalledByNative
- private static void setDownloadAssetDataForLastSuggestion(
- List<SnippetArticle> suggestions, String filePath, String mimeType) {
- assert suggestions.size() > 0;
- suggestions.get(suggestions.size() - 1).setDownloadAssetData(filePath, mimeType);
+ private static void setAssetDownloadDataForSuggestion(
+ SnippetArticle suggestion, String filePath, String mimeType) {
+ suggestion.setAssetDownloadData(filePath, mimeType);
}
@CalledByNative
- private static void setDownloadOfflinePageDataForLastSuggestion(
- List<SnippetArticle> suggestions, long offlinePageId) {
- assert suggestions.size() > 0;
- suggestions.get(suggestions.size() - 1).setDownloadOfflinePageData(offlinePageId);
+ private static void setOfflinePageDownloadDataForSuggestion(
+ SnippetArticle suggestion, long offlinePageId) {
+ suggestion.setOfflinePageDownloadData(offlinePageId);
}
@CalledByNative
- private static void setRecentTabDataForLastSuggestion(
- List<SnippetArticle> suggestions, String tabId, long offlinePageId) {
- assert suggestions.size() > 0;
- suggestions.get(suggestions.size() - 1).setRecentTabData(tabId, offlinePageId);
+ private static void setRecentTabDataForSuggestion(
+ SnippetArticle suggestion, String tabId, long offlinePageId) {
+ suggestion.setRecentTabData(tabId, offlinePageId);
}
@CalledByNative

Powered by Google App Engine
This is Rietveld 408576698