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

Unified Diff: components/ntp_snippets/remote/remote_suggestion.h

Issue 2686063003: [remote suggestions] Attach the fetch time to RemoteSnippets, ContentSnippets and SnippetArticle (Closed)
Patch Set: Update comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/remote/remote_suggestion.h
diff --git a/components/ntp_snippets/remote/remote_suggestion.h b/components/ntp_snippets/remote/remote_suggestion.h
index c08e7ecfd2678bc53ac3edb7eaf346471b2c3586..b558e83dfd10051246c710f75d123ffb6cbb4dab 100644
--- a/components/ntp_snippets/remote/remote_suggestion.h
+++ b/components/ntp_snippets/remote/remote_suggestion.h
@@ -38,14 +38,16 @@ class RemoteSuggestion {
// suggestion. The keys in the dictionary are expected to be the same as the
// property name, with exceptions documented in the property comment.
static std::unique_ptr<RemoteSuggestion> CreateFromChromeReaderDictionary(
- const base::DictionaryValue& dict);
+ const base::DictionaryValue& dict,
+ const base::Time& fetch_time);
// Creates a RemoteSuggestion from a dictionary, as returned by Chrome Content
// Suggestions. Returns a null pointer if the dictionary doesn't correspond to
// a valid suggestion. Maps field names to Chrome Reader field names.
static std::unique_ptr<RemoteSuggestion>
CreateFromContentSuggestionsDictionary(const base::DictionaryValue& dict,
- int remote_category_id);
+ int remote_category_id,
+ const base::Time& fetch_time);
// Creates an RemoteSuggestion from a protocol buffer. Returns a null pointer
// if the protocol buffer doesn't correspond to a valid suggestion.
@@ -63,6 +65,7 @@ class RemoteSuggestion {
// Creates a protocol buffer corresponding to this suggestion, for persisting.
SnippetProto ToProto() const;
+ // TODO(markusheintz): Move this method to the ContentSuggestion class.
Marc Treib 2017/02/10 16:16:56 No, this belongs here IMO. The general ContentSugg
markusheintz_ 2017/02/13 09:59:55 I'll remove the TODO. Not feeling strongly about i
// Coverts to general content suggestion form
ContentSuggestion ToContentSuggestion(Category category) const;
@@ -120,6 +123,8 @@ class RemoteSuggestion {
// CategoryFactory::FromRemoteCategory.
int remote_category_id() const { return remote_category_id_; }
+ base::Time fetch_time() const { return fetch_time_; }
+
// Public for testing.
static base::Time TimeFromJsonString(const std::string& timestamp_str);
static std::string TimeToJsonString(const base::Time& time);
@@ -152,6 +157,9 @@ class RemoteSuggestion {
bool should_notify_;
base::Time notification_deadline_;
+ // The time when the remote suggestions was fetched from the server.
+ base::Time fetch_time_;
+
DISALLOW_COPY_AND_ASSIGN(RemoteSuggestion);
};

Powered by Google App Engine
This is Rietveld 408576698