1 // Copyright (c) 2011 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. 4 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ 7 #pragma once 8 9 #include "chrome/browser/prefs/pref_member.h" 10 #include "chrome/browser/ui/webui/options/font_settings_fonts_list_loader.h" 11 #include "chrome/browser/ui/webui/options/options_ui.h" 12 13 // Font settings overlay page UI handler. 14 class FontSettingsHandler : public OptionsPageUIHandler, 15 public FontSettingsFontsListLoader::Observer { 16 public: 17 FontSettingsHandler(); 18 virtual ~FontSettingsHandler(); 19 20 // OptionsPageUIHandler implementation. 21 virtual void GetLocalizedValues(DictionaryValue* localized_strings); 22 virtual void Initialize(); 23 24 // WebUIMessageHandler implementation. 25 virtual WebUIMessageHandler* Attach(WebUI* web_ui); 26 virtual void RegisterMessages(); 27 28 // NotificationObserver implementation. 29 virtual void Observe(NotificationType type, 30 const NotificationSource& source, 31 const NotificationDetails& details); 32 33 // FontSettingsFontsListLoader::Observer implementation. 34 virtual void FontsListHasLoaded(); 35 36 private: 37 void HandleFetchFontsData(const ListValue* args); 38 39 void SetUpStandardFontSample(); 40 void SetUpSerifFontSample(); 41 void SetUpSansSerifFontSample(); 42 void SetUpFixedFontSample(); 43 void SetUpMinimumFontSample(); 44 45 StringPrefMember standard_font_; 46 StringPrefMember serif_font_; 47 StringPrefMember sans_serif_font_; 48 StringPrefMember fixed_font_; 49 StringPrefMember font_encoding_; 50 IntegerPrefMember default_font_size_; 51 IntegerPrefMember default_fixed_font_size_; 52 IntegerPrefMember minimum_font_size_; 53 54 scoped_refptr<FontSettingsFontsListLoader> fonts_list_loader_; 55 56 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler); 57 }; 58 59 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ 60