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

Unified Diff: components/ntp_snippets/user_classifier.h

Issue 2759423003: [UserClassifier] Inject a clock (Closed)
Patch Set: Created 3 years, 9 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/user_classifier.h
diff --git a/components/ntp_snippets/user_classifier.h b/components/ntp_snippets/user_classifier.h
index 477e23ac760d1c3b9704e2292f8e0bd0b9e06901..93be8fa42e02af8807fd89b0621d0b5980c1f578 100644
--- a/components/ntp_snippets/user_classifier.h
+++ b/components/ntp_snippets/user_classifier.h
@@ -5,14 +5,18 @@
#ifndef COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_
#define COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/time/time.h"
class PrefRegistrySimple;
class PrefService;
+namespace base {
+class Clock;
+} // namespace base
+
namespace ntp_snippets {
// Collects data about user usage patterns of content suggestions, computes
@@ -52,7 +56,7 @@ class UserClassifier {
};
// The provided |pref_service| may be nullptr in unit-tests.
- explicit UserClassifier(PrefService* pref_service);
+ UserClassifier(PrefService* pref_service, std::unique_ptr<base::Clock> clock);
~UserClassifier();
// Registers profile prefs for all metrics. Called from browser_prefs.cc.
@@ -93,6 +97,7 @@ class UserClassifier {
void ClearMetricValue(Metric metric);
PrefService* pref_service_;
+ std::unique_ptr<base::Clock> clock_;
// Params of the metric.
const double discount_rate_per_hour_;

Powered by Google App Engine
This is Rietveld 408576698