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

Unified Diff: components/ntp_snippets/content_suggestion.h

Issue 2780793002: Add extra information for ReadingList ContentSuggestion (Closed)
Patch Set: Address comments Created 3 years, 9 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
« no previous file with comments | « components/ntp_snippets/BUILD.gn ('k') | components/ntp_snippets/content_suggestion.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/content_suggestion.h
diff --git a/components/ntp_snippets/content_suggestion.h b/components/ntp_snippets/content_suggestion.h
index b2403f6c749ef97c3245abbaba77e7288dd6e952..75f3d4c9b9cfb4e7ded26759d9e7fc326fcc86ef 100644
--- a/components/ntp_snippets/content_suggestion.h
+++ b/components/ntp_snippets/content_suggestion.h
@@ -46,6 +46,21 @@ struct RecentTabSuggestionExtra {
int64_t offline_page_id = 0;
};
+// ReadingListSuggestionExtra contains additional data which is only available
+// for Reading List suggestions.
+struct ReadingListSuggestionExtra {
+ // State of the distillation a suggestion. This is the meaningful extract of
+ // ReadingListEntry::DistillationState for the suggestions. It is duplicated
+ // here to avoid a dependence on ReadingList.
+ enum class ReadingListSuggestionDistilledState { PENDING, SUCCESS, FAILURE };
+
+ // State of the distillation of the suggestion.
+ ReadingListSuggestionDistilledState distilled_state =
+ ReadingListSuggestionDistilledState::PENDING;
+ // URL of the page whose favicon should be displayed for this suggestion.
+ GURL favicon_page_url;
+};
+
// Contains additional data for notification-worthy suggestions.
struct NotificationExtra {
// Deadline for showing notification. If the deadline is past, the
@@ -144,6 +159,15 @@ class ContentSuggestion {
void set_recent_tab_suggestion_extra(
std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra);
+ // Extra information for reading list suggestions. Only available for
+ // KnownCategories::READING_LIST suggestions.
+ ReadingListSuggestionExtra* reading_list_suggestion_extra() const {
+ return reading_list_suggestion_extra_.get();
+ }
+ void set_reading_list_suggestion_extra(
+ std::unique_ptr<ReadingListSuggestionExtra>
+ reading_list_suggestion_extra);
+
// Extra information for notifications. When absent, no notification should be
// sent for this suggestion. When present, a notification should be sent,
// unless other factors disallow it (examples: the extra parameters say to;
@@ -169,6 +193,7 @@ class ContentSuggestion {
float score_;
std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_;
std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_;
+ std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra_;
std::unique_ptr<NotificationExtra> notification_extra_;
// The time when the remote suggestion was fetched from the server. This field
« no previous file with comments | « components/ntp_snippets/BUILD.gn ('k') | components/ntp_snippets/content_suggestion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698