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.
5 // A struct for managing webkit's settings.
7 // Adding new values to this class probably involves updating
8 // WebKit::WebSettings, content/common/view_messages.h, browser/tab_contents/
9 // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc.
11 #ifndef WEBKIT_GLUE_WEBPREFERENCES_H__
12 #define WEBKIT_GLUE_WEBPREFERENCES_H__
18 #include "base/string16.h"
19 #include "googleurl/src/gurl.h"
20 #include "webkit/glue/webkit_glue_export.h"
26 namespace webkit_glue
{
28 struct WEBKIT_GLUE_EXPORT WebPreferences
{
29 // Map of ISO 15924 four-letter script code to font family. For example,
30 // "Arab" to "My Arabic Font".
31 typedef std::map
<std::string
, string16
> ScriptFontFamilyMap
;
33 // The ISO 15924 script code for undetermined script aka Common. It's the
34 // default used on WebKit's side to get/set a font setting when no script is
36 static const char kCommonScript
[];
38 ScriptFontFamilyMap standard_font_family_map
;
39 ScriptFontFamilyMap fixed_font_family_map
;
40 ScriptFontFamilyMap serif_font_family_map
;
41 ScriptFontFamilyMap sans_serif_font_family_map
;
42 ScriptFontFamilyMap cursive_font_family_map
;
43 ScriptFontFamilyMap fantasy_font_family_map
;
44 ScriptFontFamilyMap pictograph_font_family_map
;
45 int default_font_size
;
46 int default_fixed_font_size
;
47 int minimum_font_size
;
48 int minimum_logical_font_size
;
49 std::string default_encoding
;
50 bool apply_default_device_scale_factor_in_compositor
;
51 bool javascript_enabled
;
52 bool web_security_enabled
;
53 bool javascript_can_open_windows_automatically
;
54 bool loads_images_automatically
;
57 bool dom_paste_enabled
;
58 bool developer_extras_enabled
;
59 typedef std::vector
<std::pair
<std::string
, std::string
> >
60 WebInspectorPreferences
;
61 WebInspectorPreferences inspector_settings
;
62 bool site_specific_quirks_enabled
;
63 bool shrinks_standalone_images_to_fit
;
64 bool uses_universal_detector
;
65 bool text_areas_are_resizable
;
67 bool allow_scripts_to_close_windows
;
69 bool remote_fonts_enabled
;
70 bool javascript_can_access_clipboard
;
71 bool xss_auditor_enabled
;
72 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
73 // we disable the feature at a lower layer so that we catch non-WebKit uses
74 // of DNS prefetch as well.
75 bool dns_prefetching_enabled
;
76 bool local_storage_enabled
;
77 bool databases_enabled
;
78 bool application_cache_enabled
;
80 bool caret_browsing_enabled
;
81 bool hyperlink_auditing_enabled
;
83 bool user_style_sheet_enabled
;
84 GURL user_style_sheet_location
;
85 bool author_and_user_styles_enabled
;
86 bool frame_flattening_enabled
;
87 bool allow_universal_access_from_file_urls
;
88 bool allow_file_access_from_file_urls
;
89 bool webaudio_enabled
;
90 bool experimental_webgl_enabled
;
91 bool flash_3d_enabled
;
92 bool flash_stage3d_enabled
;
93 bool gl_multisampling_enabled
;
94 bool privileged_webgl_extensions_enabled
;
95 bool webgl_errors_to_console_enabled
;
96 bool show_composited_layer_borders
;
97 bool show_composited_layer_tree
;
98 bool show_fps_counter
;
99 bool accelerated_compositing_for_overflow_scroll_enabled
;
100 bool show_paint_rects
;
101 bool render_vsync_enabled
;
102 bool asynchronous_spell_checking_enabled
;
103 bool unified_textchecker_enabled
;
104 bool accelerated_compositing_enabled
;
105 bool force_compositing_mode
;
106 bool fixed_position_compositing_enabled
;
107 bool accelerated_layers_enabled
;
108 bool accelerated_animation_enabled
;
109 bool accelerated_video_enabled
;
110 bool accelerated_2d_canvas_enabled
;
111 bool deferred_2d_canvas_enabled
;
112 bool accelerated_painting_enabled
;
113 bool accelerated_filters_enabled
;
114 bool gesture_tap_highlight_enabled
;
115 bool accelerated_plugins_enabled
;
116 bool memory_info_enabled
;
117 bool fullscreen_enabled
;
118 bool allow_displaying_insecure_content
;
119 bool allow_running_insecure_content
;
120 #if defined(OS_ANDROID)
121 float font_scale_factor
;
122 bool force_enable_zoom
;
123 bool user_gesture_required_for_media_playback
;
125 bool password_echo_enabled
;
126 bool should_print_backgrounds
;
127 bool enable_scroll_animator
;
128 bool visual_word_movement_enabled
;
129 bool css_sticky_position_enabled
;
130 bool css_regions_enabled
;
131 bool css_shaders_enabled
;
132 bool css_variables_enabled
;
133 bool device_supports_touch
;
134 bool device_supports_mouse
;
135 int default_tile_width
;
136 int default_tile_height
;
137 int max_untiled_layer_width
;
138 int max_untiled_layer_height
;
139 bool fixed_position_creates_stacking_context
;
140 bool sync_xhr_in_documents_enabled
;
141 int number_of_cpu_cores
;
143 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
144 // only controls whether or not the "document.cookie" field is properly
145 // connected to the backing store, for instance if you wanted to be able to
146 // define custom getters and setters from within a unique security content
147 // without raising a DOM security exception.
150 bool apply_page_scale_factor_in_compositor
;
152 // We try to keep the default values the same as the default values in
153 // chrome, except for the cases where it would require lots of extra work for
154 // the embedder to use the same default value.
158 void Apply(WebKit::WebView
* web_view
) const;
161 } // namespace webkit_glue
163 #endif // WEBKIT_GLUE_WEBPREFERENCES_H__