e95b14225c36d499daca4b9bc43657b903b711cf
[platform/framework/web/chromium-efl.git] / third_party / blink / public / mojom / webpreferences / web_preferences.mojom
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.
4
5 module blink.mojom;
6
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
13
14 enum PointerType {
15   kPointerNone                              = 1,             // 1 << 0
16   kPointerFirstType                         = kPointerNone,
17   kPointerCoarseType                        = 2,             // 1 << 1
18   kPointerFineType                          = 4              // 1 << 2
19 };
20
21 enum HoverType {
22   kHoverNone                                 = 1,            // 1 << 0
23   kHoverFirstType                            = kHoverNone,
24   kHoverHoverType                            = 2             // 1 << 1
25 };
26
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 {
32   kSlowType,
33   kFastType
34 };
35
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:
38 //
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
41 //       Windows.
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.
45 //
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 {
51   kEditingMacBehavior,
52   kEditingWindowsBehavior,
53   kEditingUnixBehavior,
54   kEditingAndroidBehavior,
55   kEditingChromeOSBehavior
56 };
57
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
66 };
67
68 enum ViewportStyle { kDefault, kMobile, kTelevision, kLast = kTelevision };
69
70 // Defines the autoplay policy to be used. Should match the class in
71 // WebSettings.h.
72 enum AutoplayPolicy {
73   kNoUserGestureRequired,
74   kUserGestureRequired,
75   kDocumentUserActivationRequired,
76 };
77
78 enum EffectiveConnectionType {
79   // Effective connection type reported when the network quality is unknown.
80   kEffectiveConnectionUnknownType,
81
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
87   // acting on this.
88   kEffectiveConnectionOfflineType,
89
90   // Effective connection type reported when the network has the quality of a
91   // poor 2G connection.
92   kEffectiveConnectionSlow2GType,
93
94   // Effective connection type reported when the network has the quality of a
95   // faster 2G connection.
96   kEffectiveConnection2GType,
97
98   // Effective connection type reported when the network has the quality of a 3G
99   // connection.
100   kEffectiveConnection3GType,
101
102   // Effective connection type reported when the network has the quality of a 4G
103   // connection.
104   kEffectiveConnection4GType,
105
106   // Last value of the effective connection type. This value is unused.
107   kEffectiveConnectionTypeLast,
108 };
109
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;
127   bool images_enabled;
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
140   // 'Save-Data: on'.
141   bool data_saver_enabled;
142   bool local_storage_enabled;
143   bool databases_enabled;
144   bool tabs_to_links;
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;
149   bool webgl1_enabled;
150   bool webgl2_enabled;
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
172   // at large.
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;
203
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;
208
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;
218
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;
222
223   // Begin Electron-specific WebPreferences.  // enable_wrt_js
224   [EnableIf=enable_wrt_js]
225   bool context_isolation;
226
227   [EnableIf=enable_wrt_js]
228   bool is_webview;
229
230   [EnableIf=enable_wrt_js]
231   bool hidden_page;
232
233   [EnableIf=enable_wrt_js]
234   bool offscreen;
235
236   [EnableIf=enable_wrt_js]
237   bool node_integration;
238
239   [EnableIf=enable_wrt_js]
240   bool node_integration_in_worker;
241
242   [EnableIf=enable_wrt_js]
243   bool node_integration_in_sub_frames;
244
245   [EnableIf=enable_wrt_js]
246   bool enable_spellcheck;
247
248   [EnableIf=enable_wrt_js]
249   bool enable_plugins;
250
251   [EnableIf=enable_wrt_js]
252   bool enable_websql;
253
254   [EnableIf=enable_wrt_js]
255   bool webview_tag;
256   // End Electron-specific WebPreferences.
257
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.
263   bool cookie_enabled;
264
265   // This flag indicates whether H/W accelerated video decode is enabled.
266   // Defaults to false.
267   bool accelerated_video_decode_enabled;
268
269   [EnableIf=tizen_video_hole]
270   bool video_hole_enabled;
271
272   ImageAnimationPolicy animation_policy;
273
274   bool user_gesture_required_for_presentation;
275
276   bool text_tracks_enabled;
277
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;
282
283   // These fields specify values for CSS properties used to style WebVTT text
284   // tracks.
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;
292
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;
299
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;
304
305   bool immersive_mode_enabled;
306
307   bool double_tap_to_zoom_enabled;
308
309   bool fullscreen_supported;
310
311   bool text_autosizing_enabled;
312
313   [EnableIf=is_efl]
314   bool link_effect_enabled;
315
316   [EnableIf=is_efl]
317   bool atk_enabled;
318
319   [EnableIf=is_efl]
320   bool force_enable_zoom;
321
322   [EnableIf=is_efl]
323   bool uses_encoding_detector;
324
325   // Representation of the Web App Manifest scope if any.
326   url.mojom.Url web_app_scope;
327
328   [EnableIf=is_android]
329   float font_scale_factor;
330
331   [EnableIf=is_android]
332   int32 font_weight_adjustment;
333
334   [EnableIf=is_android]
335   int32 text_size_contrast_factor;
336
337   [EnableIf=is_android]
338   float device_scale_adjustment;
339
340   [EnableIf=is_android]
341   bool force_enable_zoom;
342
343   [EnableIf=is_android]
344   url.mojom.Url default_video_poster_url;
345
346   [EnableIf=is_android]
347   bool support_deprecated_target_density_dpi;
348
349   [EnableIf=is_android]
350   bool use_legacy_background_size_shorthand_behavior;
351
352   [EnableIf=is_android]
353   bool wide_viewport_quirk;
354
355   [EnableIf=is_android]
356   bool use_wide_viewport;
357
358   [EnableIf=is_android]
359   bool force_zero_layout_height;
360
361   [EnableIf=is_android]
362   bool viewport_meta_merge_content_quirk;
363
364   [EnableIf=is_android]
365   bool viewport_meta_non_user_scalable_quirk;
366
367   [EnableIf=is_android]
368   bool viewport_meta_zero_values_quirk;
369
370   [EnableIf=is_android]
371   bool clobber_user_agent_initial_scale_quirk;
372
373   [EnableIf=is_android]
374   bool ignore_main_frame_overflow_hidden_quirk;
375
376   [EnableIf=is_android]
377   bool report_screen_size_in_physical_pixels_quirk;
378
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;
383
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;
388
389   // If enabled, when a video goes fullscreen, the orientation should be locked.
390   [EnableIf=is_android]
391   bool video_fullscreen_orientation_lock_enabled;
392
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;
397
398   [EnableIf=is_android]
399   bool embedded_media_experience_enabled;
400
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;
405
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;
411
412   [EnableIf=is_android]
413   // Don't accelerate small canvases to avoid crashes TODO(crbug.com/1004304)
414   bool disable_accelerated_small_canvases;
415
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
421   // support WebAuthn.
422   [EnableIf=is_fuchsia]
423   bool disable_webauthn;
424
425   // Enable forcibly modifying content rendering to result in a light on dark
426   // color scheme.
427   bool force_dark_mode_enabled;
428
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
431   // in WebSettings.
432   float default_minimum_page_scale_factor;
433   float default_maximum_page_scale_factor;
434
435   [EnableIf=is_efl]
436   uint64 tizen_version_major;
437
438   [EnableIf=is_efl]
439   uint64 tizen_version_minor;
440
441   [EnableIf=is_efl]
442   uint64 tizen_version_release;
443
444   [EnableIf=is_tizen]
445   int32 max_refresh_rate;
446
447   // Whether download UI should be hidden on this page.
448   bool hide_download_ui;
449
450   // Whether it is a presentation receiver.
451   bool presentation_receiver;
452
453   // If disabled, media controls should never be used.
454   bool media_controls_enabled;
455
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;
461
462   // Defines the current autoplay policy.
463   AutoplayPolicy autoplay_policy;
464
465   // `getDisplayMedia()`'s transient activation requirement can be bypassed via
466   // `ScreenCaptureWithoutGestureAllowedForOrigins` policy.
467   bool require_transient_activation_for_get_display_media;
468
469   // `show{OpenFile|SaveFile|Directory}Picker()`'s user activation requirement
470   // can be bypassed via `FileOrDirectoryPickerWithoutGestureAllowedForOrigins`
471   // policy.
472   bool require_transient_activation_for_show_file_or_directory_picker;
473
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;
478
479   // The preferred contrast for the web content. Used to evaluate the
480   // prefers-contrast media query.
481   PreferredContrast preferred_contrast;
482
483   // Network quality threshold below which resources from iframes are assigned
484   // either kVeryLow or kVeryLow Blink priority.
485   EffectiveConnectionType low_priority_iframes_threshold;
486
487   // Whether Picture-in-Picture is enabled.
488   bool picture_in_picture_enabled;
489
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;
494
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;
502
503   // Whether lazy loading of frames and images is enabled.
504   bool lazy_load_enabled;
505
506   // Setting to false disables upgrades to HTTPS for HTTP resources in HTTPS
507   // sites.
508   bool allow_mixed_content_upgrades;
509
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;
513
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;
517
518   // Controls whether WebXR's immersive-ar is allowed.
519   bool webxr_immersive_ar_allowed;
520
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;
525
526   bool strict_mime_type_check_for_worker_scripts_enabled = true;
527
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;
531
532   [EnableIf=is_tizen_tv]
533   bool media_playback_notification_enabled;
534
535   [EnableIf=is_tizen_tv]
536   bool media_subtitle_notification_enabled;
537
538   [EnableIf=is_tizen_tv]
539   bool allow_file_access_from_external_urls;
540
541   [EnableIf=is_tizen_tv]
542   array<string> additional_shared_array_buffer_schemes;
543
544   [EnableIf=is_tizen_tv]
545   bool use_arrow_scroll;
546
547   [EnableIf=is_tizen_tv]
548   bool use_scrollbar_thumb_focus_notifications;
549 };