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

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: rebase 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..615c4fbe37708f99258852dce4193e63e291e809 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_date);
// 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_date);
// Creates an RemoteSuggestion from a protocol buffer. Returns a null pointer
// if the protocol buffer doesn't correspond to a valid suggestion.
@@ -120,6 +122,8 @@ class RemoteSuggestion {
// CategoryFactory::FromRemoteCategory.
int remote_category_id() const { return remote_category_id_; }
+ base::Time fetch_date() const { return fetch_date_; }
+
// Public for testing.
static base::Time TimeFromJsonString(const std::string& timestamp_str);
static std::string TimeToJsonString(const base::Time& time);
@@ -152,6 +156,9 @@ class RemoteSuggestion {
bool should_notify_;
base::Time notification_deadline_;
+ // The time when the remote suggestion was fetched from the server.
+ base::Time fetch_date_;
+
DISALLOW_COPY_AND_ASSIGN(RemoteSuggestion);
};
« no previous file with comments | « components/ntp_snippets/remote/proto/ntp_snippets.proto ('k') | components/ntp_snippets/remote/remote_suggestion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698