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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 026dfe42a4ce38f7c3f33af2c304a6bad634a160..443b751739ae718f92c4b2d840676cd4d884c72d 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -61,37 +61,38 @@ ScopedJavaLocalRef<jobject> ToJavaSuggestionList(
ScopedJavaLocalRef<jobject> result =
Java_SnippetsBridge_createSuggestionList(env);
for (const ContentSuggestion& suggestion : suggestions) {
- Java_SnippetsBridge_addSuggestion(
- env, result, category.id(),
- ConvertUTF8ToJavaString(env, suggestion.id().id_within_category()),
- ConvertUTF16ToJavaString(env, suggestion.title()),
- ConvertUTF16ToJavaString(env, suggestion.publisher_name()),
- ConvertUTF16ToJavaString(env, suggestion.snippet_text()),
- ConvertUTF8ToJavaString(env, suggestion.url().spec()),
- ConvertUTF8ToJavaString(env, suggestion.amp_url().spec()),
- suggestion.publish_date().ToJavaTime(), suggestion.score(),
- static_cast<int>(info.card_layout()));
+ ScopedJavaLocalRef<jobject> java_suggestion =
+ Java_SnippetsBridge_addSuggestion(
+ env, result, category.id(),
+ ConvertUTF8ToJavaString(env, suggestion.id().id_within_category()),
+ ConvertUTF16ToJavaString(env, suggestion.title()),
+ ConvertUTF16ToJavaString(env, suggestion.publisher_name()),
+ ConvertUTF16ToJavaString(env, suggestion.snippet_text()),
+ ConvertUTF8ToJavaString(env, suggestion.url().spec()),
+ ConvertUTF8ToJavaString(env, suggestion.amp_url().spec()),
+ suggestion.publish_date().ToJavaTime(), suggestion.score(),
+ static_cast<int>(info.card_layout()));
if (suggestion.id().category().IsKnownCategory(
KnownCategories::DOWNLOADS) &&
suggestion.download_suggestion_extra() != nullptr) {
if (suggestion.download_suggestion_extra()->is_download_asset) {
- Java_SnippetsBridge_setDownloadAssetDataForLastSuggestion(
- env, result,
+ Java_SnippetsBridge_setAssetDownloadDataForSuggestion(
+ env, java_suggestion,
ConvertUTF8ToJavaString(env, suggestion.download_suggestion_extra()
->target_file_path.value()),
ConvertUTF8ToJavaString(
env, suggestion.download_suggestion_extra()->mime_type));
} else {
- Java_SnippetsBridge_setDownloadOfflinePageDataForLastSuggestion(
- env, result,
+ Java_SnippetsBridge_setOfflinePageDownloadDataForSuggestion(
+ env, java_suggestion,
suggestion.download_suggestion_extra()->offline_page_id);
}
}
if (suggestion.id().category().IsKnownCategory(
KnownCategories::RECENT_TABS) &&
suggestion.recent_tab_suggestion_extra() != nullptr) {
- Java_SnippetsBridge_setRecentTabDataForLastSuggestion(
- env, result,
+ Java_SnippetsBridge_setRecentTabDataForSuggestion(
+ env, java_suggestion,
ConvertUTF8ToJavaString(
env, suggestion.recent_tab_suggestion_extra()->tab_id),
suggestion.recent_tab_suggestion_extra()->offline_page_id);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698