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

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

Issue 2235463002: Change Snippet layout based on Category. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge in master. Created 4 years, 4 months 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/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.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 e217965b77e2c1fad66b232c7b8fa013c6235d39..ad10f01d7d773fa56fa5edea71ed159b7e5ead91 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -148,6 +148,13 @@ ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint category) {
+ // Get layout for the category.
+ base::Optional<CategoryInfo> info =
+ content_suggestions_service_->GetCategoryInfo(
+ content_suggestions_service_->category_factory()->FromIDValue(
+ category));
+ DCHECK(info);
+
const std::vector<ContentSuggestion>& suggestions =
content_suggestions_service_->GetSuggestionsForCategory(
content_suggestions_service_->category_factory()->FromIDValue(
@@ -162,7 +169,8 @@ ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory(
ConvertUTF16ToJavaString(env, suggestion.snippet_text()).obj(),
ConvertUTF8ToJavaString(env, suggestion.url().spec()).obj(),
ConvertUTF8ToJavaString(env, suggestion.amp_url().spec()).obj(),
- suggestion.publish_date().ToJavaTime(), suggestion.score());
+ suggestion.publish_date().ToJavaTime(), suggestion.score(),
+ static_cast<int>(info->card_layout()));
}
return result;
}
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698