Chromium Code Reviews| Index: components/ntp_snippets/ntp_snippet.cc |
| diff --git a/components/ntp_snippets/ntp_snippet.cc b/components/ntp_snippets/ntp_snippet.cc |
| index d56528508a59eab0073c5c12937c836b0f4f33e8..b193af4e0b78282617deb83327379dace7146919 100644 |
| --- a/components/ntp_snippets/ntp_snippet.cc |
| +++ b/components/ntp_snippets/ntp_snippet.cc |
| @@ -2,12 +2,15 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <components/ntp_snippets/content_suggestions_provider_type.h> |
|
Marc Treib
2016/06/27 12:25:36
Here too
Philipp Keck
2016/06/27 12:46:53
Done.
|
| #include "components/ntp_snippets/ntp_snippet.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/values.h" |
| +#include "components/ntp_snippets/content_suggestion.h" |
| +#include "components/ntp_snippets/content_suggestion_category.h" |
| #include "components/ntp_snippets/proto/ntp_snippets.pb.h" |
| namespace { |
| @@ -250,6 +253,19 @@ SnippetProto NTPSnippet::ToProto() const { |
| return result; |
| } |
| +std::unique_ptr<ContentSuggestion> NTPSnippet::ToContentSuggestion() const { |
| + std::unique_ptr<ContentSuggestion> result(new ContentSuggestion( |
| + id_, ContentSuggestionsProviderType::ARTICLES, |
| + ContentSuggestionCategory::ARTICLE, best_source().url)); |
| + result->set_amp_url(best_source().amp_url); |
| + result->set_title(title_); |
| + result->set_snippet_text(snippet_); |
| + result->set_publish_date(publish_date_); |
| + result->set_publisher_name(best_source().publisher_name); |
| + result->set_score(score_); |
| + return result; |
| +} |
| + |
| // static |
| base::Time NTPSnippet::TimeFromJsonString(const std::string& timestamp_str) { |
| int64_t timestamp; |