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

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

Issue 1921553004: Add favicon and publisher name to snippet cards (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 569b3c7ad2a00554b89b7d5e38618b69b345efed..4f3e0c9b764492403e19f1e8aea6b48a417872f3 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -111,25 +111,37 @@ void NTPSnippetsBridge::NTPSnippetsServiceLoaded() {
return;
std::vector<std::string> titles;
+ // url for the article. This will also be used to find the favicon for the
Marc Treib 2016/04/29 09:19:29 nitty nit: I'd use "URL" in comments. Also comment
Bernhard Bauer 2016/04/29 09:26:34 Nit: "URL"
May 2016/04/29 11:54:21 Done.
+ // article
Bernhard Bauer 2016/04/29 09:26:34 Nit: period at the end please.
May 2016/04/29 11:54:21 Done.
std::vector<std::string> urls;
+ // url for the amp version of the article if it exists. This will be used as
Bernhard Bauer 2016/04/29 09:26:34 Nit: "AMP"
May 2016/04/29 11:54:21 Done.
+ // the url to direct the user to on tap.
+ std::vector<std::string> amp_urls;
std::vector<std::string> thumbnail_urls;
std::vector<std::string> snippets;
std::vector<int64_t> timestamps;
+ std::vector<std::string> publishers;
for (const ntp_snippets::NTPSnippet& snippet : *ntp_snippets_service_) {
+ // The url from source_info is a url for a site that is one of the
+ // HOST_RESTRICT parameters, so this is preferred.
+ urls.push_back(snippet.best_source().url.spec());
Marc Treib 2016/04/29 09:19:29 Hm, I think this is problematic. We currently use
May 2016/04/29 11:54:20 Hmm, good point. Changed DiscardSnippet to use the
+ amp_urls.push_back(snippet.best_source().amp_url.spec());
titles.push_back(snippet.title());
- urls.push_back(snippet.url().spec());
thumbnail_urls.push_back(snippet.salient_image_url().spec());
snippets.push_back(snippet.snippet());
timestamps.push_back(snippet.publish_date().ToJavaTime());
+ publishers.push_back(snippet.best_source().publisher_name);
}
JNIEnv* env = base::android::AttachCurrentThread();
Java_SnippetsBridge_onSnippetsAvailable(
env, observer_.obj(), ToJavaArrayOfStrings(env, titles).obj(),
ToJavaArrayOfStrings(env, urls).obj(),
+ ToJavaArrayOfStrings(env, amp_urls).obj(),
ToJavaArrayOfStrings(env, thumbnail_urls).obj(),
ToJavaArrayOfStrings(env, snippets).obj(),
- ToJavaLongArray(env, timestamps).obj());
+ ToJavaLongArray(env, timestamps).obj(),
+ ToJavaArrayOfStrings(env, publishers).obj());
}
void NTPSnippetsBridge::NTPSnippetsServiceShutdown() {

Powered by Google App Engine
This is Rietveld 408576698