| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DOODLE_DOODLE_SERVICE_H_ | 5 #ifndef COMPONENTS_DOODLE_DOODLE_SERVICE_H_ |
| 6 #define COMPONENTS_DOODLE_DOODLE_SERVICE_H_ | 6 #define COMPONENTS_DOODLE_DOODLE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/optional.h" | 12 #include "base/optional.h" |
| 13 #include "base/time/clock.h" | 13 #include "base/time/clock.h" |
| 14 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "components/doodle/doodle_fetcher.h" | 17 #include "components/doodle/doodle_fetcher.h" |
| 18 #include "components/doodle/doodle_types.h" | 18 #include "components/doodle/doodle_types.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
| 20 | 20 |
| 21 class PrefRegistrySimple; | 21 class PrefRegistrySimple; |
| 22 class PrefService; | 22 class PrefService; |
| 23 | 23 |
| 24 namespace doodle { | 24 namespace doodle { |
| 25 | 25 |
| 26 class DoodleService : public KeyedService { | 26 class DoodleService : public KeyedService { |
| 27 public: | 27 public: |
| 28 class Observer { | 28 class Observer { |
| 29 public: | 29 public: |
| 30 virtual void OnDoodleConfigRevalidated() = 0; |
| 30 virtual void OnDoodleConfigUpdated(const base::Optional<DoodleConfig>&) = 0; | 31 virtual void OnDoodleConfigUpdated(const base::Optional<DoodleConfig>&) = 0; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 static void RegisterProfilePrefs(PrefRegistrySimple* pref_registry); | 34 static void RegisterProfilePrefs(PrefRegistrySimple* pref_registry); |
| 34 | 35 |
| 35 // All pointer parameters must be non-null. If |min_refresh_interval| doesn't | 36 // All pointer parameters must be non-null. If |min_refresh_interval| doesn't |
| 36 // have a value, the default value is used. | 37 // have a value, the default value is used. |
| 37 DoodleService(PrefService* pref_service, | 38 DoodleService(PrefService* pref_service, |
| 38 std::unique_ptr<DoodleFetcher> fetcher, | 39 std::unique_ptr<DoodleFetcher> fetcher, |
| 39 std::unique_ptr<base::OneShotTimer> expiry_timer, | 40 std::unique_ptr<base::OneShotTimer> expiry_timer, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 // The list of observers to be notified when the DoodleConfig changes. | 127 // The list of observers to be notified when the DoodleConfig changes. |
| 127 base::ObserverList<Observer> observers_; | 128 base::ObserverList<Observer> observers_; |
| 128 | 129 |
| 129 DISALLOW_COPY_AND_ASSIGN(DoodleService); | 130 DISALLOW_COPY_AND_ASSIGN(DoodleService); |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 } // namespace doodle | 133 } // namespace doodle |
| 133 | 134 |
| 134 #endif // COMPONENTS_DOODLE_DOODLE_SERVICE_H_ | 135 #endif // COMPONENTS_DOODLE_DOODLE_SERVICE_H_ |
| OLD | NEW |