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

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

Issue 2059203002: Add ContentSuggestion, ContentSuggestionCategory and ContentSuggestionProviderType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed includes Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_NTP_SNIPPET_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/ntp_snippets/content_suggestion.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 } 19 }
19 20
20 namespace ntp_snippets { 21 namespace ntp_snippets {
21 22
22 class SnippetProto; 23 class SnippetProto;
23 24
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 !publish_date().is_null() && !expiry_date().is_null() && 119 !publish_date().is_null() && !expiry_date().is_null() &&
119 !best_source().publisher_name.empty(); 120 !best_source().publisher_name.empty();
120 } 121 }
121 122
122 float score() const { return score_; } 123 float score() const { return score_; }
123 void set_score(float score) { score_ = score; } 124 void set_score(float score) { score_ = score; }
124 125
125 bool is_discarded() const { return is_discarded_; } 126 bool is_discarded() const { return is_discarded_; }
126 void set_discarded(bool discarded) { is_discarded_ = discarded; } 127 void set_discarded(bool discarded) { is_discarded_ = discarded; }
127 128
129 std::unique_ptr<ContentSuggestion> ToContentSuggestion() const;
130
128 // Public for testing. 131 // Public for testing.
129 static base::Time TimeFromJsonString(const std::string& timestamp_str); 132 static base::Time TimeFromJsonString(const std::string& timestamp_str);
130 static std::string TimeToJsonString(const base::Time& time); 133 static std::string TimeToJsonString(const base::Time& time);
131 134
132 private: 135 private:
133 void FindBestSource(); 136 void FindBestSource();
134 137
135 std::string id_; 138 std::string id_;
136 std::string title_; 139 std::string title_;
137 GURL salient_image_url_; 140 GURL salient_image_url_;
138 std::string snippet_; 141 std::string snippet_;
139 base::Time publish_date_; 142 base::Time publish_date_;
140 base::Time expiry_date_; 143 base::Time expiry_date_;
141 float score_; 144 float score_;
142 bool is_discarded_; 145 bool is_discarded_;
143 146
144 size_t best_source_index_; 147 size_t best_source_index_;
145 148
146 std::vector<SnippetSource> sources_; 149 std::vector<SnippetSource> sources_;
147 150
148 DISALLOW_COPY_AND_ASSIGN(NTPSnippet); 151 DISALLOW_COPY_AND_ASSIGN(NTPSnippet);
149 }; 152 };
150 153
151 } // namespace ntp_snippets 154 } // namespace ntp_snippets
152 155
153 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 156 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_provider_type.h ('k') | components/ntp_snippets/ntp_snippet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698