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

Unified Diff: components/ntp_snippets/remote/remote_suggestions_provider.cc

Issue 2593573003: Ntp: use AMP urls for content suggestions when available. (Closed)
Patch Set: Address review comments by vitalii. Created 4 years 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: components/ntp_snippets/remote/remote_suggestions_provider.cc
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider.cc b/components/ntp_snippets/remote/remote_suggestions_provider.cc
index ea4551e9518b6f0b9ee066d93f785de4b2c3a5bd..f138e80d9880fbdbadc6b5cde1c7b818d52bb6f3 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_provider.cc
@@ -199,8 +199,12 @@ std::vector<ContentSuggestion> ConvertToContentSuggestions(
if (!snippet->is_complete()) {
continue;
}
- ContentSuggestion suggestion(category, snippet->id(), snippet->url());
- suggestion.set_amp_url(snippet->amp_url());
+ GURL url = snippet->url();
+ if (base::FeatureList::IsEnabled(kPreferAmpUrlsFeature) &&
+ !snippet->amp_url().is_empty()) {
+ url = snippet->amp_url();
+ }
+ ContentSuggestion suggestion(category, snippet->id(), url);
suggestion.set_title(base::UTF8ToUTF16(snippet->title()));
suggestion.set_snippet_text(base::UTF8ToUTF16(snippet->snippet()));
suggestion.set_publish_date(snippet->publish_date());
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippet.h ('k') | components/ntp_snippets/remote/remote_suggestions_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698