Chromium Code Reviews| Index: components/dom_distiller/core/reader_mode_preferences.h |
| diff --git a/components/dom_distiller/core/reader_mode_preferences.h b/components/dom_distiller/core/reader_mode_preferences.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8a0f22ab39560336e87ea73c0ad97b567c8693b4 |
| --- /dev/null |
| +++ b/components/dom_distiller/core/reader_mode_preferences.h |
| @@ -0,0 +1,58 @@ |
| +// 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_READER_MODE_PREFERENCES_H_ |
| +#define COMPONENTS_DOM_DISTILLER_CORE_READER_MODE_PREFERENCES_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/observer_list.h" |
| + |
| +class PrefService; |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +namespace dom_distiller { |
| + |
| +// Interface for preferences used in reader mode view |
|
nyquist
2014/06/26 20:39:59
Nit: All comments like this should end with a peri
smaslo
2014/06/27 18:33:18
Done.
|
| +class ReaderModePrefs { |
| + public: |
| + |
| + // Possible themes for reader mode |
|
nyquist
2014/06/26 20:39:59
Nit: end with period
smaslo
2014/06/27 18:33:18
Done.
|
| + enum Theme { |
| + kNormal, |
|
nyquist
2014/06/26 20:39:58
See comment in CSS about naming. Make sure these t
smaslo
2014/06/27 18:33:18
Done.
|
| + kHighContrast, |
| + kSepia |
| + }; |
| + |
| + explicit ReaderModePrefs(PrefService* pref_service); |
| + ~ReaderModePrefs(); |
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| + |
| + void SetThemePref(Theme new_theme); |
| + |
| + class Observer { |
|
nyquist
2014/06/26 20:39:58
I think the observer class usually goes at the top
smaslo
2014/06/27 18:33:18
I put it below the enum because it needs to know a
|
| + public: |
| + virtual void OnChangeTheme(ReaderModePrefs* reader_mode_prefs) = 0; |
|
nyquist
2014/06/26 20:39:58
Do you need the pointer to the ReaderModePrefs? Wo
smaslo
2014/06/27 18:33:18
Done.
|
| + }; |
| + |
| + void AddObserver(Observer* obs); |
| + void RemoveObserver(Observer* obs); |
| + |
| + const char* GetBodyCssClass(); |
|
nyquist
2014/06/26 20:39:59
Could this method make take in a theme as an argum
smaslo
2014/06/27 18:33:18
I made it a static method rather than a const meth
|
| + Theme GetThemePref(); |
|
nyquist
2014/06/26 20:39:58
Can this return const and also be const itself?
smaslo
2014/06/27 18:33:18
Done.
|
| + |
| + private: |
| + PrefService* pref_service_; |
| + ObserverList<Observer> observer_list_; |
| + |
| + void NotifyOnChangeTheme(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ReaderModePrefs); |
| +}; |
| + |
| +} // namespace dom_distiller |
| + |
| +#endif // COMPONENTS_DOM_DISTILLER_CORE_READER_MODE_PREFERENCES_H_ |