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

Unified Diff: components/ntp_snippets/remote/remote_suggestions_fetcher.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_suggestions_fetcher.h
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher.h b/components/ntp_snippets/remote/remote_suggestions_fetcher.h
index 90ebbacea0b04de8f57c251d3899e7790a468171..a5f27c11d06c1e34d9c2295957a3cc575b612af8 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher.h
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher.h
@@ -14,6 +14,7 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
+#include "base/time/clock.h"
#include "base/time/tick_clock.h"
#include "components/ntp_snippets/category.h"
#include "components/ntp_snippets/category_info.h"
@@ -105,8 +106,8 @@ class RemoteSuggestionsFetcher : public OAuth2TokenService::Consumer,
const GURL& fetch_url() const { return fetch_url_; }
// Overrides internal clock for testing purposes.
- void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock) {
- tick_clock_ = std::move(tick_clock);
+ void SetClockForTesting(std::unique_ptr<base::Clock> clock) {
+ clock_ = std::move(clock);
}
private:
@@ -158,7 +159,8 @@ class RemoteSuggestionsFetcher : public OAuth2TokenService::Consumer,
const std::string& error_details);
bool JsonToSnippets(const base::Value& parsed,
- FetchedCategoriesVector* categories);
+ FetchedCategoriesVector* categories,
+ const base::Time& fetch_time);
bool DemandQuotaForRequest(bool interactive_request);
@@ -192,8 +194,8 @@ class RemoteSuggestionsFetcher : public OAuth2TokenService::Consumer,
// API key to use for non-authenticated requests.
const std::string api_key_;
- // Allow for an injectable tick clock for testing.
- std::unique_ptr<base::TickClock> tick_clock_;
+ // Allow for an injectable clock for testing.
+ std::unique_ptr<base::Clock> clock_;
// Classifier that tells us how active the user is. Not owned.
const UserClassifier* user_classifier_;

Powered by Google App Engine
This is Rietveld 408576698