| 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 const GURL& url_with_favicon() const { |
| 117 return url_with_favicon_.is_valid() ? url_with_favicon_ : url_; |
| 118 } |
| 119 void set_url_with_favicon(const GURL& url_with_favicon) { |
| 120 url_with_favicon_ = url_with_favicon; |
| 121 } |
| 122 |
| 115 // Title of the suggestion. | 123 // Title of the suggestion. |
| 116 const base::string16& title() const { return title_; } | 124 const base::string16& title() const { return title_; } |
| 117 void set_title(const base::string16& title) { title_ = title; } | 125 void set_title(const base::string16& title) { title_ = title; } |
| 118 | 126 |
| 119 // Summary or relevant textual extract from the content. | 127 // Summary or relevant textual extract from the content. |
| 120 const base::string16& snippet_text() const { return snippet_text_; } | 128 const base::string16& snippet_text() const { return snippet_text_; } |
| 121 void set_snippet_text(const base::string16& snippet_text) { | 129 void set_snippet_text(const base::string16& snippet_text) { |
| 122 snippet_text_ = snippet_text; | 130 snippet_text_ = snippet_text; |
| 123 } | 131 } |
| 124 | 132 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 std::unique_ptr<NotificationExtra> notification_extra); | 187 std::unique_ptr<NotificationExtra> notification_extra); |
| 180 | 188 |
| 181 const base::Time& fetch_date() const { return fetch_date_; } | 189 const base::Time& fetch_date() const { return fetch_date_; } |
| 182 void set_fetch_date(const base::Time& fetch_date) { | 190 void set_fetch_date(const base::Time& fetch_date) { |
| 183 fetch_date_ = fetch_date; | 191 fetch_date_ = fetch_date; |
| 184 } | 192 } |
| 185 | 193 |
| 186 private: | 194 private: |
| 187 ID id_; | 195 ID id_; |
| 188 GURL url_; | 196 GURL url_; |
| 197 GURL url_with_favicon_; |
| 189 base::string16 title_; | 198 base::string16 title_; |
| 190 base::string16 snippet_text_; | 199 base::string16 snippet_text_; |
| 191 base::Time publish_date_; | 200 base::Time publish_date_; |
| 192 base::string16 publisher_name_; | 201 base::string16 publisher_name_; |
| 193 float score_; | 202 float score_; |
| 194 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_; | 203 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_; |
| 195 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; | 204 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; |
| 196 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra_; | 205 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra_; |
| 197 std::unique_ptr<NotificationExtra> notification_extra_; | 206 std::unique_ptr<NotificationExtra> notification_extra_; |
| 198 | 207 |
| 199 // The time when the remote suggestion was fetched from the server. This field | 208 // The time when the remote suggestion was fetched from the server. This field |
| 200 // is only populated when the ContentSuggestion is created from a | 209 // is only populated when the ContentSuggestion is created from a |
| 201 // RemoteSuggestion. | 210 // RemoteSuggestion. |
| 202 base::Time fetch_date_; | 211 base::Time fetch_date_; |
| 203 | 212 |
| 204 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); | 213 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); |
| 205 }; | 214 }; |
| 206 | 215 |
| 207 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); | 216 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); |
| 208 | 217 |
| 209 } // namespace ntp_snippets | 218 } // namespace ntp_snippets |
| 210 | 219 |
| 211 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 220 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
| OLD | NEW |