| 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_;
|
|
|