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
, base::string16
> ScriptFontFamilyMap
;
33 enum EditingBehavior
{
36 EDITING_BEHAVIOR_UNIX
,
37 EDITING_BEHAVIOR_ANDROID
40 // The ISO 15924 script code for undetermined script aka Common. It's the
41 // default used on WebKit's side to get/set a font setting when no script is
43 static const char kCommonScript
[];
45 ScriptFontFamilyMap standard_font_family_map
;
46 ScriptFontFamilyMap fixed_font_family_map
;
47 ScriptFontFamilyMap serif_font_family_map
;
48 ScriptFontFamilyMap sans_serif_font_family_map
;
49 ScriptFontFamilyMap cursive_font_family_map
;
50 ScriptFontFamilyMap fantasy_font_family_map
;
51 ScriptFontFamilyMap pictograph_font_family_map
;
52 int default_font_size
;
53 int default_fixed_font_size
;
54 int minimum_font_size
;
55 int minimum_logical_font_size
;
56 std::string default_encoding
;
57 bool apply_default_device_scale_factor_in_compositor
;
58 bool apply_page_scale_factor_in_compositor
;
59 bool javascript_enabled
;
60 bool web_security_enabled
;
61 bool javascript_can_open_windows_automatically
;
62 bool loads_images_automatically
;
65 bool dom_paste_enabled
;
66 typedef std::vector
<std::pair
<std::string
, std::string
> >
67 WebInspectorPreferences
;
68 WebInspectorPreferences inspector_settings
;
69 bool site_specific_quirks_enabled
;
70 bool shrinks_standalone_images_to_fit
;
71 bool uses_universal_detector
;
72 bool text_areas_are_resizable
;
74 bool allow_scripts_to_close_windows
;
76 bool page_cache_supports_plugins
;
77 bool remote_fonts_enabled
;
78 bool javascript_can_access_clipboard
;
79 bool xss_auditor_enabled
;
80 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
81 // we disable the feature at a lower layer so that we catch non-WebKit uses
82 // of DNS prefetch as well.
83 bool dns_prefetching_enabled
;
84 bool local_storage_enabled
;
85 bool databases_enabled
;
86 bool application_cache_enabled
;
88 bool caret_browsing_enabled
;
89 bool hyperlink_auditing_enabled
;
91 bool user_style_sheet_enabled
;
92 GURL user_style_sheet_location
;
93 bool author_and_user_styles_enabled
;
94 bool frame_flattening_enabled
;
95 bool allow_universal_access_from_file_urls
;
96 bool allow_file_access_from_file_urls
;
97 bool webaudio_enabled
;
98 bool experimental_webgl_enabled
;
99 bool flash_3d_enabled
;
100 bool flash_stage3d_enabled
;
101 bool flash_stage3d_baseline_enabled
;
102 bool gl_multisampling_enabled
;
103 bool privileged_webgl_extensions_enabled
;
104 bool webgl_errors_to_console_enabled
;
105 bool accelerated_compositing_for_overflow_scroll_enabled
;
106 bool accelerated_compositing_for_scrollable_frames_enabled
;
107 bool composited_scrolling_for_frames_enabled
;
108 bool mock_scrollbars_enabled
;
109 bool threaded_html_parser
;
110 bool show_paint_rects
;
111 bool asynchronous_spell_checking_enabled
;
112 bool unified_textchecker_enabled
;
113 bool accelerated_compositing_enabled
;
114 bool force_compositing_mode
;
115 bool accelerated_compositing_for_3d_transforms_enabled
;
116 bool accelerated_compositing_for_animation_enabled
;
117 bool accelerated_compositing_for_video_enabled
;
118 bool accelerated_2d_canvas_enabled
;
119 int minimum_accelerated_2d_canvas_size
;
120 bool antialiased_2d_canvas_disabled
;
121 bool accelerated_filters_enabled
;
122 bool gesture_tap_highlight_enabled
;
123 bool accelerated_compositing_for_plugins_enabled
;
124 bool memory_info_enabled
;
125 bool fullscreen_enabled
;
126 bool allow_displaying_insecure_content
;
127 bool allow_running_insecure_content
;
128 bool password_echo_enabled
;
129 bool should_print_backgrounds
;
130 bool enable_scroll_animator
;
131 bool visual_word_movement_enabled
;
132 bool css_sticky_position_enabled
;
133 bool css_shaders_enabled
;
134 bool css_variables_enabled
;
135 bool css_grid_layout_enabled
;
137 bool device_supports_touch
;
138 bool device_supports_mouse
;
139 bool touch_adjustment_enabled
;
140 bool touch_drag_drop_enabled
;
141 bool fixed_position_creates_stacking_context
;
142 bool sync_xhr_in_documents_enabled
;
143 bool deferred_image_decoding_enabled
;
144 bool should_respect_image_orientation
;
145 int number_of_cpu_cores
;
146 EditingBehavior editing_behavior
;
147 bool supports_multiple_windows
;
148 bool viewport_enabled
;
149 bool initialize_at_minimum_page_scale
;
150 bool smart_insert_delete_enabled
;
152 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
153 // only controls whether or not the "document.cookie" field is properly
154 // connected to the backing store, for instance if you wanted to be able to
155 // define custom getters and setters from within a unique security content
156 // without raising a DOM security exception.
159 #if defined(OS_ANDROID)
160 bool text_autosizing_enabled
;
161 float font_scale_factor
;
162 bool force_enable_zoom
;
163 bool double_tap_to_zoom_enabled
;
164 bool user_gesture_required_for_media_playback
;
165 GURL default_video_poster_url
;
168 // We try to keep the default values the same as the default values in
169 // chrome, except for the cases where it would require lots of extra work for
170 // the embedder to use the same default value.
174 void Apply(WebKit::WebView
* web_view
) const;
177 } // namespace webkit_glue
179 #endif // WEBKIT_GLUE_WEBPREFERENCES_H__