File: renderer_preferences_mojom_traits.cc

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (138 lines) | stat: -rw-r--r-- 4,752 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/public/common/renderer_preferences/renderer_preferences_mojom_traits.h"

#include <string>

#include "build/build_config.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom-shared.h"

namespace mojo {

bool StructTraits<blink::mojom::RendererPreferencesDataView,
                  ::blink::RendererPreferences>::
    Read(blink::mojom::RendererPreferencesDataView data,
         ::blink::RendererPreferences* out) {
  out->can_accept_load_drops = data.can_accept_load_drops();
  out->should_antialias_text = data.should_antialias_text();

  if (!data.ReadHinting(&out->hinting))
    return false;
  out->use_autohinter = data.use_autohinter();

  out->use_bitmaps = data.use_bitmaps();

  if (!data.ReadSubpixelRendering(&out->subpixel_rendering))
    return false;
  out->use_subpixel_positioning = data.use_subpixel_positioning();

#if BUILDFLAG(IS_WIN)
  out->text_contrast = data.text_contrast();
  out->text_gamma = data.text_gamma();
#endif  // BUILDFLAG(IS_WIN)

  out->focus_ring_color = data.focus_ring_color();
  out->active_selection_bg_color = data.active_selection_bg_color();
  out->active_selection_fg_color = data.active_selection_fg_color();
  out->inactive_selection_bg_color = data.inactive_selection_bg_color();
  out->inactive_selection_fg_color = data.inactive_selection_fg_color();

  out->browser_handles_all_top_level_requests =
      data.browser_handles_all_top_level_requests();

  if (!data.ReadCaretBlinkInterval(&out->caret_blink_interval))
    return false;

  out->use_custom_colors = data.use_custom_colors();

#if BUILDFLAG(IS_CHROMEOS)
  out->use_overlay_scrollbar = data.use_overlay_scrollbar();
#endif

  out->enable_referrers = data.enable_referrers();
  out->allow_cross_origin_auth_prompt = data.allow_cross_origin_auth_prompt();
  out->enable_do_not_track = data.enable_do_not_track();
  out->enable_encrypted_media = data.enable_encrypted_media();

  if (!data.ReadWebrtcIpHandlingPolicy(&out->webrtc_ip_handling_policy))
    return false;

  if (!data.ReadWebrtcIpHandlingUrls(&out->webrtc_ip_handling_urls)) {
    return false;
  }

  out->webrtc_udp_min_port = data.webrtc_udp_min_port();
  out->webrtc_udp_max_port = data.webrtc_udp_max_port();

  if (!data.ReadWebrtcLocalIpsAllowedUrls(&out->webrtc_local_ips_allowed_urls))
    return false;

  if (!data.ReadUserAgentOverride(&out->user_agent_override))
    return false;

  if (!data.ReadAcceptLanguages(&out->accept_languages))
    return false;

  out->send_subresource_notification = data.send_subresource_notification();

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
  if (!data.ReadSystemFontFamilyName(&out->system_font_family_name))
    return false;
#endif
#if BUILDFLAG(IS_WIN)
  if (!data.ReadCaptionFontFamilyName(&out->caption_font_family_name))
    return false;
  out->caption_font_height = data.caption_font_height();

  if (!data.ReadSmallCaptionFontFamilyName(
          &out->small_caption_font_family_name))
    return false;
  out->small_caption_font_height = data.small_caption_font_height();

  if (!data.ReadMenuFontFamilyName(&out->menu_font_family_name))
    return false;
  out->menu_font_height = data.menu_font_height();

  if (!data.ReadStatusFontFamilyName(&out->status_font_family_name))
    return false;
  out->status_font_height = data.status_font_height();

  if (!data.ReadMessageFontFamilyName(&out->message_font_family_name))
    return false;
  out->message_font_height = data.message_font_height();

  out->vertical_scroll_bar_width_in_dips =
      data.vertical_scroll_bar_width_in_dips();
  out->horizontal_scroll_bar_height_in_dips =
      data.horizontal_scroll_bar_height_in_dips();
  out->arrow_bitmap_height_vertical_scroll_bar_in_dips =
      data.arrow_bitmap_height_vertical_scroll_bar_in_dips();
  out->arrow_bitmap_width_horizontal_scroll_bar_in_dips =
      data.arrow_bitmap_width_horizontal_scroll_bar_in_dips();
#endif
#if BUILDFLAG(IS_OZONE)
  out->selection_clipboard_buffer_available =
      data.selection_clipboard_buffer_available();
#endif
  out->plugin_fullscreen_allowed = data.plugin_fullscreen_allowed();
  out->caret_browsing_enabled = data.caret_browsing_enabled();

#if BUILDFLAG(IS_ANDROID)
  out->uses_platform_autofill = data.uses_platform_autofill();
#endif  // BUILDFLAG(IS_ANDROID)

  if (!data.ReadExplicitlyAllowedNetworkPorts(
          &out->explicitly_allowed_network_ports)) {
    return false;
  }

  out->canvas_noise_token = data.canvas_noise_token();

  out->view_source_line_wrap_enabled = data.view_source_line_wrap_enabled();

  return true;
}

}  // namespace mojo