| 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. | 115 // The URL of the page that links to a favicon that represents the suggestion. |
| 116 const GURL& url_with_favicon() const { | 116 // Path is trimmed for the URL because the current favicon server backend |
| 117 return url_with_favicon_.is_valid() ? url_with_favicon_ : url_; | 117 // prefers it this way. |
| 118 GURL url_with_favicon() const { |
| 119 return url_with_favicon_.is_valid() ? GetFaviconDomain(url_with_favicon_) |
| 120 : GetFaviconDomain(url_); |
| 118 } | 121 } |
| 119 void set_url_with_favicon(const GURL& url_with_favicon) { | 122 void set_url_with_favicon(const GURL& url_with_favicon) { |
| 120 url_with_favicon_ = url_with_favicon; | 123 url_with_favicon_ = url_with_favicon; |
| 121 } | 124 } |
| 122 | 125 |
| 126 static GURL GetFaviconDomain(const GURL& favicon_url); |
| 127 |
| 123 // Title of the suggestion. | 128 // Title of the suggestion. |
| 124 const base::string16& title() const { return title_; } | 129 const base::string16& title() const { return title_; } |
| 125 void set_title(const base::string16& title) { title_ = title; } | 130 void set_title(const base::string16& title) { title_ = title; } |
| 126 | 131 |
| 127 // Summary or relevant textual extract from the content. | 132 // Summary or relevant textual extract from the content. |
| 128 const base::string16& snippet_text() const { return snippet_text_; } | 133 const base::string16& snippet_text() const { return snippet_text_; } |
| 129 void set_snippet_text(const base::string16& snippet_text) { | 134 void set_snippet_text(const base::string16& snippet_text) { |
| 130 snippet_text_ = snippet_text; | 135 snippet_text_ = snippet_text; |
| 131 } | 136 } |
| 132 | 137 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 base::Time fetch_date_; | 216 base::Time fetch_date_; |
| 212 | 217 |
| 213 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); | 218 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); |
| 214 }; | 219 }; |
| 215 | 220 |
| 216 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); | 221 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); |
| 217 | 222 |
| 218 } // namespace ntp_snippets | 223 } // namespace ntp_snippets |
| 219 | 224 |
| 220 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 225 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
| OLD | NEW |