- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / font_settings_handler.h
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
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
8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_member.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h"
11 #include "content/public/browser/notification_registrar.h"
12
13 namespace base {
14 class ListValue;
15 }
16
17 namespace extensions {
18 class Extension;
19 }
20
21 namespace options {
22
23 // Font settings overlay page UI handler.
24 class FontSettingsHandler : public OptionsPageUIHandler {
25  public:
26   FontSettingsHandler();
27   virtual ~FontSettingsHandler();
28
29   // OptionsPageUIHandler implementation.
30   virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE;
31   virtual void InitializeHandler() OVERRIDE;
32   virtual void InitializePage() OVERRIDE;
33
34   // WebUIMessageHandler implementation.
35   virtual void RegisterMessages() OVERRIDE;
36
37  private:
38   // OptionsPageUIHandler implementation.
39   virtual void Observe(int type,
40                        const content::NotificationSource& source,
41                        const content::NotificationDetails& details) OVERRIDE;
42
43   void HandleFetchFontsData(const ListValue* args);
44
45   void FontsListHasLoaded(scoped_ptr<base::ListValue> list);
46
47   void SetUpStandardFontSample();
48   void SetUpSerifFontSample();
49   void SetUpSansSerifFontSample();
50   void SetUpFixedFontSample();
51   void SetUpMinimumFontSample();
52
53   // Returns the Advanced Font Settings Extension if it's installed and enabled,
54   // or NULL otherwise.
55   const extensions::Extension* GetAdvancedFontSettingsExtension();
56   // Notifies the web UI about whether the Advanced Font Settings Extension is
57   // installed and enabled.
58   void NotifyAdvancedFontSettingsAvailability();
59   // Opens the options page of the Advanced Font Settings Extension.
60   void HandleOpenAdvancedFontSettingsOptions(const base::ListValue* args);
61
62   void OnWebKitDefaultFontSizeChanged();
63
64   StringPrefMember standard_font_;
65   StringPrefMember serif_font_;
66   StringPrefMember sans_serif_font_;
67   StringPrefMember fixed_font_;
68   StringPrefMember font_encoding_;
69   IntegerPrefMember default_font_size_;
70   IntegerPrefMember default_fixed_font_size_;
71   IntegerPrefMember minimum_font_size_;
72
73   content::NotificationRegistrar registrar_;
74
75   DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler);
76 };
77
78 }  // namespace options
79
80 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_