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

Unified Diff: components/doodle/doodle_service.h

Issue 2744253002: [Doodle] Cache the DoodleConfig in prefs (Closed)
Patch Set: pass clock as unique_ptr 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
« no previous file with comments | « components/doodle/DEPS ('k') | components/doodle/doodle_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_service.h
diff --git a/components/doodle/doodle_service.h b/components/doodle/doodle_service.h
index 8913fbf144b8f76005fe457ebcfc947b723f1530..85c5cec35b27707fa00ea0cc1caba5c921261826 100644
--- a/components/doodle/doodle_service.h
+++ b/components/doodle/doodle_service.h
@@ -10,10 +10,14 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/optional.h"
+#include "base/time/clock.h"
#include "base/timer/timer.h"
#include "components/doodle/doodle_fetcher.h"
#include "components/doodle/doodle_types.h"
+class PrefRegistrySimple;
+class PrefService;
+
namespace base {
class TimeDelta;
}
@@ -27,9 +31,13 @@ class DoodleService {
virtual void OnDoodleConfigUpdated(const base::Optional<DoodleConfig>&) = 0;
};
- // Both |fetcher| and |expiry_timer| must be non-null.
- DoodleService(std::unique_ptr<DoodleFetcher> fetcher,
- std::unique_ptr<base::OneShotTimer> expiry_timer);
+ static void RegisterProfilePrefs(PrefRegistrySimple* pref_registry);
+
+ // All parameters must be non-null.
+ DoodleService(PrefService* pref_service,
+ std::unique_ptr<DoodleFetcher> fetcher,
+ std::unique_ptr<base::OneShotTimer> expiry_timer,
+ std::unique_ptr<base::Clock> clock);
~DoodleService();
// Returns the current (cached) config, if any.
@@ -54,15 +62,19 @@ class DoodleService {
base::TimeDelta time_to_live,
const base::Optional<DoodleConfig>& doodle_config);
- void UpdateTimeToLive(base::TimeDelta time_to_live);
+ void UpdateCachedConfig(base::TimeDelta time_to_live,
+ const base::Optional<DoodleConfig>& doodle_config);
// Callback for the expiry timer.
void DoodleExpired();
+ PrefService* pref_service_;
+
// The fetcher for getting fresh DoodleConfigs from the network.
std::unique_ptr<DoodleFetcher> fetcher_;
std::unique_ptr<base::OneShotTimer> expiry_timer_;
+ std::unique_ptr<base::Clock> clock_;
// The result of the last network fetch.
base::Optional<DoodleConfig> cached_config_;
« no previous file with comments | « components/doodle/DEPS ('k') | components/doodle/doodle_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698