Chromium Code Reviews| 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() { |