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

Unified Diff: components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc

Issue 2865183003: Use the same design for all suggestions (Closed)
Patch Set: Address comments Created 3 years, 7 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: components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
diff --git a/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc b/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
index ed11ed83fda216959320eacb6d952f6d8d206de4..9bf791c4857b5c5493b97d4ad03e33a13537d044 100644
--- a/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
+++ b/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
@@ -11,8 +11,8 @@
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/time/time.h"
#include "components/ntp_snippets/category.h"
-#include "components/ntp_snippets/reading_list/reading_list_distillation_state_util.h"
#include "components/reading_list/core/reading_list_entry.h"
#include "components/reading_list/core/reading_list_model.h"
#include "components/strings/grit/components_strings.h"
@@ -218,10 +218,16 @@ ContentSuggestion ReadingListSuggestionsProvider::ConvertEntry(
}
suggestion.set_publisher_name(
url_formatter::FormatUrl(entry->URL().GetOrigin()));
+ int64_t entry_time = entry->DistillationTime();
+ if (entry_time == 0) {
+ entry_time = entry->CreationTime();
+ }
+
+ suggestion.set_publish_date(
+ base::Time::FromDoubleT(entry_time / base::Time::kMicrosecondsPerSecond));
auto extra = base::MakeUnique<ReadingListSuggestionExtra>();
- extra->distilled_state =
- SuggestionStateFromReadingListState(entry->DistilledState());
+ extra->distilled = entry->DistilledState() == ReadingListEntry::PROCESSED;
extra->favicon_page_url =
entry->DistilledURL().is_valid() ? entry->DistilledURL() : entry->URL();
suggestion.set_reading_list_suggestion_extra(std::move(extra));

Powered by Google App Engine
This is Rietveld 408576698