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

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

Issue 2507793002: [NTP] Propagate OfflineId from C++ for Downloads. (Closed)
Patch Set: rebase. 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/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 7f03d7f224e8761dee9f3aaaa40116b60adf40e3..a88f5fa95fd7795b1d70afb64edc4a61637127ae 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -81,15 +81,19 @@ ScopedJavaLocalRef<jobject> ToJavaSuggestionList(
static_cast<int>(info->card_layout()));
if (suggestion.id().category().IsKnownCategory(
KnownCategories::DOWNLOADS) &&
- suggestion.download_suggestion_extra() != nullptr &&
- suggestion.download_suggestion_extra()->is_download_asset) {
- Java_SnippetsBridge_setDownloadAssetDataForLastSuggestion(
- env, result,
- ConvertUTF8ToJavaString(
- env,
- suggestion.download_suggestion_extra()->target_file_path.value()),
- ConvertUTF8ToJavaString(
- env, suggestion.download_suggestion_extra()->mime_type));
+ suggestion.download_suggestion_extra() != nullptr) {
+ if (suggestion.download_suggestion_extra()->is_download_asset) {
+ Java_SnippetsBridge_setDownloadAssetDataForLastSuggestion(
+ env, result,
+ ConvertUTF8ToJavaString(env, suggestion.download_suggestion_extra()
+ ->target_file_path.value()),
+ ConvertUTF8ToJavaString(
+ env, suggestion.download_suggestion_extra()->mime_type));
+ } else {
+ Java_SnippetsBridge_setDownloadOfflinePageDataForLastSuggestion(
+ env, result,
+ suggestion.download_suggestion_extra()->offline_page_id);
+ }
}
if (suggestion.id().category().IsKnownCategory(
KnownCategories::RECENT_TABS) &&
@@ -98,8 +102,7 @@ ScopedJavaLocalRef<jobject> ToJavaSuggestionList(
env, result,
ConvertUTF8ToJavaString(
env, suggestion.recent_tab_suggestion_extra()->tab_id),
- ConvertUTF8ToJavaString(
- env, suggestion.recent_tab_suggestion_extra()->offline_page_id));
+ suggestion.recent_tab_suggestion_extra()->offline_page_id);
}
}

Powered by Google App Engine
This is Rietveld 408576698