OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 ~ContentSuggestion(); | 106 ~ContentSuggestion(); |
107 | 107 |
108 // An ID for identifying the suggestion. The ID is unique application-wide. | 108 // An ID for identifying the suggestion. The ID is unique application-wide. |
109 const ID& id() const { return id_; } | 109 const ID& id() const { return id_; } |
110 | 110 |
111 // The URL where the content referenced by the suggestion can be accessed. | 111 // The URL where the content referenced by the suggestion can be accessed. |
112 // This may be an AMP URL. | 112 // This may be an AMP URL. |
113 const GURL& url() const { return url_; } | 113 const GURL& url() const { return url_; } |
114 | 114 |
| 115 // The URL of a page that links to a favicon that represents the suggestion. |
| 116 // Can be empty. In such a case, url() should be used, instead. |
| 117 const GURL& url_with_favicon() const { return url_with_favicon_; } |
| 118 void set_url_with_favicon(const GURL& url_with_favicon) { |
| 119 url_with_favicon_ = url_with_favicon; |
| 120 } |
| 121 |
115 // Title of the suggestion. | 122 // Title of the suggestion. |
116 const base::string16& title() const { return title_; } | 123 const base::string16& title() const { return title_; } |
117 void set_title(const base::string16& title) { title_ = title; } | 124 void set_title(const base::string16& title) { title_ = title; } |
118 | 125 |
119 // Summary or relevant textual extract from the content. | 126 // Summary or relevant textual extract from the content. |
120 const base::string16& snippet_text() const { return snippet_text_; } | 127 const base::string16& snippet_text() const { return snippet_text_; } |
121 void set_snippet_text(const base::string16& snippet_text) { | 128 void set_snippet_text(const base::string16& snippet_text) { |
122 snippet_text_ = snippet_text; | 129 snippet_text_ = snippet_text; |
123 } | 130 } |
124 | 131 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 std::unique_ptr<NotificationExtra> notification_extra); | 186 std::unique_ptr<NotificationExtra> notification_extra); |
180 | 187 |
181 const base::Time& fetch_date() const { return fetch_date_; } | 188 const base::Time& fetch_date() const { return fetch_date_; } |
182 void set_fetch_date(const base::Time& fetch_date) { | 189 void set_fetch_date(const base::Time& fetch_date) { |
183 fetch_date_ = fetch_date; | 190 fetch_date_ = fetch_date; |
184 } | 191 } |
185 | 192 |
186 private: | 193 private: |
187 ID id_; | 194 ID id_; |
188 GURL url_; | 195 GURL url_; |
| 196 GURL url_with_favicon_; |
189 base::string16 title_; | 197 base::string16 title_; |
190 base::string16 snippet_text_; | 198 base::string16 snippet_text_; |
191 base::Time publish_date_; | 199 base::Time publish_date_; |
192 base::string16 publisher_name_; | 200 base::string16 publisher_name_; |
193 float score_; | 201 float score_; |
194 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_; | 202 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_; |
195 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; | 203 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; |
196 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra_; | 204 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra_; |
197 std::unique_ptr<NotificationExtra> notification_extra_; | 205 std::unique_ptr<NotificationExtra> notification_extra_; |
198 | 206 |
199 // The time when the remote suggestion was fetched from the server. This field | 207 // The time when the remote suggestion was fetched from the server. This field |
200 // is only populated when the ContentSuggestion is created from a | 208 // is only populated when the ContentSuggestion is created from a |
201 // RemoteSuggestion. | 209 // RemoteSuggestion. |
202 base::Time fetch_date_; | 210 base::Time fetch_date_; |
203 | 211 |
204 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); | 212 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); |
205 }; | 213 }; |
206 | 214 |
207 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); | 215 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); |
208 | 216 |
209 } // namespace ntp_snippets | 217 } // namespace ntp_snippets |
210 | 218 |
211 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 219 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
OLD | NEW |