1 // Copyright (c) 2012 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 // Singly or Multiply-included shared traits file depending on circumstances. 6 // This allows the use of IPC serialization macros in more than one IPC message 7 // file. 8 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ 9 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ 10 11 #include "build/build_config.h" 12 #include "content/public/common/browser_controls_state.h" 13 #include "content/public/common/drop_data.h" 14 #include "content/public/common/referrer.h" 15 #include "content/public/common/webplugininfo_param_traits.h" 16 #include "ipc/ipc_message_macros.h" 17 #include "services/network/public/cpp/network_ipc_param_traits.h" 18 #include "services/network/public/mojom/referrer_policy.mojom.h" 19 #include "third_party/blink/public/common/page/drag_operation.h" 20 #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" 21 #include "third_party/blink/public/common/security/security_style.h" 22 #include "third_party/blink/public/common/web_preferences/web_preferences.h" 23 #include "third_party/blink/public/mojom/devtools/console_message.mojom.h" 24 #include "third_party/blink/public/mojom/page_state/page_state.mojom.h" 25 #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h" 26 #include "third_party/blink/public/mojom/v8_cache_options.mojom.h" 27 #include "third_party/blink/public/mojom/window_features/window_features.mojom.h" 28 #include "third_party/blink/public/platform/web_rect.h" 29 #include "third_party/blink/public/platform/web_url_request.h" 30 #include "ui/accessibility/ax_param_traits.h" 31 #include "ui/base/page_transition_types.h" 32 #include "ui/base/window_open_disposition.h" 33 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" 34 #include "ui/gfx/ipc/gfx_param_traits.h" 35 #include "ui/gfx/transform.h" 36 37 #undef IPC_MESSAGE_EXPORT 38 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 39 40 IPC_ENUM_TRAITS_MAX_VALUE(content::BrowserControlsState, 41 content::BROWSER_CONTROLS_STATE_LAST) 42 43 IPC_ENUM_TRAITS_VALIDATE(ui::PageTransition, 44 ((value & 45 ui::PageTransition::PAGE_TRANSITION_CORE_MASK) <= 46 ui::PageTransition::PAGE_TRANSITION_LAST_CORE)) 47 IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ConsoleMessageLevel, 48 blink::mojom::ConsoleMessageLevel::kError) 49 IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ReferrerPolicy, 50 network::mojom::ReferrerPolicy::kMaxValue) 51 IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ScrollRestorationType, 52 blink::mojom::ScrollRestorationType::kMaxValue) 53 IPC_ENUM_TRAITS_MAX_VALUE(blink::SecurityStyle, blink::SecurityStyle::kMaxValue) 54 IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PermissionStatus, 55 blink::mojom::PermissionStatus::LAST) 56 IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition, 57 WindowOpenDisposition::MAX_VALUE) 58 59 IPC_STRUCT_TRAITS_BEGIN(blink::WebRect) 60 IPC_STRUCT_TRAITS_MEMBER(x) 61 IPC_STRUCT_TRAITS_MEMBER(y) 62 IPC_STRUCT_TRAITS_MEMBER(width) 63 IPC_STRUCT_TRAITS_MEMBER(height) 64 IPC_STRUCT_TRAITS_END() 65 66 IPC_STRUCT_TRAITS_BEGIN(content::Referrer) 67 IPC_STRUCT_TRAITS_MEMBER(url) 68 IPC_STRUCT_TRAITS_MEMBER(policy) 69 IPC_STRUCT_TRAITS_END() 70 71 IPC_STRUCT_TRAITS_BEGIN(blink::mojom::WindowFeatures) 72 IPC_STRUCT_TRAITS_MEMBER(x) 73 IPC_STRUCT_TRAITS_MEMBER(has_x) 74 IPC_STRUCT_TRAITS_MEMBER(y) 75 IPC_STRUCT_TRAITS_MEMBER(has_y) 76 IPC_STRUCT_TRAITS_MEMBER(width) 77 IPC_STRUCT_TRAITS_MEMBER(has_width) 78 IPC_STRUCT_TRAITS_MEMBER(height) 79 IPC_STRUCT_TRAITS_MEMBER(has_height) 80 IPC_STRUCT_TRAITS_MEMBER(menu_bar_visible) 81 IPC_STRUCT_TRAITS_MEMBER(status_bar_visible) 82 IPC_STRUCT_TRAITS_MEMBER(tool_bar_visible) 83 IPC_STRUCT_TRAITS_MEMBER(scrollbars_visible) 84 IPC_STRUCT_TRAITS_END() 85 86 IPC_ENUM_TRAITS_MAX_VALUE(gfx::FontRenderParams::Hinting, 87 gfx::FontRenderParams::HINTING_MAX) 88 IPC_ENUM_TRAITS_MAX_VALUE(gfx::FontRenderParams::SubpixelRendering, 89 gfx::FontRenderParams::SUBPIXEL_RENDERING_MAX) 90 91 IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentBrandVersion) 92 IPC_STRUCT_TRAITS_MEMBER(brand) 93 IPC_STRUCT_TRAITS_MEMBER(major_version) 94 IPC_STRUCT_TRAITS_END() 95 96 IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentMetadata) 97 IPC_STRUCT_TRAITS_MEMBER(brand_version_list) 98 IPC_STRUCT_TRAITS_MEMBER(full_version) 99 IPC_STRUCT_TRAITS_MEMBER(platform) 100 IPC_STRUCT_TRAITS_MEMBER(platform_version) 101 IPC_STRUCT_TRAITS_MEMBER(architecture) 102 IPC_STRUCT_TRAITS_MEMBER(model) 103 IPC_STRUCT_TRAITS_MEMBER(mobile) 104 IPC_STRUCT_TRAITS_END() 105 106 IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentOverride) 107 IPC_STRUCT_TRAITS_MEMBER(ua_string_override) 108 IPC_STRUCT_TRAITS_MEMBER(ua_metadata_override) 109 IPC_STRUCT_TRAITS_END() 110 111 IPC_STRUCT_TRAITS_BEGIN(blink::RendererPreferences) 112 IPC_STRUCT_TRAITS_MEMBER(can_accept_load_drops) 113 IPC_STRUCT_TRAITS_MEMBER(should_antialias_text) 114 IPC_STRUCT_TRAITS_MEMBER(hinting) 115 IPC_STRUCT_TRAITS_MEMBER(use_autohinter) 116 IPC_STRUCT_TRAITS_MEMBER(use_bitmaps) 117 IPC_STRUCT_TRAITS_MEMBER(subpixel_rendering) 118 IPC_STRUCT_TRAITS_MEMBER(use_subpixel_positioning) 119 IPC_STRUCT_TRAITS_MEMBER(focus_ring_color) 120 IPC_STRUCT_TRAITS_MEMBER(active_selection_bg_color) 121 IPC_STRUCT_TRAITS_MEMBER(active_selection_fg_color) 122 IPC_STRUCT_TRAITS_MEMBER(inactive_selection_bg_color) 123 IPC_STRUCT_TRAITS_MEMBER(inactive_selection_fg_color) 124 IPC_STRUCT_TRAITS_MEMBER(browser_handles_all_top_level_requests) 125 IPC_STRUCT_TRAITS_MEMBER(caret_blink_interval) 126 IPC_STRUCT_TRAITS_MEMBER(use_custom_colors) 127 IPC_STRUCT_TRAITS_MEMBER(enable_referrers) 128 IPC_STRUCT_TRAITS_MEMBER(enable_do_not_track) 129 IPC_STRUCT_TRAITS_MEMBER(enable_encrypted_media) 130 IPC_STRUCT_TRAITS_MEMBER(webrtc_ip_handling_policy) 131 IPC_STRUCT_TRAITS_MEMBER(webrtc_udp_min_port) 132 IPC_STRUCT_TRAITS_MEMBER(webrtc_udp_max_port) 133 IPC_STRUCT_TRAITS_MEMBER(user_agent_override) 134 IPC_STRUCT_TRAITS_MEMBER(accept_languages) 135 IPC_STRUCT_TRAITS_MEMBER(plugin_fullscreen_allowed) 136 IPC_STRUCT_TRAITS_MEMBER(caret_browsing_enabled) 137 #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) 138 IPC_STRUCT_TRAITS_MEMBER(system_font_family_name) 139 IPC_STRUCT_TRAITS_MEMBER(selection_clipboard_buffer_available) 140 #endif 141 #if defined(OS_WIN) 142 IPC_STRUCT_TRAITS_MEMBER(caption_font_family_name) 143 IPC_STRUCT_TRAITS_MEMBER(caption_font_height) 144 IPC_STRUCT_TRAITS_MEMBER(small_caption_font_family_name) 145 IPC_STRUCT_TRAITS_MEMBER(small_caption_font_height) 146 IPC_STRUCT_TRAITS_MEMBER(menu_font_family_name) 147 IPC_STRUCT_TRAITS_MEMBER(menu_font_height) 148 IPC_STRUCT_TRAITS_MEMBER(status_font_family_name) 149 IPC_STRUCT_TRAITS_MEMBER(status_font_height) 150 IPC_STRUCT_TRAITS_MEMBER(message_font_family_name) 151 IPC_STRUCT_TRAITS_MEMBER(message_font_height) 152 IPC_STRUCT_TRAITS_MEMBER(vertical_scroll_bar_width_in_dips) 153 IPC_STRUCT_TRAITS_MEMBER(horizontal_scroll_bar_height_in_dips) 154 IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_height_vertical_scroll_bar_in_dips) 155 IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_width_horizontal_scroll_bar_in_dips) 156 #endif 157 #if defined(USE_X11) || defined(USE_OZONE) 158 IPC_STRUCT_TRAITS_MEMBER(selection_clipboard_buffer_available) 159 #endif 160 IPC_STRUCT_TRAITS_END() 161 162 IPC_ENUM_TRAITS(blink::DragOperation) // Bitmask. 163 IPC_ENUM_TRAITS_MAX_VALUE(content::DropData::Kind, 164 content::DropData::Kind::LAST) 165 166 IPC_STRUCT_TRAITS_BEGIN(ui::FileInfo) 167 IPC_STRUCT_TRAITS_MEMBER(path) 168 IPC_STRUCT_TRAITS_MEMBER(display_name) 169 IPC_STRUCT_TRAITS_END() 170 171 IPC_STRUCT_TRAITS_BEGIN(content::DropData) 172 IPC_STRUCT_TRAITS_MEMBER(url) 173 IPC_STRUCT_TRAITS_MEMBER(url_title) 174 IPC_STRUCT_TRAITS_MEMBER(download_metadata) 175 IPC_STRUCT_TRAITS_MEMBER(referrer_policy) 176 IPC_STRUCT_TRAITS_MEMBER(filenames) 177 IPC_STRUCT_TRAITS_MEMBER(filesystem_id) 178 IPC_STRUCT_TRAITS_MEMBER(file_system_files) 179 IPC_STRUCT_TRAITS_MEMBER(text) 180 IPC_STRUCT_TRAITS_MEMBER(html) 181 IPC_STRUCT_TRAITS_MEMBER(html_base_url) 182 IPC_STRUCT_TRAITS_MEMBER(file_contents) 183 IPC_STRUCT_TRAITS_MEMBER(file_contents_source_url) 184 IPC_STRUCT_TRAITS_MEMBER(file_contents_filename_extension) 185 IPC_STRUCT_TRAITS_MEMBER(file_contents_content_disposition) 186 IPC_STRUCT_TRAITS_MEMBER(custom_data) 187 IPC_STRUCT_TRAITS_END() 188 189 IPC_STRUCT_TRAITS_BEGIN(content::DropData::FileSystemFileInfo) 190 IPC_STRUCT_TRAITS_MEMBER(url) 191 IPC_STRUCT_TRAITS_MEMBER(size) 192 IPC_STRUCT_TRAITS_MEMBER(filesystem_id) 193 IPC_STRUCT_TRAITS_END() 194 195 IPC_STRUCT_TRAITS_BEGIN(content::DropData::Metadata) 196 IPC_STRUCT_TRAITS_MEMBER(kind) 197 IPC_STRUCT_TRAITS_MEMBER(mime_type) 198 IPC_STRUCT_TRAITS_MEMBER(filename) 199 IPC_STRUCT_TRAITS_MEMBER(file_system_url) 200 IPC_STRUCT_TRAITS_END() 201 202 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ 203