Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / content / public / common / web_preferences.h
blob0378cd72339da88fb62d290cb9dae18158b7f514
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_
8 #include <map>
9 #include <string>
10 #include <vector>
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"
16 #include "url/gurl.h"
18 namespace blink {
19 class WebView;
22 namespace content {
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 {
29 EDITING_BEHAVIOR_MAC,
30 EDITING_BEHAVIOR_WIN,
31 EDITING_BEHAVIOR_UNIX,
32 EDITING_BEHAVIOR_ANDROID,
33 EDITING_BEHAVIOR_LAST = EDITING_BEHAVIOR_ANDROID
36 // Cache options for V8. See V8CacheOptions.h for information on the options.
37 enum V8CacheOptions {
38 V8_CACHE_OPTIONS_DEFAULT,
39 V8_CACHE_OPTIONS_NONE,
40 V8_CACHE_OPTIONS_PARSE,
41 V8_CACHE_OPTIONS_CODE,
42 V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE
45 // ImageAnimationPolicy is used for controlling image animation
46 // when image frame is rendered for animation.
47 // See third_party/WebKit/Source/platform/graphics/ImageAnimationPolicy.h
48 // for information on the options.
49 enum ImageAnimationPolicy {
50 IMAGE_ANIMATION_POLICY_ALLOWED,
51 IMAGE_ANIMATION_POLICY_ANIMATION_ONCE,
52 IMAGE_ANIMATION_POLICY_NO_ANIMATION
55 // The ISO 15924 script code for undetermined script aka Common. It's the
56 // default used on WebKit's side to get/set a font setting when no script is
57 // specified.
58 CONTENT_EXPORT extern const char kCommonScript[];
60 // A struct for managing blink's settings.
62 // Adding new values to this class probably involves updating
63 // blink::WebSettings, content/common/view_messages.h, browser/tab_contents/
64 // render_view_host_delegate_helper.cc, browser/profiles/profile.cc,
65 // and content/public/common/common_param_traits_macros.h
66 struct CONTENT_EXPORT WebPreferences {
67 ScriptFontFamilyMap standard_font_family_map;
68 ScriptFontFamilyMap fixed_font_family_map;
69 ScriptFontFamilyMap serif_font_family_map;
70 ScriptFontFamilyMap sans_serif_font_family_map;
71 ScriptFontFamilyMap cursive_font_family_map;
72 ScriptFontFamilyMap fantasy_font_family_map;
73 ScriptFontFamilyMap pictograph_font_family_map;
74 int default_font_size;
75 int default_fixed_font_size;
76 int minimum_font_size;
77 int minimum_logical_font_size;
78 std::string default_encoding;
79 bool context_menu_on_mouse_up;
80 bool javascript_enabled;
81 bool web_security_enabled;
82 bool javascript_can_open_windows_automatically;
83 bool loads_images_automatically;
84 bool images_enabled;
85 bool plugins_enabled;
86 bool dom_paste_enabled;
87 bool shrinks_standalone_images_to_fit;
88 bool uses_universal_detector;
89 bool text_areas_are_resizable;
90 bool allow_scripts_to_close_windows;
91 bool remote_fonts_enabled;
92 bool javascript_can_access_clipboard;
93 bool xslt_enabled;
94 bool xss_auditor_enabled;
95 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
96 // we disable the feature at a lower layer so that we catch non-WebKit uses
97 // of DNS prefetch as well.
98 bool dns_prefetching_enabled;
99 bool local_storage_enabled;
100 bool databases_enabled;
101 bool application_cache_enabled;
102 bool tabs_to_links;
103 bool caret_browsing_enabled;
104 bool hyperlink_auditing_enabled;
105 bool is_online;
106 net::NetworkChangeNotifier::ConnectionType net_info_connection_type;
107 double net_info_max_bandwidth_mbps;
108 bool allow_universal_access_from_file_urls;
109 bool allow_file_access_from_file_urls;
110 bool webaudio_enabled;
111 bool experimental_webgl_enabled;
112 bool pepper_3d_enabled;
113 bool flash_3d_enabled;
114 bool flash_stage3d_enabled;
115 bool flash_stage3d_baseline_enabled;
116 bool gl_multisampling_enabled;
117 bool privileged_webgl_extensions_enabled;
118 bool webgl_errors_to_console_enabled;
119 bool mock_scrollbars_enabled;
120 bool asynchronous_spell_checking_enabled;
121 bool unified_textchecker_enabled;
122 bool accelerated_2d_canvas_enabled;
123 int minimum_accelerated_2d_canvas_size;
124 bool antialiased_2d_canvas_disabled;
125 bool antialiased_clips_2d_canvas_enabled;
126 int accelerated_2d_canvas_msaa_sample_count;
127 bool accelerated_filters_enabled;
128 bool deferred_filters_enabled;
129 bool container_culling_enabled;
130 bool allow_displaying_insecure_content;
131 bool allow_running_insecure_content;
132 // If true, taints all <canvas> elements, regardless of origin.
133 bool disable_reading_from_canvas;
134 // Strict mixed content checking disables both displaying and running insecure
135 // mixed content, and disables embedder notifications that such content was
136 // requested (thereby preventing user override).
137 bool strict_mixed_content_checking;
138 // Strict powerful feature restrictions block insecure usage of powerful
139 // features (like geolocation) that we haven't yet disabled for the web at
140 // large.
141 bool strict_powerful_feature_restrictions;
142 // Disallow user opt-in for blockable mixed content.
143 bool strictly_block_blockable_mixed_content;
144 bool block_mixed_plugin_content;
145 bool password_echo_enabled;
146 bool should_print_backgrounds;
147 bool should_clear_document_background;
148 bool enable_scroll_animator;
149 bool css_variables_enabled;
150 bool touch_enabled;
151 // TODO(mustaq): Nuke when the new API is ready
152 bool device_supports_touch;
153 // TODO(mustaq): Nuke when the new API is ready
154 bool device_supports_mouse;
155 bool touch_adjustment_enabled;
156 int pointer_events_max_touch_points;
157 int available_pointer_types;
158 ui::PointerType primary_pointer_type;
159 int available_hover_types;
160 ui::HoverType primary_hover_type;
161 bool sync_xhr_in_documents_enabled;
162 bool image_color_profiles_enabled;
163 bool should_respect_image_orientation;
164 int number_of_cpu_cores;
165 EditingBehavior editing_behavior;
166 bool supports_multiple_windows;
167 bool viewport_enabled;
168 bool viewport_meta_enabled;
169 bool main_frame_resizes_are_orientation_changes;
170 bool initialize_at_minimum_page_scale;
171 bool smart_insert_delete_enabled;
172 bool spatial_navigation_enabled;
173 int pinch_overlay_scrollbar_thickness;
174 bool use_solid_color_scrollbars;
175 bool navigate_on_drag_drop;
176 V8CacheOptions v8_cache_options;
177 bool slimming_paint_v2_enabled;
179 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
180 // only controls whether or not the "document.cookie" field is properly
181 // connected to the backing store, for instance if you wanted to be able to
182 // define custom getters and setters from within a unique security content
183 // without raising a DOM security exception.
184 bool cookie_enabled;
186 // This flag indicates whether H/W accelerated video decode is enabled for
187 // pepper plugins. Defaults to false.
188 bool pepper_accelerated_video_decode_enabled;
190 ImageAnimationPolicy animation_policy;
192 #if defined(OS_ANDROID)
193 bool text_autosizing_enabled;
194 float font_scale_factor;
195 float device_scale_adjustment;
196 bool force_enable_zoom;
197 bool fullscreen_supported;
198 bool double_tap_to_zoom_enabled;
199 bool user_gesture_required_for_media_playback;
200 GURL default_video_poster_url;
201 bool support_deprecated_target_density_dpi;
202 bool use_legacy_background_size_shorthand_behavior;
203 bool wide_viewport_quirk;
204 bool use_wide_viewport;
205 bool force_zero_layout_height;
206 bool viewport_meta_layout_size_quirk;
207 bool viewport_meta_merge_content_quirk;
208 bool viewport_meta_non_user_scalable_quirk;
209 bool viewport_meta_zero_values_quirk;
210 bool clobber_user_agent_initial_scale_quirk;
211 bool ignore_main_frame_overflow_hidden_quirk;
212 bool report_screen_size_in_physical_pixels_quirk;
213 bool record_whole_document;
214 std::string autoplay_experiment_mode;
215 #endif
217 // Default (used if the page or UA doesn't override these) values for page
218 // scale limits. These are set directly on the WebView so there's no analogue
219 // in WebSettings.
220 float default_minimum_page_scale_factor;
221 float default_maximum_page_scale_factor;
223 // We try to keep the default values the same as the default values in
224 // chrome, except for the cases where it would require lots of extra work for
225 // the embedder to use the same default value.
226 WebPreferences();
227 ~WebPreferences();
230 } // namespace content
232 #endif // CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_