Skip to content

Commit

Permalink
Cleanup: Remove legacy IPC traits.
Browse files Browse the repository at this point in the history
Context: During some code review I saw some patch maintaining some
unused traits:
https://chromium-review.googlesource.com/c/chromium/src/+/4558705/comment/39abeff8_f6588699/
So, I decided to clean this up a bit.

Bug: None.
Change-Id: I54a19c04fb4efd9453be29c50f961abe9837cc31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4615128
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1185094}
  • Loading branch information
ArthurSonzogni authored and Chromium LUCI CQ committed Aug 18, 2023
1 parent 22ce2aa commit 8c6a8a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 117 deletions.
120 changes: 10 additions & 110 deletions content/public/common/common_param_traits_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,134 +8,32 @@
#ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
#define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_

#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/public/common/drop_data.h"
#include "content/public/common/referrer.h"
#include "content/public/common/webplugininfo_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "services/network/public/cpp/network_ipc_param_traits.h"
#include "services/network/public/mojom/referrer_policy.mojom.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
#include "third_party/blink/public/common/security/security_style.h"
#include "third_party/blink/public/common/user_agent/user_agent_brand_version_type.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/page_state/page_state.mojom-shared.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
#include "third_party/blink/public/mojom/v8_cache_options.mojom.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/gfx_param_traits.h"

#if BUILDFLAG(IS_MAC)
#include "content/public/common/drop_data.h"
#include "content/public/common/referrer.h"
#endif

#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT

IPC_ENUM_TRAITS_VALIDATE(ui::PageTransition,
((value &
ui::PageTransition::PAGE_TRANSITION_CORE_MASK) <=
ui::PageTransition::PAGE_TRANSITION_LAST_CORE))
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ConsoleMessageLevel,
blink::mojom::ConsoleMessageLevel::kError)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ReferrerPolicy,
network::mojom::ReferrerPolicy::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ScrollRestorationType,
blink::mojom::ScrollRestorationType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PermissionStatus,
blink::mojom::PermissionStatus::LAST)
IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition,
WindowOpenDisposition::MAX_VALUE)

IPC_STRUCT_TRAITS_BEGIN(content::Referrer)
IPC_STRUCT_TRAITS_MEMBER(url)
IPC_STRUCT_TRAITS_MEMBER(policy)
IPC_STRUCT_TRAITS_END()

IPC_ENUM_TRAITS_MAX_VALUE(gfx::FontRenderParams::Hinting,
gfx::FontRenderParams::HINTING_MAX)
IPC_ENUM_TRAITS_MAX_VALUE(gfx::FontRenderParams::SubpixelRendering,
gfx::FontRenderParams::SUBPIXEL_RENDERING_MAX)

IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentBrandVersion)
IPC_STRUCT_TRAITS_MEMBER(brand)
IPC_STRUCT_TRAITS_MEMBER(version)
IPC_STRUCT_TRAITS_END()
#if BUILDFLAG(IS_MAC)

IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentMetadata)
IPC_STRUCT_TRAITS_MEMBER(brand_version_list)
IPC_STRUCT_TRAITS_MEMBER(brand_full_version_list)
IPC_STRUCT_TRAITS_MEMBER(full_version)
IPC_STRUCT_TRAITS_MEMBER(platform)
IPC_STRUCT_TRAITS_MEMBER(platform_version)
IPC_STRUCT_TRAITS_MEMBER(architecture)
IPC_STRUCT_TRAITS_MEMBER(model)
IPC_STRUCT_TRAITS_MEMBER(mobile)
IPC_STRUCT_TRAITS_MEMBER(bitness)
IPC_STRUCT_TRAITS_MEMBER(wow64)
IPC_STRUCT_TRAITS_MEMBER(form_factor)
IPC_STRUCT_TRAITS_END()

IPC_ENUM_TRAITS_MAX_VALUE(blink::UserAgentBrandVersionType,
blink::UserAgentBrandVersionType::kMaxValue)

IPC_STRUCT_TRAITS_BEGIN(blink::UserAgentOverride)
IPC_STRUCT_TRAITS_MEMBER(ua_string_override)
IPC_STRUCT_TRAITS_MEMBER(ua_metadata_override)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(blink::RendererPreferences)
IPC_STRUCT_TRAITS_MEMBER(can_accept_load_drops)
IPC_STRUCT_TRAITS_MEMBER(should_antialias_text)
IPC_STRUCT_TRAITS_MEMBER(hinting)
IPC_STRUCT_TRAITS_MEMBER(use_autohinter)
IPC_STRUCT_TRAITS_MEMBER(use_bitmaps)
IPC_STRUCT_TRAITS_MEMBER(subpixel_rendering)
IPC_STRUCT_TRAITS_MEMBER(use_subpixel_positioning)
IPC_STRUCT_TRAITS_MEMBER(focus_ring_color)
IPC_STRUCT_TRAITS_MEMBER(active_selection_bg_color)
IPC_STRUCT_TRAITS_MEMBER(active_selection_fg_color)
IPC_STRUCT_TRAITS_MEMBER(inactive_selection_bg_color)
IPC_STRUCT_TRAITS_MEMBER(inactive_selection_fg_color)
IPC_STRUCT_TRAITS_MEMBER(browser_handles_all_top_level_requests)
IPC_STRUCT_TRAITS_MEMBER(caret_blink_interval)
IPC_STRUCT_TRAITS_MEMBER(use_custom_colors)
IPC_STRUCT_TRAITS_MEMBER(enable_referrers)
IPC_STRUCT_TRAITS_MEMBER(enable_do_not_track)
IPC_STRUCT_TRAITS_MEMBER(enable_encrypted_media)
IPC_STRUCT_TRAITS_MEMBER(webrtc_ip_handling_policy)
IPC_STRUCT_TRAITS_MEMBER(webrtc_udp_min_port)
IPC_STRUCT_TRAITS_MEMBER(webrtc_udp_max_port)
IPC_STRUCT_TRAITS_MEMBER(user_agent_override)
IPC_STRUCT_TRAITS_MEMBER(accept_languages)
IPC_STRUCT_TRAITS_MEMBER(plugin_fullscreen_allowed)
IPC_STRUCT_TRAITS_MEMBER(caret_browsing_enabled)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
IPC_STRUCT_TRAITS_MEMBER(system_font_family_name)
#endif
#if BUILDFLAG(IS_WIN)
IPC_STRUCT_TRAITS_MEMBER(caption_font_family_name)
IPC_STRUCT_TRAITS_MEMBER(caption_font_height)
IPC_STRUCT_TRAITS_MEMBER(small_caption_font_family_name)
IPC_STRUCT_TRAITS_MEMBER(small_caption_font_height)
IPC_STRUCT_TRAITS_MEMBER(menu_font_family_name)
IPC_STRUCT_TRAITS_MEMBER(menu_font_height)
IPC_STRUCT_TRAITS_MEMBER(status_font_family_name)
IPC_STRUCT_TRAITS_MEMBER(status_font_height)
IPC_STRUCT_TRAITS_MEMBER(message_font_family_name)
IPC_STRUCT_TRAITS_MEMBER(message_font_height)
IPC_STRUCT_TRAITS_MEMBER(vertical_scroll_bar_width_in_dips)
IPC_STRUCT_TRAITS_MEMBER(horizontal_scroll_bar_height_in_dips)
IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_height_vertical_scroll_bar_in_dips)
IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_width_horizontal_scroll_bar_in_dips)
#endif
#if BUILDFLAG(IS_OZONE)
IPC_STRUCT_TRAITS_MEMBER(selection_clipboard_buffer_available)
#endif
IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ReferrerPolicy,
network::mojom::ReferrerPolicy::kMaxValue)

IPC_ENUM_TRAITS_MAX_VALUE(content::DropData::Kind,
content::DropData::Kind::LAST)
Expand Down Expand Up @@ -176,4 +74,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::DropData::Metadata)
IPC_STRUCT_TRAITS_MEMBER(file_system_url)
IPC_STRUCT_TRAITS_END()

#endif // BUILDFLAG(IS_MAC)

#endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace blink {

// Note: if changing this, see also
// content/public/common/common_param_traits_macros.h
struct BLINK_COMMON_EXPORT UserAgentBrandVersion {
UserAgentBrandVersion() = default;
UserAgentBrandVersion(const std::string& ua_brand,
Expand All @@ -33,8 +31,6 @@ struct BLINK_COMMON_EXPORT UserAgentBrandVersion {

using UserAgentBrandList = std::vector<UserAgentBrandVersion>;

// Note: if changing this, see also
// content/public/common/common_param_traits_macros.h
struct BLINK_COMMON_EXPORT UserAgentMetadata {
private:
// Common private function turning the brand list into a structured header
Expand Down Expand Up @@ -71,9 +67,6 @@ struct BLINK_COMMON_EXPORT UserAgentMetadata {
// features like "request desktop site", which override those from defaults
// for some individual navigations. WebContents::SetUserAgentOverride()
// is the main entry point used for the functionality.
//
// Like above, this has legacy IPC traits in
// content/public/common/common_param_traits_macros.h
struct BLINK_COMMON_EXPORT UserAgentOverride {
// Helper which sets only UA with blank client hints.
static UserAgentOverride UserAgentOnly(const std::string& ua);
Expand Down

0 comments on commit 8c6a8a1

Please sign in to comment.