1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_
6 #define CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_
12 #include "base/strings/string16.h"
13 #include "content/common/content_export.h"
14 #include "net/base/network_change_notifier.h"
15 #include "ui/base/touch/touch_device.h"
24 // Map of ISO 15924 four-letter script code to font family. For example,
25 // "Arab" to "My Arabic Font".
26 typedef std::map
<std::string
, base::string16
> ScriptFontFamilyMap
;
28 enum EditingBehavior
{
31 EDITING_BEHAVIOR_UNIX
,
32 EDITING_BEHAVIOR_ANDROID
,
33 EDITING_BEHAVIOR_LAST
= EDITING_BEHAVIOR_ANDROID
38 V8_CACHE_OPTIONS_PARSE
,
39 V8_CACHE_OPTIONS_CODE
,
40 V8_CACHE_OPTIONS_CODE_COMPRESSED
,
41 V8_CACHE_OPTIONS_LAST
= V8_CACHE_OPTIONS_CODE_COMPRESSED
44 enum V8ScriptStreamingMode
{
45 V8_SCRIPT_STREAMING_MODE_ALL
,
46 V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER
,
47 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING
,
48 V8_SCRIPT_STREAMING_MODE_LAST
=
49 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING
52 // The ISO 15924 script code for undetermined script aka Common. It's the
53 // default used on WebKit's side to get/set a font setting when no script is
55 CONTENT_EXPORT
extern const char kCommonScript
[];
57 // A struct for managing blink's settings.
59 // Adding new values to this class probably involves updating
60 // blink::WebSettings, content/common/view_messages.h, browser/tab_contents/
61 // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc.
62 struct CONTENT_EXPORT WebPreferences
{
63 ScriptFontFamilyMap standard_font_family_map
;
64 ScriptFontFamilyMap fixed_font_family_map
;
65 ScriptFontFamilyMap serif_font_family_map
;
66 ScriptFontFamilyMap sans_serif_font_family_map
;
67 ScriptFontFamilyMap cursive_font_family_map
;
68 ScriptFontFamilyMap fantasy_font_family_map
;
69 ScriptFontFamilyMap pictograph_font_family_map
;
70 int default_font_size
;
71 int default_fixed_font_size
;
72 int minimum_font_size
;
73 int minimum_logical_font_size
;
74 std::string default_encoding
;
75 bool javascript_enabled
;
76 bool web_security_enabled
;
77 bool javascript_can_open_windows_automatically
;
78 bool loads_images_automatically
;
81 bool dom_paste_enabled
;
82 bool shrinks_standalone_images_to_fit
;
83 bool uses_universal_detector
;
84 bool text_areas_are_resizable
;
86 bool allow_scripts_to_close_windows
;
87 bool remote_fonts_enabled
;
88 bool javascript_can_access_clipboard
;
90 bool xss_auditor_enabled
;
91 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
92 // we disable the feature at a lower layer so that we catch non-WebKit uses
93 // of DNS prefetch as well.
94 bool dns_prefetching_enabled
;
95 bool local_storage_enabled
;
96 bool databases_enabled
;
97 bool application_cache_enabled
;
99 bool caret_browsing_enabled
;
100 bool hyperlink_auditing_enabled
;
102 net::NetworkChangeNotifier::ConnectionType connection_type
;
103 bool allow_universal_access_from_file_urls
;
104 bool allow_file_access_from_file_urls
;
105 bool webaudio_enabled
;
106 bool experimental_webgl_enabled
;
107 bool pepper_3d_enabled
;
108 bool flash_3d_enabled
;
109 bool flash_stage3d_enabled
;
110 bool flash_stage3d_baseline_enabled
;
111 bool gl_multisampling_enabled
;
112 bool privileged_webgl_extensions_enabled
;
113 bool webgl_errors_to_console_enabled
;
114 bool mock_scrollbars_enabled
;
115 bool layer_squashing_enabled
;
116 bool asynchronous_spell_checking_enabled
;
117 bool unified_textchecker_enabled
;
118 bool accelerated_2d_canvas_enabled
;
119 int minimum_accelerated_2d_canvas_size
;
120 bool antialiased_2d_canvas_disabled
;
121 bool antialiased_clips_2d_canvas_enabled
;
122 int accelerated_2d_canvas_msaa_sample_count
;
123 bool accelerated_filters_enabled
;
124 bool deferred_filters_enabled
;
125 bool container_culling_enabled
;
126 bool text_blobs_enabled
;
127 bool allow_displaying_insecure_content
;
128 bool allow_running_insecure_content
;
129 bool password_echo_enabled
;
130 bool should_print_backgrounds
;
131 bool should_clear_document_background
;
132 bool enable_scroll_animator
;
133 bool css_variables_enabled
;
134 bool region_based_columns_enabled
;
136 // TODO(mustaq): Nuke when the new API is ready
137 bool device_supports_touch
;
138 // TODO(mustaq): Nuke when the new API is ready
139 bool device_supports_mouse
;
140 bool touch_adjustment_enabled
;
141 int pointer_events_max_touch_points
;
142 int available_pointer_types
;
143 ui::PointerType primary_pointer_type
;
144 int available_hover_types
;
145 ui::HoverType primary_hover_type
;
146 bool sync_xhr_in_documents_enabled
;
147 bool deferred_image_decoding_enabled
;
148 bool image_color_profiles_enabled
;
149 bool should_respect_image_orientation
;
150 int number_of_cpu_cores
;
151 EditingBehavior editing_behavior
;
152 bool supports_multiple_windows
;
153 bool viewport_enabled
;
154 bool viewport_meta_enabled
;
155 bool main_frame_resizes_are_orientation_changes
;
156 bool initialize_at_minimum_page_scale
;
157 bool smart_insert_delete_enabled
;
158 bool spatial_navigation_enabled
;
159 bool pinch_virtual_viewport_enabled
;
160 int pinch_overlay_scrollbar_thickness
;
161 bool rubber_banding_on_compositor_thread
;
162 bool use_solid_color_scrollbars
;
163 bool navigate_on_drag_drop
;
164 V8CacheOptions v8_cache_options
;
165 bool v8_script_streaming_enabled
;
166 V8ScriptStreamingMode v8_script_streaming_mode
;
167 bool slimming_paint_enabled
;
169 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
170 // only controls whether or not the "document.cookie" field is properly
171 // connected to the backing store, for instance if you wanted to be able to
172 // define custom getters and setters from within a unique security content
173 // without raising a DOM security exception.
176 // This flag indicates whether H/W accelerated video decode is enabled for
177 // pepper plugins. Defaults to false.
178 bool pepper_accelerated_video_decode_enabled
;
180 #if defined(OS_ANDROID)
181 bool text_autosizing_enabled
;
182 float font_scale_factor
;
183 float device_scale_adjustment
;
184 bool force_enable_zoom
;
185 bool fullscreen_supported
;
186 bool double_tap_to_zoom_enabled
;
187 bool user_gesture_required_for_media_playback
;
188 GURL default_video_poster_url
;
189 bool support_deprecated_target_density_dpi
;
190 bool use_legacy_background_size_shorthand_behavior
;
191 bool wide_viewport_quirk
;
192 bool use_wide_viewport
;
193 bool force_zero_layout_height
;
194 bool viewport_meta_layout_size_quirk
;
195 bool viewport_meta_merge_content_quirk
;
196 bool viewport_meta_non_user_scalable_quirk
;
197 bool viewport_meta_zero_values_quirk
;
198 bool clobber_user_agent_initial_scale_quirk
;
199 bool ignore_main_frame_overflow_hidden_quirk
;
200 bool report_screen_size_in_physical_pixels_quirk
;
203 // We try to keep the default values the same as the default values in
204 // chrome, except for the cases where it would require lots of extra work for
205 // the embedder to use the same default value.
210 } // namespace content
212 #endif // CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_