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

Unified Diff: components/ntp_snippets/content_suggestion.h

Issue 2616543002: Expose notification info in ContentSuggestion (Closed)
Patch Set: Address comments Created 3 years, 11 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 | « no previous file | 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 33c84c0b66e53204f6af8937f8e34d46a806fc94..fa653b1a8a178b9f7159a691d6066ba2e92cd38d 100644
--- a/components/ntp_snippets/content_suggestion.h
+++ b/components/ntp_snippets/content_suggestion.h
@@ -43,6 +43,14 @@ struct RecentTabSuggestionExtra {
int64_t offline_page_id = 0;
};
+// Contains additional data for notification-worthy suggestions.
+struct NotificationExtra {
+ // Deadline for showing notification. If the deadline is past, the
+ // notification is no longer fresh and no notification should be sent. If the
+ // deadline passes while a notification is up, it should be canceled.
+ base::Time deadline;
+};
+
// A content suggestion for the new tab page, which can be an article or an
// offline page, for example.
class ContentSuggestion {
@@ -133,6 +141,16 @@ class ContentSuggestion {
void set_recent_tab_suggestion_extra(
std::unique_ptr<RecentTabSuggestionExtra> recent_tab_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;
+ // notifications are disabled; Chrome is in the foreground).
+ NotificationExtra* notification_extra() const {
+ return notification_extra_.get();
+ }
+ void set_notification_extra(
+ std::unique_ptr<NotificationExtra> notification_extra);
+
private:
ID id_;
GURL url_;
@@ -143,6 +161,7 @@ class ContentSuggestion {
float score_;
std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_;
std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_;
+ std::unique_ptr<NotificationExtra> notification_extra_;
DISALLOW_COPY_AND_ASSIGN(ContentSuggestion);
};
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698