| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/public/pref_observer.h" |
| 9 #include "chrome/browser/api/prefs/pref_member.h" | 10 #include "chrome/browser/api/prefs/pref_member.h" |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | 11 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class ListValue; | 14 class ListValue; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace options { | 17 namespace options { |
| 17 | 18 |
| 18 // Font settings overlay page UI handler. | 19 // Font settings overlay page UI handler. |
| 19 class FontSettingsHandler : public OptionsPageUIHandler { | 20 class FontSettingsHandler : public OptionsPageUIHandler, |
| 21 public PrefObserver { |
| 20 public: | 22 public: |
| 21 FontSettingsHandler(); | 23 FontSettingsHandler(); |
| 22 virtual ~FontSettingsHandler(); | 24 virtual ~FontSettingsHandler(); |
| 23 | 25 |
| 24 // OptionsPageUIHandler implementation. | 26 // OptionsPageUIHandler implementation. |
| 25 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 27 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
| 26 virtual void InitializePage() OVERRIDE; | 28 virtual void InitializePage() OVERRIDE; |
| 27 | 29 |
| 28 // WebUIMessageHandler implementation. | 30 // WebUIMessageHandler implementation. |
| 29 virtual void RegisterMessages() OVERRIDE; | 31 virtual void RegisterMessages() OVERRIDE; |
| 30 | 32 |
| 31 // content::NotificationObserver implementation. | 33 // PrefObserver implementation. |
| 32 virtual void Observe(int type, | 34 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 33 const content::NotificationSource& source, | 35 const std::string& pref_name) OVERRIDE; |
| 34 const content::NotificationDetails& details) OVERRIDE; | |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 void HandleFetchFontsData(const ListValue* args); | 38 void HandleFetchFontsData(const ListValue* args); |
| 38 | 39 |
| 39 void FontsListHasLoaded(scoped_ptr<base::ListValue> list); | 40 void FontsListHasLoaded(scoped_ptr<base::ListValue> list); |
| 40 | 41 |
| 41 void SetUpStandardFontSample(); | 42 void SetUpStandardFontSample(); |
| 42 void SetUpSerifFontSample(); | 43 void SetUpSerifFontSample(); |
| 43 void SetUpSansSerifFontSample(); | 44 void SetUpSansSerifFontSample(); |
| 44 void SetUpFixedFontSample(); | 45 void SetUpFixedFontSample(); |
| 45 void SetUpMinimumFontSample(); | 46 void SetUpMinimumFontSample(); |
| 46 | 47 |
| 47 StringPrefMember standard_font_; | 48 StringPrefMember standard_font_; |
| 48 StringPrefMember serif_font_; | 49 StringPrefMember serif_font_; |
| 49 StringPrefMember sans_serif_font_; | 50 StringPrefMember sans_serif_font_; |
| 50 StringPrefMember fixed_font_; | 51 StringPrefMember fixed_font_; |
| 51 StringPrefMember font_encoding_; | 52 StringPrefMember font_encoding_; |
| 52 IntegerPrefMember default_font_size_; | 53 IntegerPrefMember default_font_size_; |
| 53 IntegerPrefMember default_fixed_font_size_; | 54 IntegerPrefMember default_fixed_font_size_; |
| 54 IntegerPrefMember minimum_font_size_; | 55 IntegerPrefMember minimum_font_size_; |
| 55 | 56 |
| 56 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler); | 57 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler); |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 } // namespace options | 60 } // namespace options |
| 60 | 61 |
| 61 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 62 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
| OLD | NEW |