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