Index: components/dom_distiller/core/distilled_page_prefs.h |
diff --git a/components/dom_distiller/core/distilled_page_prefs.h b/components/dom_distiller/core/distilled_page_prefs.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..60b1b3db9eb22a2859cc9f81e2893a7a5e781a9a |
--- /dev/null |
+++ b/components/dom_distiller/core/distilled_page_prefs.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ |
+#define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
+ |
+class PrefService; |
+ |
+namespace user_prefs { |
+class PrefRegistrySyncable; |
+} |
+ |
+namespace dom_distiller { |
+ |
+// Interface for preferences used for distilled page. |
+class DistilledPagePrefs { |
+ public: |
+ // Possible themes for distilled page. |
+ enum Theme { |
+ kLight, |
+ kDark, |
+ kSepia |
+ }; |
+ |
+ class Observer { |
+ public: |
+ virtual void OnChangeTheme(Theme theme) = 0; |
+ }; |
+ |
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
+ |
+ void AddObserver(Observer* obs); |
+ void RemoveObserver(Observer* obs); |
+ |
+ 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.
|
+ ~DistilledPagePrefs(); |
+ |
+ 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.
|
+ |
+ const Theme GetTheme() const; |
nyquist
2014/07/07 19:12:48
Add comment.
smaslo
2014/07/08 19:58:11
Done.
|
+ |
+ private: |
+ // Notifies all Observers of new theme. |
+ void NotifyOnChangeTheme(Theme theme); |
+ |
+ PrefService* pref_service_; |
+ ObserverList<Observer> observers_; |
+ |
+ base::WeakPtrFactory<DistilledPagePrefs> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefs); |
+}; |
+ |
+} // namespace dom_distiller |
+ |
+#endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ |