blob: deb960892c575e43c0f4b8af3d8343a60a1102c9 [file] [log] [blame]
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//content/public/common/zygote/features.gni")
import("//ipc/features.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//sandbox/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
import("features.gni")
# For feature flags internal to content. See content/public/common:features
# for feature flags that clients of contents need to know about.
buildflag_header("buildflags") {
header = "buildflags.h"
_mbi_mode_per_render_process_host = mbi_mode == "per_render_process_host"
_mbi_mode_per_site_instance = mbi_mode == "per_site_instance"
flags = [
"USE_EXTERNAL_POPUP_MENU=$use_external_popup_menu",
"ALLOW_CRITICAL_MEMORY_PRESSURE_HANDLING_IN_FOREGROUND=$allow_critical_memory_pressure_handling_in_foreground",
"ENABLE_SCREEN_CAPTURE=$enable_screen_capture",
"MBI_MODE_PER_RENDER_PROCESS_HOST=$_mbi_mode_per_render_process_host",
"MBI_MODE_PER_SITE_INSTANCE=$_mbi_mode_per_site_instance",
"CONTENT_ENABLE_LEGACY_IPC=$content_enable_legacy_ipc",
]
}
if (is_linux || is_chromeos) {
source_set("sandbox_support_linux") {
public = [
"zygote/zygote_commands_linux.h",
"zygote/zygote_communication_linux.h",
]
sources = [
"zygote/sandbox_support_linux.cc",
"zygote/send_zygote_child_ping_linux.cc",
"zygote/zygote_communication_linux.cc",
]
deps = [
"//base",
"//base:i18n",
"//content/public/common:content_descriptors",
"//content/public/common:result_codes",
"//content/public/common:sandbox_support_linux",
"//content/public/common:switches",
"//sandbox/policy",
"//third_party/icu",
]
configs += [ "//content:content_implementation" ]
}
}
source_set("common") {
# Targets external to content should always link to the public API.
# In addition, targets outside of the content component (shell and tests)
# must not link to this because it will duplicate the code in the component
# build.
visibility = [
"//content/*",
"//tools/ipc_fuzzer/message_replay:ipc_fuzzer_replay",
]
sources = [
"all_messages.h",
"background_fetch/background_fetch_types.cc",
"background_fetch/background_fetch_types.h",
"color_parser.cc",
"common_param_traits.cc",
"common_param_traits.h",
"common_param_traits_macros.h",
"content_constants_internal.cc",
"content_constants_internal.h",
"content_export.h",
"content_ipc_logging.cc",
"content_message_generator.cc",
"content_message_generator.h",
"content_navigation_policy.cc",
"content_navigation_policy.h",
"content_param_traits.cc",
"content_param_traits.h",
"content_param_traits_macros.h",
"content_paths.cc",
"content_switches_internal.cc",
"content_switches_internal.h",
"cursors/webcursor.cc",
"cursors/webcursor.h",
"cursors/webcursor_ash.cc",
"cursors/webcursor_aura.cc",
"debug_utils.cc",
"debug_utils.h",
"features.cc",
"features.h",
"fetch/fetch_api_request_proto.cc",
"fetch/fetch_api_request_proto.h",
"fetch/fetch_request_type_converters.cc",
"fetch/fetch_request_type_converters.h",
"font_list.cc",
"font_list.h",
"font_list_fontconfig.cc",
"gin_java_bridge_messages.h",
"in_process_child_thread_params.cc",
"in_process_child_thread_params.h",
"input/actions_parser.cc",
"input/actions_parser.h",
"input/event_with_latency_info.h",
"input/fling_controller.cc",
"input/fling_controller.h",
"input/fling_scheduler_base.h",
"input/gesture_event_queue.cc",
"input/gesture_event_queue.h",
"input/gesture_event_stream_validator.cc",
"input/gesture_event_stream_validator.h",
"input/input_disposition_handler.h",
"input/input_event_ack_state.cc",
"input/input_event_stream_validator.cc",
"input/input_event_stream_validator.h",
"input/input_router.h",
"input/input_router_client.h",
"input/input_router_config_helper.cc",
"input/input_router_config_helper.h",
"input/input_router_impl.cc",
"input/input_router_impl.h",
"input/mouse_wheel_event_queue.cc",
"input/mouse_wheel_event_queue.h",
"input/passthrough_touch_event_queue.cc",
"input/passthrough_touch_event_queue.h",
"input/render_input_router.cc",
"input/render_input_router.h",
"input/synthetic_gesture.cc",
"input/synthetic_gesture.h",
"input/synthetic_gesture_controller.cc",
"input/synthetic_gesture_controller.h",
"input/synthetic_gesture_params.cc",
"input/synthetic_gesture_params.h",
"input/synthetic_gesture_target.h",
"input/synthetic_mouse_driver.cc",
"input/synthetic_mouse_driver.h",
"input/synthetic_pen_driver.cc",
"input/synthetic_pen_driver.h",
"input/synthetic_pinch_gesture.cc",
"input/synthetic_pinch_gesture.h",
"input/synthetic_pinch_gesture_params.cc",
"input/synthetic_pinch_gesture_params.h",
"input/synthetic_pointer_action.cc",
"input/synthetic_pointer_action.h",
"input/synthetic_pointer_action_list_params.cc",
"input/synthetic_pointer_action_list_params.h",
"input/synthetic_pointer_action_params.cc",
"input/synthetic_pointer_action_params.h",
"input/synthetic_pointer_driver.cc",
"input/synthetic_pointer_driver.h",
"input/synthetic_smooth_drag_gesture.cc",
"input/synthetic_smooth_drag_gesture.h",
"input/synthetic_smooth_drag_gesture_params.cc",
"input/synthetic_smooth_drag_gesture_params.h",
"input/synthetic_smooth_move_gesture.cc",
"input/synthetic_smooth_move_gesture.h",
"input/synthetic_smooth_scroll_gesture.cc",
"input/synthetic_smooth_scroll_gesture.h",
"input/synthetic_smooth_scroll_gesture_params.cc",
"input/synthetic_smooth_scroll_gesture_params.h",
"input/synthetic_tap_gesture.cc",
"input/synthetic_tap_gesture.h",
"input/synthetic_tap_gesture_params.cc",
"input/synthetic_tap_gesture_params.h",
"input/synthetic_touch_driver.cc",
"input/synthetic_touch_driver.h",
"input/synthetic_touchpad_pinch_gesture.cc",
"input/synthetic_touchpad_pinch_gesture.h",
"input/synthetic_touchscreen_pinch_gesture.cc",
"input/synthetic_touchscreen_pinch_gesture.h",
"input/tap_suppression_controller.cc",
"input/tap_suppression_controller.h",
"input/timeout_monitor.cc",
"input/timeout_monitor.h",
"input/touch_action_filter.cc",
"input/touch_action_filter.h",
"input/touch_event_stream_validator.cc",
"input/touch_event_stream_validator.h",
"input/touch_timeout_handler.cc",
"input/touch_timeout_handler.h",
"input/touchpad_pinch_event_queue.cc",
"input/touchpad_pinch_event_queue.h",
"input/touchpad_tap_suppression_controller.cc",
"input/touchpad_tap_suppression_controller.h",
"input/touchscreen_tap_suppression_controller.cc",
"input/touchscreen_tap_suppression_controller.h",
"input/web_touch_event_traits.cc",
"input/web_touch_event_traits.h",
"media/cdm_info.cc",
"mojo_core_library_support.cc",
"mojo_core_library_support.h",
"native_web_keyboard_event_aura.cc",
"navigation_gesture.h",
"navigation_params_utils.h",
"origin_util.cc",
"process_type.cc",
"process_visibility_tracker.cc",
"process_visibility_tracker.h",
"pseudonymization_salt.cc",
"pseudonymization_salt.h",
"service_worker/forwarded_race_network_request_url_loader_factory.cc",
"service_worker/forwarded_race_network_request_url_loader_factory.h",
"service_worker/race_network_request_read_buffer_manager.cc",
"service_worker/race_network_request_read_buffer_manager.h",
"service_worker/race_network_request_url_loader_client.cc",
"service_worker/race_network_request_url_loader_client.h",
"service_worker/race_network_request_write_buffer_manager.cc",
"service_worker/race_network_request_write_buffer_manager.h",
"service_worker/service_worker_resource_loader.cc",
"service_worker/service_worker_resource_loader.h",
"service_worker/service_worker_router_evaluator.cc",
"service_worker/service_worker_router_evaluator.h",
"skia_utils.cc",
"skia_utils.h",
"thread_pool_util.cc",
"thread_pool_util.h",
"trace_utils.h",
"url_schemes.cc",
"url_schemes.h",
"user_agent.cc",
"user_level_memory_pressure_signal_features.cc",
"user_level_memory_pressure_signal_features.h",
"web_package/signed_exchange_utils.cc",
"web_package/signed_exchange_utils.h",
"webid/identity_url_loader_throttle.cc",
"webid/identity_url_loader_throttle.h",
]
configs += [
"//content:content_implementation",
"//build/config:precompiled_headers",
]
public_deps = [
":mojo_bindings",
"//cc",
"//cc/ipc",
"//content/public/common:switches",
"//gpu/command_buffer/common",
"//ipc",
"//sandbox/policy",
"//services/network:network_service",
"//services/service_manager/public/cpp",
"//third_party/blink/public:blink_headers",
"//third_party/blink/public/common",
"//ui/accessibility",
"//ui/accessibility/mojom",
"//ui/base/cursor",
"//ui/events/gestures/blink",
"//ui/events/ipc",
]
deps = [
":buildflags",
"//base",
"//base/allocator:buildflags",
"//base/third_party/dynamic_annotations",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//build/util:chromium_git_revision",
"//components/discardable_memory/common",
"//components/services/filesystem/public/mojom",
"//components/tracing:startup_tracing",
"//content:content_resources",
"//content/common/fetch:fetch_api_request_proto",
"//content/public/common:interfaces",
"//content/public/common/zygote:buildflags",
"//device/base/synchronization",
"//device/bluetooth",
"//gpu",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/client:gles2_interface",
"//gpu/command_buffer/service",
"//gpu/ipc/client",
"//gpu/ipc/common",
"//gpu/skia_bindings",
"//ipc",
"//media",
"//media:shared_memory_support",
"//media/base/ipc",
"//media/capture",
"//media/gpu:buildflags",
"//media/gpu/ipc/common",
"//media/midi",
"//media/midi:mojo",
"//mojo/public/cpp/system",
"//net",
"//ppapi/buildflags",
"//sandbox",
"//sandbox:sandbox_buildflags",
"//services/network/public/cpp",
"//services/network/public/mojom",
"//services/resource_coordinator/public/cpp/memory_instrumentation",
"//services/service_manager/public/mojom",
"//services/video_capture/public/mojom",
"//services/viz/public/mojom",
"//skia",
"//storage/common",
"//third_party/angle:angle_gpu_info_util",
"//third_party/boringssl",
"//third_party/icu",
"//third_party/re2",
"//ui/base",
"//ui/base/cursor/mojom:cursor_type",
"//ui/base/ime",
"//ui/color",
"//ui/display",
"//ui/events:gesture_detection",
"//ui/events/blink",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/geometry/mojom:mojom_traits",
"//ui/gfx/ipc",
"//ui/gfx/ipc/color",
"//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia",
"//ui/gl",
"//ui/gl/init",
"//ui/latency/ipc",
"//ui/native_theme",
"//ui/shell_dialogs",
"//url",
"//url/ipc:url_ipc",
]
defines = []
include_dirs = []
libs = []
ldflags = []
allow_circular_includes_from = [
":mojo_bindings",
"//content/public/common:interfaces",
]
if (is_posix) {
sources += [
"shared_file_util.cc",
"shared_file_util.h",
]
}
if (is_android) {
sources += [
"android/cpu_time_metrics.cc",
"android/cpu_time_metrics.h",
"android/cpu_time_metrics_internal.cc",
"android/cpu_time_metrics_internal.h",
"android/gin_java_bridge_errors.cc",
"android/gin_java_bridge_errors.h",
"android/gin_java_bridge_value.cc",
"android/gin_java_bridge_value.h",
"android/hash_set.cc",
"android/hash_set.h",
"android/surface_wrapper.cc",
"android/surface_wrapper.h",
"android/sync_compositor_statics.cc",
"android/sync_compositor_statics.h",
"cursors/webcursor_android.cc",
"font_list_android.cc",
"input/web_input_event_builders_android.cc",
"input/web_input_event_builders_android.h",
"native_web_keyboard_event_android.cc",
]
if (use_seccomp_bpf) {
deps += [ "//sandbox/policy" ]
}
}
if (is_ios) {
# TOOD: Create ios file instead of stealing android
sources += [
"cursors/webcursor_android.cc",
"input/web_input_event_builders_ios.h",
"input/web_input_event_builders_ios.mm",
"native_web_keyboard_event_ios.mm",
]
}
if (is_mac) {
sources += [
"input/web_input_event_builders_mac.h",
"input/web_input_event_builders_mac.mm",
"mac/attributed_string_type_converters.h",
"mac/attributed_string_type_converters.mm",
"mac/task_port_policy.cc",
"mac/task_port_policy.h",
"native_web_keyboard_event_mac.mm",
]
deps += [ "//sandbox/mac:seatbelt" ]
}
if (is_apple) {
sources += [ "font_list_mac.mm" ]
}
if (is_win) {
sources += [
"font_cache_dispatcher_win.cc",
"font_list_win.cc",
"sandbox_init_win.cc",
]
}
if (is_android) {
deps += [
"//content/public/android:common_aidl",
"//content/public/android:jni",
]
libs += [ "android" ]
}
if (is_debug && !is_component_build && enable_ppapi) {
# Content depends on the PPAPI message logging stuff; if this isn't here,
# some unit test binaries won't compile. This only worked in release mode
# because logging is disabled there.
deps += [ "//ppapi/proxy:ipc_sources" ]
}
if (!is_chromeos_ash) {
sources -= [ "cursors/webcursor_ash.cc" ]
}
if (use_aura) {
deps += [ "//ui/wm" ]
} else {
sources -= [
"cursors/webcursor_aura.cc",
"native_web_keyboard_event_aura.cc",
]
}
if (is_linux || is_chromeos) {
sources += [
"gpu_pre_sandbox_hook_linux.cc",
"gpu_pre_sandbox_hook_linux.h",
]
public_deps += [ "//sandbox/policy" ]
deps += [
":sandbox_support_linux",
"//media/gpu:buildflags",
"//sandbox/linux:sandbox_services",
"//sandbox/linux:seccomp_bpf",
"//sandbox/policy:chromecast_sandbox_allowlist_buildflags",
"//third_party/fontconfig",
]
if (use_v4l2_codec) {
deps += [ "//media/gpu/v4l2" ]
}
}
if (use_zygote) {
sources += [
"zygote/zygote_handle_impl_linux.h",
"zygote/zygote_handle_linux.cc",
]
}
if (is_mac || is_win || is_android || is_fuchsia || is_ios) {
sources -= [ "font_list_fontconfig.cc" ]
}
if (enable_ppapi) {
sources += [
"pepper_file_util.cc",
"pepper_file_util.h",
"pepper_plugin_list.cc",
"pepper_plugin_list.h",
"pepper_renderer_instance_data.cc",
"pepper_renderer_instance_data.h",
]
deps += [
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
}
if (is_mac) {
deps += [ "//media/gpu" ]
}
if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
sources += [
"external_ipc_dumper.cc",
"external_ipc_dumper.h",
]
}
if (is_fuchsia) {
sources += [ "font_list_fuchsia.cc" ]
deps += [ "//third_party/fuchsia-sdk/sdk/pkg/fdio" ]
}
if (use_clang_profiling_inside_sandbox) {
sources += [ "profiling_utils.cc" ]
}
}
# This is used by content/shell as well, which we don't want to depend on the
# entire content/common.
component("main_frame_counter") {
defines = [ "IS_MAIN_FRAME_COUNTER_IMPL" ]
sources = [
"main_frame_counter.cc",
"main_frame_counter.h",
]
deps = [ "//base:base" ]
}
# See comment at the top of //content/BUILD.gn for how this works.
group("for_content_tests") {
visibility = [
"//content/services/auction_worklet:tests",
"//content/test/*",
]
if (!is_component_build) {
public_deps = [ ":common" ]
}
}
mojom("mojo_bindings") {
# This interface is internal to content.
visibility = [ "//content/*" ]
disable_variants = true
sources = [
"agent_scheduling_group.mojom",
"associated_interfaces.mojom",
"child_process.mojom",
"dom_automation_controller.mojom",
"download/mhtml_file_writer.mojom",
"field_trial_recorder.mojom",
"frame.mojom",
"frame_messages.mojom",
"input/input_injector.mojom",
"media/media_log_records.mojom",
"native_types.mojom",
"navigation_client.mojom",
"render_message_filter.mojom",
"renderer.mojom",
"renderer_host.mojom",
"renderer_variations_configuration.mojom",
"synthetic_trial_configuration.mojom",
"web_ui.mojom",
]
if (is_linux || is_chromeos) {
sources += [ "thread_type_switcher.mojom" ]
}
if (is_android) {
sources += [ "gin_java_bridge.mojom" ]
}
enabled_features = []
if (enable_ipc_logging) {
enabled_features += [ "ipc_logging" ]
}
if (use_clang_profiling_inside_sandbox) {
enabled_features += [ "clang_profiling_inside_sandbox" ]
}
if (is_posix && !is_android) {
enabled_features += [ "is_non_android_posix" ]
}
if (enable_plugins) {
sources += [ "pepper_plugin.mojom" ]
}
cpp_typemaps = [
{
types = [
{
mojom = "content.mojom.ChildFrameOwnerElementType"
cpp = "::blink::FrameOwnerElementType"
},
{
mojom = "content.mojom.NavigationGesture"
cpp = "::content::NavigationGesture"
},
{
mojom = "content.mojom.NetworkConnectionType"
cpp = "::net::NetworkChangeNotifier::ConnectionType"
},
{
mojom = "content.mojom.Impression"
cpp = "::blink::Impression"
},
{
mojom = "content.mojom.ScrollGranularity"
cpp = "::ui::ScrollGranularity"
},
{
mojom = "content.mojom.SyntheticPinch"
cpp = "::content::SyntheticPinchGestureParams"
},
{
mojom = "content.mojom.SyntheticPointerAction"
cpp = "::content::SyntheticPointerActionListParams"
},
{
mojom = "content.mojom.SyntheticSmoothDrag"
cpp = "::content::SyntheticSmoothDragGestureParams"
},
{
mojom = "content.mojom.SyntheticSmoothScroll"
cpp = "::content::SyntheticSmoothScrollGestureParams"
},
{
mojom = "content.mojom.SyntheticTap"
cpp = "::content::SyntheticTapGestureParams"
},
{
mojom = "content.mojom.SystemThemeColor"
cpp = "::ui::NativeTheme::SystemThemeColor"
},
{
mojom = "content.mojom.VisualProperties"
cpp = "::blink::VisualProperties"
},
]
traits_headers = [
"//content/common/frame_owner_element_type_mojom_traits.h",
"//content/common/input/input_injector_mojom_traits.h",
"//content/common/input/synthetic_pinch_gesture_params.h",
"//content/common/input/synthetic_pointer_action_list_params.h",
"//content/common/input/synthetic_smooth_drag_gesture_params.h",
"//content/common/input/synthetic_smooth_scroll_gesture_params.h",
"//content/common/input/synthetic_tap_gesture_params.h",
"//content/common/navigation_gesture.h",
"//net/base/network_change_notifier.h",
"//third_party/blink/public/common/navigation/impression.h",
"//third_party/blink/public/common/widget/visual_properties.h",
"//ui/events/types/scroll_types.h",
"//ui/native_theme/native_theme.h",
]
traits_private_headers = [
"//content/common/content_param_traits_macros.h",
"//content/public/common/common_param_traits.h",
"//services/network/public/cpp/p2p_param_traits.h",
]
traits_sources = [
"//content/common/frame_owner_element_type_mojom_traits.cc",
"//content/common/input/input_injector_mojom_traits.cc",
]
traits_public_deps = [
# NOTE: These dependencies are here to satisfy gn check because
# common_param_traits_macros.h include their headers.
# Although the mojo bindings target is configured to allow direct circular
# includes from //content/common and //content/public/common, this isn't a
# transitive allowance, so those targets' own public_deps aren't included in
# the set of implied dependencies.
"//content/common:buildflags",
"//ppapi/buildflags",
"//ui/events/blink",
]
},
{
types = [
{
mojom = "content.mojom.PageState"
cpp = "::blink::PageState"
},
{
mojom = "content.mojom.PageTransition"
cpp = "::ui::PageTransition"
},
]
traits_headers = [
"//content/public/common/common_param_traits.h",
"//third_party/blink/public/common/page_state/page_state.h",
"//ui/base/page_transition_types.h",
]
},
]
public_deps = [
"//cc/mojom",
"//components/attribution_reporting:mojom",
"//components/metrics/public/mojom:histogram_fetcher_mojo_bindings",
"//components/variations:variations_mojom",
"//content/public/common:interfaces",
"//ipc:mojom",
"//ipc:mojom_constants",
"//media/capture/mojom:video_capture",
"//media/mojo/mojom",
"//mojo/public/mojom/base",
"//services/audio/public/mojom",
"//services/network/public/mojom",
"//services/service_manager/public/mojom",
"//services/tracing/public/mojom",
"//services/video_capture/public/mojom",
"//services/viz/public/mojom",
"//skia/public/mojom",
"//third_party/blink/public/mojom:mojom_core",
"//third_party/blink/public/mojom:mojom_modules",
"//third_party/blink/public/mojom:web_feature_mojo_bindings",
"//ui/accessibility:ax_enums_mojo",
"//ui/accessibility/mojom",
"//ui/base/ime/mojom",
"//ui/base/mojom",
"//ui/display/mojom",
"//ui/events/mojom",
"//ui/events/mojom:event_latency_metadata_mojom",
"//ui/gfx/geometry/mojom",
"//ui/gfx/image/mojom",
"//ui/gfx/mojom",
"//ui/gfx/range/mojom",
"//ui/latency/mojom",
"//url/mojom:url_mojom_gurl",
"//url/mojom:url_mojom_origin",
]
if (is_mac) {
sources += [
"render_widget_host_ns_view.mojom",
"sandbox_support_mac.mojom",
"web_contents_ns_view_bridge.mojom",
]
public_deps += [
"//ui/base/cursor/mojom",
"//ui/display/mojom",
]
cpp_typemaps += [
{
types = [
{
mojom = "content.mojom.ScrollerStyle"
cpp = "::blink::ScrollerStyle"
},
]
traits_headers =
[ "//third_party/blink/public/platform/mac/web_scrollbar_theme.h" ]
traits_public_deps = [ "//third_party/blink/public:blink_headers" ]
},
]
}
overridden_deps = [
"//third_party/blink/public/mojom:mojom_core",
"//third_party/blink/public/mojom:mojom_modules",
]
component_deps = [ "//third_party/blink/public/common" ]
component_output_prefix = "content_common_mojo_bindings"
export_class_attribute = "CONTENT_EXPORT"
export_define = "CONTENT_IMPLEMENTATION=1"
export_header = "content/common/content_export.h"
}
fuzzer_test("content_input_actions_parser_fuzzer") {
sources = [ "input/actions_parser_fuzzer.cc" ]
deps = [
"//base",
"//content/public/common",
"//third_party/abseil-cpp:absl",
]
}