Chromium Code Reviews| 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..7f33865839a0a95208ffec777145503e77e9c0de 100644 |
| --- a/components/ntp_snippets/content_suggestion.h |
| +++ b/components/ntp_snippets/content_suggestion.h |
| @@ -46,6 +46,25 @@ 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 a duplicate of |
| + // ReadingListEntry::DistillationState and should be kept sync. It is |
| + // duplicated here to prevent a dependence on ReadingList. |
|
Olivier
2017/03/30 08:51:11
nit s/prevent/avoid/ ?
gambard
2017/03/30 08:59:09
Done.
|
| + enum class ReadingListSuggestionDistilledState { |
| + PROCESSING, |
|
Olivier
2017/03/30 08:51:11
The enums are not synced at the moment. can you co
gambard
2017/03/30 08:59:09
Done.
|
| + SUCCESS, |
| + FAILURE |
| + }; |
| + |
| + // State of the distillation of the suggestion. |
| + ReadingListSuggestionDistilledState distilled_state = |
| + ReadingListSuggestionDistilledState::PROCESSING; |
| + // 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 +163,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 +197,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 |