Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ | |
| 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "base/observer_list.h" | |
| 11 | |
| 12 class PrefService; | |
| 13 | |
| 14 namespace user_prefs { | |
| 15 class PrefRegistrySyncable; | |
| 16 } | |
| 17 | |
| 18 namespace dom_distiller { | |
| 19 | |
| 20 // Interface for preferences used for distilled page. | |
| 21 class DistilledPagePrefs { | |
| 22 public: | |
| 23 // Possible themes for distilled page. | |
| 24 enum Theme { | |
| 25 kLight, | |
| 26 kDark, | |
| 27 kSepia | |
| 28 }; | |
| 29 | |
| 30 class Observer { | |
| 31 public: | |
| 32 virtual void OnChangeTheme(Theme theme) = 0; | |
| 33 }; | |
| 34 | |
| 35 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 36 | |
| 37 void AddObserver(Observer* obs); | |
| 38 void RemoveObserver(Observer* obs); | |
| 39 | |
| 40 explicit DistilledPagePrefs(PrefService* pref_service); | |
|
nyquist
2014/07/07 19:12:48
How about this ordering for the public methods?
C
smaslo
2014/07/08 19:58:11
Done.
| |
| 41 ~DistilledPagePrefs(); | |
| 42 | |
| 43 void SetTheme(Theme new_theme); | |
|
nyquist
2014/07/07 19:12:48
Add comment (What is this used for? Why is it need
smaslo
2014/07/08 19:58:11
Done.
| |
| 44 | |
| 45 const Theme GetTheme() const; | |
|
nyquist
2014/07/07 19:12:48
Add comment.
smaslo
2014/07/08 19:58:11
Done.
| |
| 46 | |
| 47 private: | |
| 48 // Notifies all Observers of new theme. | |
| 49 void NotifyOnChangeTheme(Theme theme); | |
| 50 | |
| 51 PrefService* pref_service_; | |
| 52 ObserverList<Observer> observers_; | |
| 53 | |
| 54 base::WeakPtrFactory<DistilledPagePrefs> weak_ptr_factory_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefs); | |
| 57 }; | |
| 58 | |
| 59 } // namespace dom_distiller | |
| 60 | |
| 61 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ | |
| OLD | NEW |