1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom";
8 import "third_party/blink/public/mojom/css/preferred_contrast.mojom";
9 import "third_party/blink/public/mojom/v8_cache_options.mojom";
10 import "url/mojom/url.mojom";
11 import "mojo/public/mojom/base/string16.mojom";
12 import "mojo/public/mojom/base/file_path.mojom"; // enable_wrt_js
15 kPointerNone = 1, // 1 << 0
16 kPointerFirstType = kPointerNone,
17 kPointerCoarseType = 2, // 1 << 1
18 kPointerFineType = 4 // 1 << 2
22 kHoverNone = 1, // 1 << 0
23 kHoverFirstType = kHoverNone,
24 kHoverHoverType = 2 // 1 << 1
27 // For media feature update, indicating the update ability of the output display,
28 // once renering is done:
29 // Slow - e-ink screens, underpowered devices.
30 // Fast - regular computer screen.
31 enum OutputDeviceUpdateAbilityType {
36 // There are multiple editing details that are different on Windows than
37 // Macintosh. We use a single switch for all of them. Some examples:
39 // 1) Clicking below the last line of an editable area puts the caret at the
40 // end of the last line on Mac, but in the middle of the last line on
42 // 2) Pushing the down arrow key on the last line puts the caret at the end
43 // of the last line on Mac, but does nothing on Windows. A similar case
44 // exists on the top line.
46 // This setting is intended to control these sorts of behaviors. There are some
47 // other behaviors with individual function calls on EditorClient (smart copy
48 // and paste and selecting the space after a double click) that could be
49 // combined with this if if possible in the future.
50 enum EditingBehavior {
52 kEditingWindowsBehavior,
54 kEditingAndroidBehavior,
55 kEditingChromeOSBehavior
58 // ImageAnimationPolicy is used for controlling image animation
59 // when image frame is rendered for animation.
60 // See third_party/WebKit/Source/platform/graphics/ImageAnimationPolicy.h
61 // for information on the options.
62 enum ImageAnimationPolicy {
63 kImageAnimationPolicyAllowed,
64 kImageAnimationPolicyAnimateOnce,
65 kImageAnimationPolicyNoAnimation
68 enum ViewportStyle { kDefault, kMobile, kTelevision, kLast = kTelevision };
70 // Defines the autoplay policy to be used. Should match the class in
73 kNoUserGestureRequired,
75 kDocumentUserActivationRequired,
78 enum EffectiveConnectionType {
79 // Effective connection type reported when the network quality is unknown.
80 kEffectiveConnectionUnknownType,
82 // Effective connection type reported when the Internet is unreachable
83 // because the device does not have a connection (as reported by underlying
84 // platform APIs). Note that due to rare but potential bugs in the platform
85 // APIs, it is possible that effective connection type is reported as
86 // EFFECTIVE_CONNECTION_TYPE_OFFLINE. Callers must use caution when using
88 kEffectiveConnectionOfflineType,
90 // Effective connection type reported when the network has the quality of a
91 // poor 2G connection.
92 kEffectiveConnectionSlow2GType,
94 // Effective connection type reported when the network has the quality of a
95 // faster 2G connection.
96 kEffectiveConnection2GType,
98 // Effective connection type reported when the network has the quality of a 3G
100 kEffectiveConnection3GType,
102 // Effective connection type reported when the network has the quality of a 4G
104 kEffectiveConnection4GType,
106 // Last value of the effective connection type. This value is unused.
107 kEffectiveConnectionTypeLast,
110 struct WebPreferences {
111 map<string, mojo_base.mojom.String16> standard_font_family_map;
112 map<string, mojo_base.mojom.String16> fixed_font_family_map;
113 map<string, mojo_base.mojom.String16> serif_font_family_map;
114 map<string, mojo_base.mojom.String16> sans_serif_font_family_map;
115 map<string, mojo_base.mojom.String16> cursive_font_family_map;
116 map<string, mojo_base.mojom.String16> fantasy_font_family_map;
117 map<string, mojo_base.mojom.String16> math_font_family_map;
118 int32 default_font_size;
119 int32 default_fixed_font_size;
120 int32 minimum_font_size;
121 int32 minimum_logical_font_size;
122 string default_encoding;
123 bool context_menu_on_mouse_up;
124 bool javascript_enabled;
125 bool web_security_enabled;
126 bool loads_images_automatically;
128 bool plugins_enabled;
129 bool dom_paste_enabled;
130 bool shrinks_standalone_images_to_fit;
131 bool text_areas_are_resizable;
132 bool allow_scripts_to_close_windows;
133 bool remote_fonts_enabled;
134 bool javascript_can_access_clipboard;
135 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
136 // we disable the feature at a lower layer so that we catch non-WebKit uses
137 // of DNS prefetch as well.
138 bool dns_prefetching_enabled;
139 // Preference to save data. When enabled, requests will contain the header
141 bool data_saver_enabled;
142 bool local_storage_enabled;
143 bool databases_enabled;
145 bool disable_ipc_flooding_protection;
146 bool hyperlink_auditing_enabled;
147 bool allow_universal_access_from_file_urls;
148 bool allow_file_access_from_file_urls;
151 bool pepper_3d_enabled;
152 bool privileged_webgl_extensions_enabled;
153 bool webgl_errors_to_console_enabled;
154 bool hide_scrollbars;
155 bool enable_webkit_scrollbar_styling;
156 bool accelerated_2d_canvas_enabled;
157 bool canvas_2d_layers_enabled;
158 bool antialiased_2d_canvas_disabled;
159 bool antialiased_clips_2d_canvas_enabled;
160 bool accelerated_filters_enabled;
161 bool deferred_filters_enabled;
162 bool container_culling_enabled;
163 bool allow_running_insecure_content;
164 // If true, taint32s all <canvas> elements, regardless of origin.
165 bool disable_reading_from_canvas;
166 // Strict mixed content checking disables both displaying and running insecure
167 // mixed content, and disables embedder notifications that such content was
168 // requested (thereby preventing user override).
169 bool strict_mixed_content_checking;
170 // Strict powerful feature restrictions block insecure usage of powerful
171 // features (like device orientation) that we haven't yet disabled for the web
173 bool strict_powerful_feature_restrictions;
174 // TODO(jww): Remove when WebView no longer needs this exception.
175 bool allow_geolocation_on_insecure_origins;
176 // Disallow user opt-in for blockable mixed content.
177 bool strictly_block_blockable_mixed_content;
178 bool block_mixed_plugin_content;
179 bool password_echo_enabled;
180 bool should_clear_document_background;
181 bool enable_scroll_animator;
182 bool prefers_reduced_motion;
183 bool prefers_reduced_transparency;
184 bool inverted_colors;
185 bool touch_event_feature_detection_enabled;
186 int32 pointer_events_max_touch_points;
187 int32 available_pointer_types;
188 PointerType primary_pointer_type;
189 OutputDeviceUpdateAbilityType output_device_update_ability_type;
190 int32 available_hover_types;
191 HoverType primary_hover_type;
192 bool dont_send_key_events_to_javascript;
193 bool barrel_button_for_drag_enabled;
194 bool sync_xhr_in_documents_enabled;
195 bool target_blank_implies_no_opener_enabled_will_be_removed;
196 bool allow_non_empty_navigator_plugins;
197 int32 number_of_cpu_cores;
198 EditingBehavior editing_behavior;
199 bool supports_multiple_windows;
200 bool viewport_enabled;
201 bool viewport_meta_enabled;
202 bool auto_zoom_focused_editable_to_legible_scale;
204 // If true - Blink will clamp the minimum scale factor to the content width,
205 // preventing zoom beyond the visible content. This is really only needed if
206 // viewport_enabled is on.
207 bool shrinks_viewport_contents_to_fit;
209 ViewportStyle viewport_style;
210 bool smooth_scroll_for_find_enabled;
211 bool main_frame_resizes_are_orientation_changes;
212 bool initialize_at_minimum_page_scale;
213 bool smart_insert_delete_enabled;
214 bool spatial_navigation_enabled;
215 bool fake_no_alloc_direct_call_for_testing_enabled;
216 V8CacheOptions v8_cache_options;
217 bool record_whole_document;
219 // If true, stylus handwriting recognition to text input will be available in
220 // editable input fields which are non-password type.
221 bool stylus_handwriting_enabled;
223 // Begin Electron-specific WebPreferences. // enable_wrt_js
224 [EnableIf=enable_wrt_js]
225 bool context_isolation;
227 [EnableIf=enable_wrt_js]
230 [EnableIf=enable_wrt_js]
233 [EnableIf=enable_wrt_js]
236 [EnableIf=enable_wrt_js]
237 bool node_integration;
239 [EnableIf=enable_wrt_js]
240 bool node_integration_in_worker;
242 [EnableIf=enable_wrt_js]
243 bool node_integration_in_sub_frames;
245 [EnableIf=enable_wrt_js]
246 bool enable_spellcheck;
248 [EnableIf=enable_wrt_js]
251 [EnableIf=enable_wrt_js]
254 [EnableIf=enable_wrt_js]
256 // End Electron-specific WebPreferences.
258 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
259 // only controls whether or not the "document.cookie" field is properly
260 // connected to the backing store, for instance if you wanted to be able to
261 // define custom getters and setters from within a unique security content
262 // without raising a DOM security exception.
265 // This flag indicates whether H/W accelerated video decode is enabled.
266 // Defaults to false.
267 bool accelerated_video_decode_enabled;
269 [EnableIf=tizen_video_hole]
270 bool video_hole_enabled;
272 ImageAnimationPolicy animation_policy;
274 bool user_gesture_required_for_presentation;
276 bool text_tracks_enabled;
278 // These fields specify the foreground and background color for WebVTT text
279 // tracks. Their values can be any legal CSS color descriptor.
280 string text_track_background_color;
281 string text_track_text_color;
283 // These fields specify values for CSS properties used to style WebVTT text
285 // Specifies CSS font-size property in percentage.
286 string text_track_text_size;
287 string text_track_text_shadow;
288 string text_track_font_family;
289 string text_track_font_style;
290 // Specifies the value for CSS font-variant property.
291 string text_track_font_variant;
293 // These fields specify values for CSS properties used to style the window
294 // around WebVTT text tracks.
295 // Window color can be any legal CSS color descriptor.
296 string text_track_window_color;
297 // Window radius is in pixels.
298 string text_track_window_radius;
300 // Specifies the margin for WebVTT text tracks as a percentage of media
301 // element height/width (for horizontal/vertical text respectively).
302 // Cues will not be placed in this margin area.
303 float text_track_margin_percentage;
305 bool immersive_mode_enabled;
307 bool double_tap_to_zoom_enabled;
309 bool fullscreen_supported;
311 bool text_autosizing_enabled;
314 bool link_effect_enabled;
320 bool force_enable_zoom;
323 bool uses_encoding_detector;
325 // Representation of the Web App Manifest scope if any.
326 url.mojom.Url web_app_scope;
328 [EnableIf=is_android]
329 float font_scale_factor;
331 [EnableIf=is_android]
332 int32 font_weight_adjustment;
334 [EnableIf=is_android]
335 int32 text_size_contrast_factor;
337 [EnableIf=is_android]
338 float device_scale_adjustment;
340 [EnableIf=is_android]
341 bool force_enable_zoom;
343 [EnableIf=is_android]
344 url.mojom.Url default_video_poster_url;
346 [EnableIf=is_android]
347 bool support_deprecated_target_density_dpi;
349 [EnableIf=is_android]
350 bool use_legacy_background_size_shorthand_behavior;
352 [EnableIf=is_android]
353 bool wide_viewport_quirk;
355 [EnableIf=is_android]
356 bool use_wide_viewport;
358 [EnableIf=is_android]
359 bool force_zero_layout_height;
361 [EnableIf=is_android]
362 bool viewport_meta_merge_content_quirk;
364 [EnableIf=is_android]
365 bool viewport_meta_non_user_scalable_quirk;
367 [EnableIf=is_android]
368 bool viewport_meta_zero_values_quirk;
370 [EnableIf=is_android]
371 bool clobber_user_agent_initial_scale_quirk;
373 [EnableIf=is_android]
374 bool ignore_main_frame_overflow_hidden_quirk;
376 [EnableIf=is_android]
377 bool report_screen_size_in_physical_pixels_quirk;
379 // Used by Android_WebView only to support legacy apps that inject script int32o
380 // a top-level initial empty document and expect it to persist on navigation.
381 [EnableIf=is_android]
382 bool reuse_global_for_unowned_main_frame;
384 // Specifies default setting for spellcheck when the spellcheck attribute is
385 // not explicitly specified.
386 [EnableIf=is_android]
387 bool spellcheck_enabled_by_default;
389 // If enabled, when a video goes fullscreen, the orientation should be locked.
390 [EnableIf=is_android]
391 bool video_fullscreen_orientation_lock_enabled;
393 // If enabled, fullscreen should be entered/exited when the device is rotated
394 // to/from the orientation of the video.
395 [EnableIf=is_android]
396 bool video_rotate_to_fullscreen_enabled;
398 [EnableIf=is_android]
399 bool embedded_media_experience_enabled;
401 // Enable 8 (#RRGGBBAA) and 4 (#RGBA) value hex colors in CSS Android
402 // WebView quirk (http://crbug.com/618472).
403 [EnableIf=is_android]
404 bool css_hex_alpha_color_enabled;
406 // Enable support for document.scrollingElement
407 // WebView sets this to false to retain old documentElement behaviour
408 // (http://crbug.com/761016).
409 [EnableIf=is_android]
410 bool scroll_top_left_interop_enabled;
412 [EnableIf=is_android]
413 // Don't accelerate small canvases to avoid crashes TODO(crbug.com/1004304)
414 bool disable_accelerated_small_canvases;
416 // Disable the Web Authentication (WebAuthn) API.
417 // TODO(crbug.com/1284805): Remove once WebView supports WebAuthn.
418 [EnableIf=is_android]
419 bool disable_webauthn;
420 // TODO(crbug.com/1382970): Remove once all Content embedders on Fuchsia
422 [EnableIf=is_fuchsia]
423 bool disable_webauthn;
425 // Enable forcibly modifying content rendering to result in a light on dark
427 bool force_dark_mode_enabled;
429 // Default (used if the page or UA doesn't override these) values for page
430 // scale limits. These are set directly on the WebView so there's no analogue
432 float default_minimum_page_scale_factor;
433 float default_maximum_page_scale_factor;
436 uint64 tizen_version_major;
439 uint64 tizen_version_minor;
442 uint64 tizen_version_release;
445 int32 max_refresh_rate;
447 // Whether download UI should be hidden on this page.
448 bool hide_download_ui;
450 // Whether it is a presentation receiver.
451 bool presentation_receiver;
453 // If disabled, media controls should never be used.
454 bool media_controls_enabled;
456 // Whether we want to disable updating selection on mutating selection range.
457 // This is to work around Samsung's email app issue. See
458 // https://crbug.com/699943 for details.
459 // TODO(changwan): remove this once we no longer support Android N.
460 bool do_not_update_selection_on_mutating_selection_range;
462 // Defines the current autoplay policy.
463 AutoplayPolicy autoplay_policy;
465 // `getDisplayMedia()`'s transient activation requirement can be bypassed via
466 // `ScreenCaptureWithoutGestureAllowedForOrigins` policy.
467 bool require_transient_activation_for_get_display_media;
469 // `show{OpenFile|SaveFile|Directory}Picker()`'s user activation requirement
470 // can be bypassed via `FileOrDirectoryPickerWithoutGestureAllowedForOrigins`
472 bool require_transient_activation_for_show_file_or_directory_picker;
474 // The preferred color scheme for the web content. The scheme is used to
475 // evaluate the prefers-color-scheme media query and resolve UA color scheme
476 // to be used based on the supported-color-schemes META tag and CSS property.
477 PreferredColorScheme preferred_color_scheme;
479 // The preferred contrast for the web content. Used to evaluate the
480 // prefers-contrast media query.
481 PreferredContrast preferred_contrast;
483 // Network quality threshold below which resources from iframes are assigned
484 // either kVeryLow or kVeryLow Blink priority.
485 EffectiveConnectionType low_priority_iframes_threshold;
487 // Whether Picture-in-Picture is enabled.
488 bool picture_in_picture_enabled;
490 // Whether a translate service is available.
491 // blink's hrefTranslate attribute existence relies on the result.
492 // See https://github.com/dtapuska/html-translate
493 bool translate_service_available;
495 // A value other than
496 // mojom::blink::EffectiveConnectionType::kEffectiveConnectionUnknownType
497 // implies that the network quality estimate related Web APIs are in the
498 // holdback mode. When the holdback is enabled, the related Web APIs return
499 // network quality estimate corresponding to
500 // |network_quality_estimator_web_holdback| regardless of the actual quality.
501 EffectiveConnectionType network_quality_estimator_web_holdback;
503 // Whether lazy loading of frames and images is enabled.
504 bool lazy_load_enabled;
506 // Setting to false disables upgrades to HTTPS for HTTP resources in HTTPS
508 bool allow_mixed_content_upgrades;
510 // Whether the focused element should always be indicated (for example, by
511 // forcing :focus-visible to match regardless of focus method).
512 bool always_show_focus;
514 // Whether touch input can trigger HTML drag-and-drop operations. The
515 // default value depends on the platform.
516 bool touch_drag_drop_enabled;
518 // Controls whether WebXR's immersive-ar is allowed.
519 bool webxr_immersive_ar_allowed;
521 // Whether lookup of frames in the associated WebView (e.g. lookup via
522 // window.open or via <a target=...>) should be renderer-wide (i.e. going
523 // beyond the usual opener-relationship-based BrowsingInstance boundaries).
524 bool renderer_wide_named_frame_lookup;
526 bool strict_mime_type_check_for_worker_scripts_enabled = true;
528 // Whether modal context menu is used. A modal context menu meaning it is
529 // blocking user's access to the background web content.
530 bool modal_context_menu = true;
532 [EnableIf=is_tizen_tv]
533 bool media_playback_notification_enabled;
535 [EnableIf=is_tizen_tv]
536 bool media_subtitle_notification_enabled;
538 [EnableIf=is_tizen_tv]
539 bool allow_file_access_from_external_urls;
541 [EnableIf=is_tizen_tv]
542 array<string> additional_shared_array_buffer_schemes;
544 [EnableIf=is_tizen_tv]
545 bool use_arrow_scroll;
547 [EnableIf=is_tizen_tv]
548 bool use_scrollbar_thumb_focus_notifications;