| 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() ? url_with_favicon_.GetWithEmptyPath() |
| 120 : url_.GetWithEmptyPath(); |
| 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 |
| 123 // Title of the suggestion. | 126 // Title of the suggestion. |
| 124 const base::string16& title() const { return title_; } | 127 const base::string16& title() const { return title_; } |
| 125 void set_title(const base::string16& title) { title_ = title; } | 128 void set_title(const base::string16& title) { title_ = title; } |
| 126 | 129 |
| 127 // Summary or relevant textual extract from the content. | 130 // Summary or relevant textual extract from the content. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 base::Time fetch_date_; | 214 base::Time fetch_date_; |
| 212 | 215 |
| 213 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); | 216 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); |
| 214 }; | 217 }; |
| 215 | 218 |
| 216 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); | 219 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); |
| 217 | 220 |
| 218 } // namespace ntp_snippets | 221 } // namespace ntp_snippets |
| 219 | 222 |
| 220 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ | 223 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ |
| OLD | NEW |