| Index: components/ntp_snippets/ntp_snippet.cc
|
| diff --git a/components/ntp_snippets/ntp_snippet.cc b/components/ntp_snippets/ntp_snippet.cc
|
| index d7ca20c3392fd76c088a5de45aff7ebf92527627..5e2835e93bbdd433bbabf1ed8103044cb7c6887c 100644
|
| --- a/components/ntp_snippets/ntp_snippet.cc
|
| +++ b/components/ntp_snippets/ntp_snippet.cc
|
| @@ -8,6 +8,9 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/values.h"
|
| #include "components/ntp_snippets/proto/ntp_snippets.pb.h"
|
| +#include "components/ntp_snippets/snippet.h"
|
| +#include "components/ntp_snippets/snippet_category.h"
|
| +#include "components/ntp_snippets/snippet_provider_type.h"
|
|
|
| namespace {
|
|
|
| @@ -221,6 +224,19 @@ SnippetProto NTPSnippet::ToProto() const {
|
| return result;
|
| }
|
|
|
| +std::unique_ptr<Snippet> NTPSnippet::ToSnippet() const {
|
| + std::unique_ptr<Snippet> result(new Snippet(
|
| + id_, SnippetProviderType::ARTICLES, SnippetCategory::ARTICLE));
|
| + result->set_url(best_source().url);
|
| + result->set_amp_url(best_source().amp_url);
|
| + result->set_title(title_);
|
| + result->set_text_extract(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;
|
|
|