Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: components/dom_distiller/core/distilled_page_prefs.h

Issue 1225183002: Font size in DomDistiller prefs syncs with local scaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge master again Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 20 matching lines...) Expand all
31 enum Theme { 31 enum Theme {
32 #define DEFINE_THEME(name, value) name = value, 32 #define DEFINE_THEME(name, value) name = value,
33 #include "components/dom_distiller/core/theme_list.h" 33 #include "components/dom_distiller/core/theme_list.h"
34 #undef DEFINE_THEME 34 #undef DEFINE_THEME
35 }; 35 };
36 36
37 class Observer { 37 class Observer {
38 public: 38 public:
39 virtual void OnChangeFontFamily(FontFamily font) = 0; 39 virtual void OnChangeFontFamily(FontFamily font) = 0;
40 virtual void OnChangeTheme(Theme theme) = 0; 40 virtual void OnChangeTheme(Theme theme) = 0;
41 virtual void OnChangeFontScaling(float scaling) = 0;
41 }; 42 };
42 43
43 explicit DistilledPagePrefs(PrefService* pref_service); 44 explicit DistilledPagePrefs(PrefService* pref_service);
44 ~DistilledPagePrefs(); 45 ~DistilledPagePrefs();
45 46
46 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 47 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
47 48
48 // Sets the user's preference for the font family of distilled pages. 49 // Sets the user's preference for the font family of distilled pages.
49 void SetFontFamily(FontFamily new_font); 50 void SetFontFamily(FontFamily new_font);
50 // Returns the user's preference for the font family of distilled pages. 51 // Returns the user's preference for the font family of distilled pages.
51 FontFamily GetFontFamily(); 52 FontFamily GetFontFamily();
52 53
53 // Sets the user's preference for the theme of distilled pages. 54 // Sets the user's preference for the theme of distilled pages.
54 void SetTheme(Theme new_theme); 55 void SetTheme(Theme new_theme);
55 // Returns the user's preference for the theme of distilled pages. 56 // Returns the user's preference for the theme of distilled pages.
56 Theme GetTheme(); 57 Theme GetTheme();
57 58
59 // Sets the user's preference for the font size scaling of distilled pages.
60 void SetFontScaling(float scaling);
61 // Returns the user's preference for the font size scaling of distilled pages.
62 float GetFontScaling();
63
58 void AddObserver(Observer* obs); 64 void AddObserver(Observer* obs);
59 void RemoveObserver(Observer* obs); 65 void RemoveObserver(Observer* obs);
60 66
61 private: 67 private:
62 // Notifies all Observers of new font family. 68 // Notifies all Observers of new font family.
63 void NotifyOnChangeFontFamily(FontFamily font_family); 69 void NotifyOnChangeFontFamily(FontFamily font_family);
64 // Notifies all Observers of new theme. 70 // Notifies all Observers of new theme.
65 void NotifyOnChangeTheme(Theme theme); 71 void NotifyOnChangeTheme(Theme theme);
72 // Notifies all Observers of new font scaling.
73 void NotifyOnChangeFontScaling(float scaling);
74
66 75
67 PrefService* pref_service_; 76 PrefService* pref_service_;
68 base::ObserverList<Observer> observers_; 77 base::ObserverList<Observer> observers_;
69 78
70 base::WeakPtrFactory<DistilledPagePrefs> weak_ptr_factory_; 79 base::WeakPtrFactory<DistilledPagePrefs> weak_ptr_factory_;
71 80
72 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefs); 81 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefs);
73 }; 82 };
74 83
75 } // namespace dom_distiller 84 } // namespace dom_distiller
76 85
77 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_ 86 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698