Chromium Code Reviews| Index: components/ntp_snippets/remote/ntp_snippet.h |
| diff --git a/components/ntp_snippets/remote/ntp_snippet.h b/components/ntp_snippets/remote/ntp_snippet.h |
| index f14d3ad64fc2c24c31f02116f5fa4fafd4639146..c39945ecd490337d1094646733f77cbf5663a291 100644 |
| --- a/components/ntp_snippets/remote/ntp_snippet.h |
| +++ b/components/ntp_snippets/remote/ntp_snippet.h |
| @@ -12,7 +12,6 @@ |
| #include "base/macros.h" |
| #include "base/time/time.h" |
| -#include "components/ntp_snippets/category.h" |
| #include "url/gurl.h" |
| namespace base { |
| @@ -40,7 +39,7 @@ class NTPSnippet { |
| // Creates a new snippet with the given |id|. |
| // Public for testing only - create snippets using the Create* methods below. |
| // TODO(treib): Make this private and add a CreateSnippetForTest? |
| - explicit NTPSnippet(const std::string& id); |
| + explicit NTPSnippet(const std::string& id, int remote_category_id); |
|
Bernhard Bauer
2016/10/10 13:54:54
Nit: no explicit anymore
Marc Treib
2016/10/10 15:54:47
Done.
|
| ~NTPSnippet(); |
| @@ -55,7 +54,8 @@ class NTPSnippet { |
| // Suggestions. Returns a null pointer if the dictionary doesn't correspond to |
| // a valid snippet. Maps field names to Chrome Reader field names. |
| static std::unique_ptr<NTPSnippet> CreateFromContentSuggestionsDictionary( |
| - const base::DictionaryValue& dict); |
| + const base::DictionaryValue& dict, |
| + int remote_category_id); |
| // Creates an NTPSnippet from a protocol buffer. Returns a null pointer if the |
| // protocol buffer doesn't correspond to a valid snippet. |
| @@ -66,8 +66,6 @@ class NTPSnippet { |
| // A unique ID for identifying the snippet. If initialized by |
| // CreateFromChromeReaderDictionary() the relevant key is 'url'. |
| - // TODO(treib): For now, the ID has to be a valid URL spec, otherwise |
| - // fetching the salient image will fail. See TODO in ntp_snippets_service.cc. |
| const std::string& id() const { return id_; } |
| // Title of the snippet. |
| @@ -127,6 +125,10 @@ class NTPSnippet { |
| bool is_dismissed() const { return is_dismissed_; } |
| void set_dismissed(bool dismissed) { is_dismissed_ = dismissed; } |
| + // The ID of the remote category this snippet belongs to, for use with |
| + // CategoryFactory::FromRemoteCategory. |
| + int remote_category_id() const { return remote_category_id_; } |
| + |
| // Public for testing. |
| static base::Time TimeFromJsonString(const std::string& timestamp_str); |
| static std::string TimeToJsonString(const base::Time& time); |
| @@ -142,6 +144,7 @@ class NTPSnippet { |
| base::Time expiry_date_; |
| float score_; |
| bool is_dismissed_; |
| + int remote_category_id_; |
| size_t best_source_index_; |