1 // Copyright 2020 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.
4 
5 #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PREFERENCES_WEB_PREFERENCES_MOJOM_TRAITS_H_
6 #define THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PREFERENCES_WEB_PREFERENCES_MOJOM_TRAITS_H_
7 
8 #include "build/build_config.h"
9 #include "mojo/public/cpp/bindings/struct_traits.h"
10 #include "net/nqe/effective_connection_type.h"
11 #include "third_party/blink/public/common/common_export.h"
12 #include "third_party/blink/public/common/web_preferences/web_preferences.h"
13 #include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom.h"
14 #include "ui/base/pointer/pointer_device.h"
15 
16 namespace mojo {
17 
18 template <>
19 struct BLINK_COMMON_EXPORT
20     EnumTraits<blink::mojom::PointerType, ui::PointerType> {
21   static blink::mojom::PointerType ToMojom(ui::PointerType type);
22 
23   static bool FromMojom(blink::mojom::PointerType input, ui::PointerType* out);
24 };
25 
26 template <>
27 struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::HoverType, ui::HoverType> {
28   static blink::mojom::HoverType ToMojom(ui::HoverType type);
29 
30   static bool FromMojom(blink::mojom::HoverType input, ui::HoverType* out);
31 };
32 
33 template <>
34 struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::EffectiveConnectionType,
35                                       net::EffectiveConnectionType> {
36   static blink::mojom::EffectiveConnectionType ToMojom(
37       net::EffectiveConnectionType policy);
38 
39   static bool FromMojom(blink::mojom::EffectiveConnectionType input,
40                         net::EffectiveConnectionType* out);
41 };
42 
43 template <>
44 struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
45                                         blink::web_pref::WebPreferences> {
46   static const std::map<std::string, base::string16>& standard_font_family_map(
47       const blink::web_pref::WebPreferences& r) {
48     return r.standard_font_family_map;
49   }
50 
51   static const std::map<std::string, base::string16>& fixed_font_family_map(
52       const blink::web_pref::WebPreferences& r) {
53     return r.fixed_font_family_map;
54   }
55 
56   static const std::map<std::string, base::string16>& serif_font_family_map(
57       const blink::web_pref::WebPreferences& r) {
58     return r.serif_font_family_map;
59   }
60 
61   static const std::map<std::string, base::string16>&
62   sans_serif_font_family_map(const blink::web_pref::WebPreferences& r) {
63     return r.sans_serif_font_family_map;
64   }
65 
66   static const std::map<std::string, base::string16>& cursive_font_family_map(
67       const blink::web_pref::WebPreferences& r) {
68     return r.cursive_font_family_map;
69   }
70 
71   static const std::map<std::string, base::string16>& fantasy_font_family_map(
72       const blink::web_pref::WebPreferences& r) {
73     return r.fantasy_font_family_map;
74   }
75 
76   static const std::map<std::string, base::string16>&
77   pictograph_font_family_map(const blink::web_pref::WebPreferences& r) {
78     return r.pictograph_font_family_map;
79   }
80 
81   static uint32_t default_font_size(const blink::web_pref::WebPreferences& r) {
82     return r.default_font_size;
83   }
84 
85   static uint32_t default_fixed_font_size(
86       const blink::web_pref::WebPreferences& r) {
87     return r.default_fixed_font_size;
88   }
89 
90   static uint32_t minimum_font_size(const blink::web_pref::WebPreferences& r) {
91     return r.minimum_font_size;
92   }
93 
94   static uint32_t minimum_logical_font_size(
95       const blink::web_pref::WebPreferences& r) {
96     return r.minimum_logical_font_size;
97   }
98 
99   static std::string default_encoding(
100       const blink::web_pref::WebPreferences& r) {
101     return r.default_encoding;
102   }
103 
104   static bool context_menu_on_mouse_up(
105       const blink::web_pref::WebPreferences& r) {
106     return r.context_menu_on_mouse_up;
107   }
108 
109   static bool javascript_enabled(const blink::web_pref::WebPreferences& r) {
110     return r.javascript_enabled;
111   }
112 
113   static bool web_security_enabled(const blink::web_pref::WebPreferences& r) {
114     return r.web_security_enabled;
115   }
116 
117   static bool loads_images_automatically(
118       const blink::web_pref::WebPreferences& r) {
119     return r.loads_images_automatically;
120   }
121 
122   static bool images_enabled(const blink::web_pref::WebPreferences& r) {
123     return r.images_enabled;
124   }
125 
126   static bool plugins_enabled(const blink::web_pref::WebPreferences& r) {
127     return r.plugins_enabled;
128   }
129 
130   static bool dom_paste_enabled(const blink::web_pref::WebPreferences& r) {
131     return r.dom_paste_enabled;
132   }
133 
134   static bool shrinks_standalone_images_to_fit(
135       const blink::web_pref::WebPreferences& r) {
136     return r.shrinks_standalone_images_to_fit;
137   }
138 
139   static bool text_areas_are_resizable(
140       const blink::web_pref::WebPreferences& r) {
141     return r.text_areas_are_resizable;
142   }
143 
144   static bool allow_scripts_to_close_windows(
145       const blink::web_pref::WebPreferences& r) {
146     return r.allow_scripts_to_close_windows;
147   }
148 
149   static bool remote_fonts_enabled(const blink::web_pref::WebPreferences& r) {
150     return r.remote_fonts_enabled;
151   }
152 
153   static bool javascript_can_access_clipboard(
154       const blink::web_pref::WebPreferences& r) {
155     return r.javascript_can_access_clipboard;
156   }
157 
158   static bool xslt_enabled(const blink::web_pref::WebPreferences& r) {
159     return r.xslt_enabled;
160   }
161 
162   static bool dns_prefetching_enabled(
163       const blink::web_pref::WebPreferences& r) {
164     return r.dns_prefetching_enabled;
165   }
166 
167   static bool data_saver_enabled(const blink::web_pref::WebPreferences& r) {
168     return r.data_saver_enabled;
169   }
170 
171   static bool data_saver_holdback_web_api_enabled(
172       const blink::web_pref::WebPreferences& r) {
173     return r.data_saver_holdback_web_api_enabled;
174   }
175 
176   static bool local_storage_enabled(const blink::web_pref::WebPreferences& r) {
177     return r.local_storage_enabled;
178   }
179 
180   static bool databases_enabled(const blink::web_pref::WebPreferences& r) {
181     return r.databases_enabled;
182   }
183 
184   static bool application_cache_enabled(
185       const blink::web_pref::WebPreferences& r) {
186     return r.application_cache_enabled;
187   }
188 
189   static bool tabs_to_links(const blink::web_pref::WebPreferences& r) {
190     return r.tabs_to_links;
191   }
192 
193   static bool disable_ipc_flooding_protection(
194       const blink::web_pref::WebPreferences& r) {
195     return r.disable_ipc_flooding_protection;
196   }
197 
198   static bool hyperlink_auditing_enabled(
199       const blink::web_pref::WebPreferences& r) {
200     return r.hyperlink_auditing_enabled;
201   }
202 
203   static bool allow_universal_access_from_file_urls(
204       const blink::web_pref::WebPreferences& r) {
205     return r.allow_universal_access_from_file_urls;
206   }
207 
208   static bool allow_file_access_from_file_urls(
209       const blink::web_pref::WebPreferences& r) {
210     return r.allow_file_access_from_file_urls;
211   }
212 
213   static bool webgl1_enabled(const blink::web_pref::WebPreferences& r) {
214     return r.webgl1_enabled;
215   }
216 
217   static bool webgl2_enabled(const blink::web_pref::WebPreferences& r) {
218     return r.webgl2_enabled;
219   }
220 
221   static bool pepper_3d_enabled(const blink::web_pref::WebPreferences& r) {
222     return r.pepper_3d_enabled;
223   }
224 
225   static bool flash_3d_enabled(const blink::web_pref::WebPreferences& r) {
226     return r.flash_3d_enabled;
227   }
228 
229   static bool flash_stage3d_enabled(const blink::web_pref::WebPreferences& r) {
230     return r.flash_stage3d_enabled;
231   }
232 
233   static bool flash_stage3d_baseline_enabled(
234       const blink::web_pref::WebPreferences& r) {
235     return r.flash_stage3d_baseline_enabled;
236   }
237 
238   static bool privileged_webgl_extensions_enabled(
239       const blink::web_pref::WebPreferences& r) {
240     return r.privileged_webgl_extensions_enabled;
241   }
242 
243   static bool webgl_errors_to_console_enabled(
244       const blink::web_pref::WebPreferences& r) {
245     return r.webgl_errors_to_console_enabled;
246   }
247 
248   static bool hide_scrollbars(const blink::web_pref::WebPreferences& r) {
249     return r.hide_scrollbars;
250   }
251 
252   static bool accelerated_2d_canvas_enabled(
253       const blink::web_pref::WebPreferences& r) {
254     return r.accelerated_2d_canvas_enabled;
255   }
256 
257   static bool new_canvas_2d_api_enabled(
258       const blink::web_pref::WebPreferences& r) {
259     return r.new_canvas_2d_api_enabled;
260   }
261 
262   static bool antialiased_2d_canvas_disabled(
263       const blink::web_pref::WebPreferences& r) {
264     return r.antialiased_2d_canvas_disabled;
265   }
266 
267   static bool antialiased_clips_2d_canvas_enabled(
268       const blink::web_pref::WebPreferences& r) {
269     return r.antialiased_clips_2d_canvas_enabled;
270   }
271 
272   static bool accelerated_filters_enabled(
273       const blink::web_pref::WebPreferences& r) {
274     return r.accelerated_filters_enabled;
275   }
276 
277   static bool deferred_filters_enabled(
278       const blink::web_pref::WebPreferences& r) {
279     return r.deferred_filters_enabled;
280   }
281 
282   static bool container_culling_enabled(
283       const blink::web_pref::WebPreferences& r) {
284     return r.container_culling_enabled;
285   }
286 
287   static bool allow_running_insecure_content(
288       const blink::web_pref::WebPreferences& r) {
289     return r.allow_running_insecure_content;
290   }
291 
292   static bool disable_reading_from_canvas(
293       const blink::web_pref::WebPreferences& r) {
294     return r.disable_reading_from_canvas;
295   }
296 
297   static bool strict_mixed_content_checking(
298       const blink::web_pref::WebPreferences& r) {
299     return r.strict_mixed_content_checking;
300   }
301 
302   static bool strict_powerful_feature_restrictions(
303       const blink::web_pref::WebPreferences& r) {
304     return r.strict_powerful_feature_restrictions;
305   }
306 
307   static bool allow_geolocation_on_insecure_origins(
308       const blink::web_pref::WebPreferences& r) {
309     return r.allow_geolocation_on_insecure_origins;
310   }
311 
312   static bool strictly_block_blockable_mixed_content(
313       const blink::web_pref::WebPreferences& r) {
314     return r.strictly_block_blockable_mixed_content;
315   }
316 
317   static bool block_mixed_plugin_content(
318       const blink::web_pref::WebPreferences& r) {
319     return r.block_mixed_plugin_content;
320   }
321 
322   static bool password_echo_enabled(const blink::web_pref::WebPreferences& r) {
323     return r.password_echo_enabled;
324   }
325 
326   static bool should_clear_document_background(
327       const blink::web_pref::WebPreferences& r) {
328     return r.should_clear_document_background;
329   }
330 
331   static bool enable_scroll_animator(const blink::web_pref::WebPreferences& r) {
332     return r.enable_scroll_animator;
333   }
334 
335   static bool threaded_scrolling_enabled(
336       const blink::web_pref::WebPreferences& r) {
337     return r.threaded_scrolling_enabled;
338   }
339 
340   static bool prefers_reduced_motion(const blink::web_pref::WebPreferences& r) {
341     return r.prefers_reduced_motion;
342   }
343 
344   static bool touch_event_feature_detection_enabled(
345       const blink::web_pref::WebPreferences& r) {
346     return r.touch_event_feature_detection_enabled;
347   }
348 
349   static uint32_t pointer_events_max_touch_points(
350       const blink::web_pref::WebPreferences& r) {
351     return r.pointer_events_max_touch_points;
352   }
353 
354   static uint32_t available_pointer_types(
355       const blink::web_pref::WebPreferences& r) {
356     return r.available_pointer_types;
357   }
358 
359   static ui::PointerType primary_pointer_type(
360       const blink::web_pref::WebPreferences& r) {
361     return r.primary_pointer_type;
362   }
363 
364   static uint32_t available_hover_types(
365       const blink::web_pref::WebPreferences& r) {
366     return r.available_hover_types;
367   }
368 
369   static ui::HoverType primary_hover_type(
370       const blink::web_pref::WebPreferences& r) {
371     return r.primary_hover_type;
372   }
373 
374   static bool dont_send_key_events_to_javascript(
375       const blink::web_pref::WebPreferences& r) {
376     return r.dont_send_key_events_to_javascript;
377   }
378 
379   static bool barrel_button_for_drag_enabled(
380       const blink::web_pref::WebPreferences& r) {
381     return r.barrel_button_for_drag_enabled;
382   }
383 
384   static bool sync_xhr_in_documents_enabled(
385       const blink::web_pref::WebPreferences& r) {
386     return r.sync_xhr_in_documents_enabled;
387   }
388 
389   static bool target_blank_implies_no_opener_enabled_will_be_removed(
390       const blink::web_pref::WebPreferences& r) {
391     return r.target_blank_implies_no_opener_enabled_will_be_removed;
392   }
393 
394   static uint32_t number_of_cpu_cores(
395       const blink::web_pref::WebPreferences& r) {
396     return r.number_of_cpu_cores;
397   }
398 
399   static blink::mojom::EditingBehavior editing_behavior(
400       const blink::web_pref::WebPreferences& r) {
401     return r.editing_behavior;
402   }
403 
404   static bool supports_multiple_windows(
405       const blink::web_pref::WebPreferences& r) {
406     return r.supports_multiple_windows;
407   }
408 
409   static bool viewport_enabled(const blink::web_pref::WebPreferences& r) {
410     return r.viewport_enabled;
411   }
412 
413   static bool viewport_meta_enabled(const blink::web_pref::WebPreferences& r) {
414     return r.viewport_meta_enabled;
415   }
416 
417   static bool shrinks_viewport_contents_to_fit(
418       const blink::web_pref::WebPreferences& r) {
419     return r.shrinks_viewport_contents_to_fit;
420   }
421 
422   static blink::mojom::ViewportStyle viewport_style(
423       const blink::web_pref::WebPreferences& r) {
424     return r.viewport_style;
425   }
426 
427   static bool smooth_scroll_for_find_enabled(
428       const blink::web_pref::WebPreferences& r) {
429     return r.smooth_scroll_for_find_enabled;
430   }
431 
432   static bool main_frame_resizes_are_orientation_changes(
433       const blink::web_pref::WebPreferences& r) {
434     return r.main_frame_resizes_are_orientation_changes;
435   }
436 
437   static bool initialize_at_minimum_page_scale(
438       const blink::web_pref::WebPreferences& r) {
439     return r.initialize_at_minimum_page_scale;
440   }
441 
442   static bool smart_insert_delete_enabled(
443       const blink::web_pref::WebPreferences& r) {
444     return r.smart_insert_delete_enabled;
445   }
446 
447   static bool spatial_navigation_enabled(
448       const blink::web_pref::WebPreferences& r) {
449     return r.spatial_navigation_enabled;
450   }
451 
452   static bool navigate_on_drag_drop(const blink::web_pref::WebPreferences& r) {
453     return r.navigate_on_drag_drop;
454   }
455 
456   static const blink::mojom::V8CacheOptions& v8_cache_options(
457       const blink::web_pref::WebPreferences& r) {
458     return r.v8_cache_options;
459   }
460 
461   static bool record_whole_document(const blink::web_pref::WebPreferences& r) {
462     return r.record_whole_document;
463   }
464 
465   static bool cookie_enabled(const blink::web_pref::WebPreferences& r) {
466     return r.cookie_enabled;
467   }
468 
469   static bool accelerated_video_decode_enabled(
470       const blink::web_pref::WebPreferences& r) {
471     return r.accelerated_video_decode_enabled;
472   }
473 
474   static blink::mojom::ImageAnimationPolicy animation_policy(
475       const blink::web_pref::WebPreferences& r) {
476     return r.animation_policy;
477   }
478 
479   static bool user_gesture_required_for_presentation(
480       const blink::web_pref::WebPreferences& r) {
481     return r.user_gesture_required_for_presentation;
482   }
483 
484   static bool text_tracks_enabled(const blink::web_pref::WebPreferences& r) {
485     return r.text_tracks_enabled;
486   }
487 
488   static const std::string& text_track_background_color(
489       const blink::web_pref::WebPreferences& r) {
490     return r.text_track_background_color;
491   }
492 
493   static const std::string& text_track_text_color(
494       const blink::web_pref::WebPreferences& r) {
495     return r.text_track_text_color;
496   }
497 
498   static const std::string& text_track_text_size(
499       const blink::web_pref::WebPreferences& r) {
500     return r.text_track_text_size;
501   }
502 
503   static const std::string& text_track_text_shadow(
504       const blink::web_pref::WebPreferences& r) {
505     return r.text_track_text_shadow;
506   }
507 
508   static const std::string& text_track_font_family(
509       const blink::web_pref::WebPreferences& r) {
510     return r.text_track_font_family;
511   }
512 
513   static const std::string& text_track_font_style(
514       const blink::web_pref::WebPreferences& r) {
515     return r.text_track_font_style;
516   }
517 
518   static const std::string& text_track_font_variant(
519       const blink::web_pref::WebPreferences& r) {
520     return r.text_track_font_variant;
521   }
522 
523   static const std::string& text_track_window_color(
524       const blink::web_pref::WebPreferences& r) {
525     return r.text_track_window_color;
526   }
527 
528   static const std::string& text_track_window_padding(
529       const blink::web_pref::WebPreferences& r) {
530     return r.text_track_window_padding;
531   }
532 
533   static const std::string& text_track_window_radius(
534       const blink::web_pref::WebPreferences& r) {
535     return r.text_track_window_radius;
536   }
537 
538   static float text_track_margin_percentage(
539       const blink::web_pref::WebPreferences& r) {
540     return r.text_track_margin_percentage;
541   }
542 
543   static bool immersive_mode_enabled(const blink::web_pref::WebPreferences& r) {
544     return r.immersive_mode_enabled;
545   }
546 
547   static bool double_tap_to_zoom_enabled(
548       const blink::web_pref::WebPreferences& r) {
549     return r.double_tap_to_zoom_enabled;
550   }
551 
552   static bool fullscreen_supported(const blink::web_pref::WebPreferences& r) {
553     return r.fullscreen_supported;
554   }
555 
556   static bool text_autosizing_enabled(
557       const blink::web_pref::WebPreferences& r) {
558     return r.text_autosizing_enabled;
559   }
560 
561   static const GURL& web_app_scope(const ::blink::web_pref::WebPreferences& r) {
562     return r.web_app_scope;
563   }
564 
565 #if defined(OS_ANDROID)
566   static float font_scale_factor(const blink::web_pref::WebPreferences& r) {
567     return r.font_scale_factor;
568   }
569 
570   static float device_scale_adjustment(
571       const blink::web_pref::WebPreferences& r) {
572     return r.device_scale_adjustment;
573   }
574 
575   static bool force_enable_zoom(const blink::web_pref::WebPreferences& r) {
576     return r.force_enable_zoom;
577   }
578 
579   static const GURL& default_video_poster_url(
580       const blink::web_pref::WebPreferences& r) {
581     return r.default_video_poster_url;
582   }
583 
584   static bool support_deprecated_target_density_dpi(
585       const blink::web_pref::WebPreferences& r) {
586     return r.support_deprecated_target_density_dpi;
587   }
588 
589   static bool use_legacy_background_size_shorthand_behavior(
590       const blink::web_pref::WebPreferences& r) {
591     return r.use_legacy_background_size_shorthand_behavior;
592   }
593 
594   static bool wide_viewport_quirk(const blink::web_pref::WebPreferences& r) {
595     return r.wide_viewport_quirk;
596   }
597 
598   static bool use_wide_viewport(const blink::web_pref::WebPreferences& r) {
599     return r.use_wide_viewport;
600   }
601 
602   static bool force_zero_layout_height(
603       const blink::web_pref::WebPreferences& r) {
604     return r.force_zero_layout_height;
605   }
606 
607   static bool viewport_meta_merge_content_quirk(
608       const blink::web_pref::WebPreferences& r) {
609     return r.viewport_meta_merge_content_quirk;
610   }
611 
612   static bool viewport_meta_non_user_scalable_quirk(
613       const blink::web_pref::WebPreferences& r) {
614     return r.viewport_meta_non_user_scalable_quirk;
615   }
616 
617   static bool viewport_meta_zero_values_quirk(
618       const blink::web_pref::WebPreferences& r) {
619     return r.viewport_meta_zero_values_quirk;
620   }
621 
622   static bool clobber_user_agent_initial_scale_quirk(
623       const blink::web_pref::WebPreferences& r) {
624     return r.clobber_user_agent_initial_scale_quirk;
625   }
626 
627   static bool ignore_main_frame_overflow_hidden_quirk(
628       const blink::web_pref::WebPreferences& r) {
629     return r.ignore_main_frame_overflow_hidden_quirk;
630   }
631 
632   static bool report_screen_size_in_physical_pixels_quirk(
633       const blink::web_pref::WebPreferences& r) {
634     return r.report_screen_size_in_physical_pixels_quirk;
635   }
636 
637   static bool reuse_global_for_unowned_main_frame(
638       const blink::web_pref::WebPreferences& r) {
639     return r.reuse_global_for_unowned_main_frame;
640   }
641 
642   static bool spellcheck_enabled_by_default(
643       const blink::web_pref::WebPreferences& r) {
644     return r.spellcheck_enabled_by_default;
645   }
646 
647   static bool video_fullscreen_orientation_lock_enabled(
648       const blink::web_pref::WebPreferences& r) {
649     return r.video_fullscreen_orientation_lock_enabled;
650   }
651 
652   static bool video_rotate_to_fullscreen_enabled(
653       const blink::web_pref::WebPreferences& r) {
654     return r.video_rotate_to_fullscreen_enabled;
655   }
656 
657   static bool embedded_media_experience_enabled(
658       const blink::web_pref::WebPreferences& r) {
659     return r.embedded_media_experience_enabled;
660   }
661 
662   static bool css_hex_alpha_color_enabled(
663       const blink::web_pref::WebPreferences& r) {
664     return r.css_hex_alpha_color_enabled;
665   }
666 
667   static bool scroll_top_left_interop_enabled(
668       const blink::web_pref::WebPreferences& r) {
669     return r.scroll_top_left_interop_enabled;
670   }
671 
672   static bool disable_features_depending_on_viz(
673       const blink::web_pref::WebPreferences& r) {
674     return r.disable_features_depending_on_viz;
675   }
676 
677   static bool disable_accelerated_small_canvases(
678       const blink::web_pref::WebPreferences& r) {
679     return r.disable_accelerated_small_canvases;
680   }
681 #endif
682 
683   static bool force_dark_mode_enabled(
684       const blink::web_pref::WebPreferences& r) {
685     return r.force_dark_mode_enabled;
686   }
687 
688   static float default_minimum_page_scale_factor(
689       const blink::web_pref::WebPreferences& r) {
690     return r.default_minimum_page_scale_factor;
691   }
692 
693   static float default_maximum_page_scale_factor(
694       const blink::web_pref::WebPreferences& r) {
695     return r.default_maximum_page_scale_factor;
696   }
697 
698   static bool hide_download_ui(const blink::web_pref::WebPreferences& r) {
699     return r.hide_download_ui;
700   }
701 
702   static bool presentation_receiver(const blink::web_pref::WebPreferences& r) {
703     return r.presentation_receiver;
704   }
705 
706   static bool media_controls_enabled(const blink::web_pref::WebPreferences& r) {
707     return r.media_controls_enabled;
708   }
709 
710   static bool do_not_update_selection_on_mutating_selection_range(
711       const blink::web_pref::WebPreferences& r) {
712     return r.do_not_update_selection_on_mutating_selection_range;
713   }
714 
715   static blink::mojom::AutoplayPolicy autoplay_policy(
716       const blink::web_pref::WebPreferences& r) {
717     return r.autoplay_policy;
718   }
719 
720   static blink::mojom::PreferredColorScheme preferred_color_scheme(
721       const blink::web_pref::WebPreferences& r) {
722     return r.preferred_color_scheme;
723   }
724 
725   static blink::mojom::PreferredContrast preferred_contrast(
726       const blink::web_pref::WebPreferences& r) {
727     return r.preferred_contrast;
728   }
729 
730   static net::EffectiveConnectionType low_priority_iframes_threshold(
731       const blink::web_pref::WebPreferences& r) {
732     return r.low_priority_iframes_threshold;
733   }
734 
735   static bool picture_in_picture_enabled(
736       const blink::web_pref::WebPreferences& r) {
737     return r.picture_in_picture_enabled;
738   }
739 
740   static bool translate_service_available(
741       const blink::web_pref::WebPreferences& r) {
742     return r.translate_service_available;
743   }
744 
745   static net::EffectiveConnectionType network_quality_estimator_web_holdback(
746       const blink::web_pref::WebPreferences& r) {
747     return r.network_quality_estimator_web_holdback;
748   }
749 
750   static bool lazy_load_enabled(const blink::web_pref::WebPreferences& r) {
751     return r.lazy_load_enabled;
752   }
753 
754   static const std::map<net::EffectiveConnectionType, int32_t>&
755   lazy_frame_loading_distance_thresholds_px(
756       const blink::web_pref::WebPreferences& r) {
757     return r.lazy_frame_loading_distance_thresholds_px;
758   }
759 
760   static const std::map<net::EffectiveConnectionType, int32_t>&
761   lazy_image_loading_distance_thresholds_px(
762       const blink::web_pref::WebPreferences& r) {
763     return r.lazy_image_loading_distance_thresholds_px;
764   }
765 
766   static const std::map<net::EffectiveConnectionType, int32_t>&
767   lazy_image_first_k_fully_load(const blink::web_pref::WebPreferences& r) {
768     return r.lazy_image_first_k_fully_load;
769   }
770 
771   static bool allow_mixed_content_upgrades(
772       const blink::web_pref::WebPreferences& r) {
773     return r.allow_mixed_content_upgrades;
774   }
775 
776   static bool always_show_focus(const blink::web_pref::WebPreferences& r) {
777     return r.always_show_focus;
778   }
779 
780   static bool touch_drag_drop_enabled(
781       const blink::web_pref::WebPreferences& r) {
782     return r.touch_drag_drop_enabled;
783   }
784 
785   static bool Read(blink::mojom::WebPreferencesDataView r,
786                    blink::web_pref::WebPreferences* out);
787 };
788 
789 }  // namespace mojo
790 
791 #endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PREFERENCES_WEB_PREFERENCES_MOJOM_TRAITS_H_
792