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

Side by Side Diff: components/ntp_snippets/content_suggestion.h

Issue 2593573003: Ntp: use AMP urls for content suggestions when available. (Closed)
Patch Set: Address review comments by vitalii. Created 3 years, 12 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 unified diff | Download patch
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const std::string& id_within_category, 75 const std::string& id_within_category,
76 const GURL& url); 76 const GURL& url);
77 ContentSuggestion(ContentSuggestion&&); 77 ContentSuggestion(ContentSuggestion&&);
78 ContentSuggestion& operator=(ContentSuggestion&&); 78 ContentSuggestion& operator=(ContentSuggestion&&);
79 79
80 ~ContentSuggestion(); 80 ~ContentSuggestion();
81 81
82 // An ID for identifying the suggestion. The ID is unique application-wide. 82 // An ID for identifying the suggestion. The ID is unique application-wide.
83 const ID& id() const { return id_; } 83 const ID& id() const { return id_; }
84 84
85 // The normal content URL where the content referenced by the suggestion can 85 // The URL where the content referenced by the suggestion can be accessed.
86 // be accessed. 86 // This may be an AMP URL.
87 const GURL& url() const { return url_; } 87 const GURL& url() const { return url_; }
88 88
89 // If available, this contains an URL to an AMP version of the same content.
90 // Otherwise, this is an empty GURL().
91 const GURL& amp_url() const { return amp_url_; }
92 void set_amp_url(const GURL& amp_url) { amp_url_ = amp_url; }
93
94 // Title of the suggestion. 89 // Title of the suggestion.
95 const base::string16& title() const { return title_; } 90 const base::string16& title() const { return title_; }
96 void set_title(const base::string16& title) { title_ = title; } 91 void set_title(const base::string16& title) { title_ = title; }
97 92
98 // Summary or relevant textual extract from the content. 93 // Summary or relevant textual extract from the content.
99 const base::string16& snippet_text() const { return snippet_text_; } 94 const base::string16& snippet_text() const { return snippet_text_; }
100 void set_snippet_text(const base::string16& snippet_text) { 95 void set_snippet_text(const base::string16& snippet_text) {
101 snippet_text_ = snippet_text; 96 snippet_text_ = snippet_text;
102 } 97 }
103 98
(...skipping 30 matching lines...) Expand all
134 // KnownCategories::RECENT_TABS suggestions. 129 // KnownCategories::RECENT_TABS suggestions.
135 RecentTabSuggestionExtra* recent_tab_suggestion_extra() const { 130 RecentTabSuggestionExtra* recent_tab_suggestion_extra() const {
136 return recent_tab_suggestion_extra_.get(); 131 return recent_tab_suggestion_extra_.get();
137 } 132 }
138 void set_recent_tab_suggestion_extra( 133 void set_recent_tab_suggestion_extra(
139 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra); 134 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra);
140 135
141 private: 136 private:
142 ID id_; 137 ID id_;
143 GURL url_; 138 GURL url_;
144 GURL amp_url_;
145 base::string16 title_; 139 base::string16 title_;
146 base::string16 snippet_text_; 140 base::string16 snippet_text_;
147 base::Time publish_date_; 141 base::Time publish_date_;
148 base::string16 publisher_name_; 142 base::string16 publisher_name_;
149 float score_; 143 float score_;
150 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_; 144 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra_;
151 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; 145 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_;
152 146
153 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); 147 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion);
154 }; 148 };
155 149
156 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); 150 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id);
157 151
158 } // namespace ntp_snippets 152 } // namespace ntp_snippets
159 153
160 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ 154 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/snippets_internals_message_handler.cc ('k') | components/ntp_snippets/features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698