Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / dom_distiller / core / distilled_page_prefs.h
blob22b1327842f1b40456ea7e034ab24ce43aeb1441
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.
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h"
12 class PrefService;
14 namespace user_prefs {
15 class PrefRegistrySyncable;
18 namespace dom_distiller {
20 // Interface for preferences used for distilled page.
21 class DistilledPagePrefs {
22 public:
23 // Possible font families for distilled page.
24 enum FontFamily {
25 #define DEFINE_FONT_FAMILY(name, value) name = value,
26 #include "components/dom_distiller/core/font_family_list.h"
27 #undef DEFINE_FONT_FAMILY
30 // Possible themes for distilled page.
31 enum Theme {
32 #define DEFINE_THEME(name, value) name = value,
33 #include "components/dom_distiller/core/theme_list.h"
34 #undef DEFINE_THEME
37 class Observer {
38 public:
39 virtual void OnChangeFontFamily(FontFamily font) = 0;
40 virtual void OnChangeTheme(Theme theme) = 0;
43 explicit DistilledPagePrefs(PrefService* pref_service);
44 ~DistilledPagePrefs();
46 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
48 // Sets the user's preference for the font family of distilled pages.
49 void SetFontFamily(FontFamily new_font);
50 // Returns the user's preference for the font family of distilled pages.
51 FontFamily GetFontFamily();
53 // Sets the user's preference for the theme of distilled pages.
54 void SetTheme(Theme new_theme);
55 // Returns the user's preference for the theme of distilled pages.
56 Theme GetTheme();
58 void AddObserver(Observer* obs);
59 void RemoveObserver(Observer* obs);
61 private:
62 // Notifies all Observers of new font family.
63 void NotifyOnChangeFontFamily(FontFamily font_family);
64 // Notifies all Observers of new theme.
65 void NotifyOnChangeTheme(Theme theme);
67 PrefService* pref_service_;
68 base::ObserverList<Observer> observers_;
70 base::WeakPtrFactory<DistilledPagePrefs> weak_ptr_factory_;
72 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefs);
75 } // namespace dom_distiller
77 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_