# Copyright 2015 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/ui.gni")
import("//chromecast/chromecast.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")
assert(!is_fuchsia)
if (is_android) {
import("//build/config/android/rules.gni")
}
buildflag_header("browser_buildflags") {
header = "browser_buildflags.h"
flags = [ "ENABLE_CAST_AUDIO_MANAGER_MIXER=$enable_cast_audio_manager_mixer" ]
}
group("prefs") {
public_deps = [ ":prefs_base" ]
if (chromecast_branding == "public") {
public_deps += [ ":prefs_simple" ]
}
}
cast_source_set("prefs_base") {
sources = [
"pref_service_helper.cc",
"pref_service_helper.h",
]
public_deps = [ "//components/prefs" ]
deps = [
"//base",
"//chromecast:chromecast_buildflags",
"//chromecast/base",
]
if (enable_media_drm_storage) {
deps += [ "//components/cdm/browser" ]
}
}
cast_source_set("prefs_simple") {
sources = [ "pref_service_helper_simple.cc" ]
public_deps = [ ":prefs_base" ]
}
cast_source_set("feature_list") {
sources = [
"cast_feature_list_creator.cc",
"cast_feature_list_creator.h",
]
deps = [
":prefs",
"//base",
"//chromecast/base",
"//chromecast/browser/metrics",
"//components/prefs",
"//components/proxy_config",
]
}
cast_source_set("web_preferences") {
sources = [
"cast_web_preferences.cc",
"cast_web_preferences.h",
]
deps = [
"//base",
"//content/public/common",
]
}
cast_source_set("named_message_port_connector_cast") {
sources = [
"named_message_port_connector_cast.cc",
"named_message_port_connector_cast.h",
]
public_deps = [ ":client" ]
deps = [
"//base",
"//chromecast/browser:public",
"//components/cast/message_port:blink_message_port_adapter",
"//components/cast/message_port:message_port_cast",
"//components/cast/named_message_port_connector",
"//components/on_load_script_injector/browser",
]
}
cast_source_set("browser") {
sources = [
"application_media_info_manager.cc",
"application_media_info_manager.h",
"audio_socket_broker.cc",
"audio_socket_broker.h",
"bluetooth/cast_bluetooth_chooser.cc",
"bluetooth/cast_bluetooth_chooser.h",
"cast_browser_context.cc",
"cast_browser_context.h",
"cast_browser_interface_binders.cc",
"cast_browser_interface_binders.h",
"cast_browser_main_parts.cc",
"cast_browser_main_parts.h",
"cast_browser_process.cc",
"cast_browser_process.h",
"cast_content_browser_client.cc",
"cast_content_browser_client.h",
"cast_content_browser_client_receiver_bindings.cc",
"cast_content_gesture_handler.cc",
"cast_content_gesture_handler.h",
"cast_download_manager_delegate.cc",
"cast_download_manager_delegate.h",
"cast_feature_update_observer.cc",
"cast_feature_update_observer.h",
"cast_http_user_agent_settings.cc",
"cast_http_user_agent_settings.h",
"cast_media_blocker.cc",
"cast_media_blocker.h",
"cast_navigation_ui_data.cc",
"cast_navigation_ui_data.h",
"cast_network_contexts.cc",
"cast_network_contexts.h",
"cast_overlay_manifests.cc",
"cast_overlay_manifests.h",
"cast_permission_manager.cc",
"cast_permission_manager.h",
"cast_permission_user_data.cc",
"cast_permission_user_data.h",
"cast_renderer_block_data.cc",
"cast_renderer_block_data.h",
"cast_session_id_map.cc",
"cast_session_id_map.h",
"cast_system_memory_pressure_evaluator_adjuster.cc",
"cast_system_memory_pressure_evaluator_adjuster.h",
"cast_web_contents_impl.cc",
"cast_web_contents_impl.h",
"cast_web_service.cc",
"cast_web_service.h",
"cast_web_view_default.cc",
"cast_web_view_default.h",
"cast_web_view_factory.cc",
"cast_web_view_factory.h",
"default_navigation_throttle.cc",
"default_navigation_throttle.h",
"devtools/cast_devtools_manager_delegate.cc",
"devtools/cast_devtools_manager_delegate.h",
"devtools/remote_debugging_server.cc",
"devtools/remote_debugging_server.h",
"general_audience_browsing_navigation_throttle.cc",
"general_audience_browsing_navigation_throttle.h",
"general_audience_browsing_service.cc",
"general_audience_browsing_service.h",
"lru_renderer_cache.cc",
"lru_renderer_cache.h",
"media/media_caps_impl.cc",
"media/media_caps_impl.h",
"media/supported_codec_finder.cc",
"media/supported_codec_finder.h",
"metrics/metrics_helper_impl.cc",
"metrics/metrics_helper_impl.h",
"renderer_prelauncher.cc",
"renderer_prelauncher.h",
"service/cast_service_simple.cc",
"service/cast_service_simple.h",
"service_connector.cc",
"service_connector.h",
"service_manager_connection.cc",
"service_manager_connection.h",
"service_manager_context.cc",
"service_manager_context.h",
"system_connector.cc",
"system_connector.h",
"webui/cast_resource_data_source.cc",
"webui/cast_resource_data_source.h",
"webui/cast_webui.cc",
"webui/cast_webui.h",
"webui/cast_webui_controller_factory.cc",
"webui/cast_webui_controller_factory.h",
"webui/cast_webui_default.cc",
"webui/cast_webui_message_handler.cc",
"webui/cast_webui_message_handler.h",
"webui/constants.cc",
"webui/constants.h",
]
public_deps = [
":client",
":feature_list",
":prefs",
":public",
"//chromecast/browser/metrics",
"//chromecast/browser/mojom",
"//chromecast/common/mojom",
"//chromecast/metrics",
"//chromecast/mojo",
"//components/media_control/mojom",
]
deps = [
":browser_buildflags",
":named_message_port_connector_cast",
":web_preferences",
"//base",
"//base:i18n",
"//cc",
"//chromecast:chromecast_buildflags",
"//chromecast/activity",
"//chromecast/app:cast_crash_client",
"//chromecast/app:chromecast_settings",
"//chromecast/app:resources",
"//chromecast/base",
"//chromecast/base:cast_sys_info_util",
"//chromecast/base:cast_version",
"//chromecast/bindings/public/mojom",
"//chromecast/browser/bluetooth/public/mojom",
"//chromecast/browser/general_audience_browsing/mojom",
"//chromecast/browser/webui/mojom",
"//chromecast/common",
"//chromecast/common:activity_url_filter",
"//chromecast/common:cors_exempt_headers",
"//chromecast/common:queryable_data",
"//chromecast/common/media",
"//chromecast/external_mojo/broker_service",
"//chromecast/external_mojo/external_service_support:external_service",
"//chromecast/external_mojo/external_service_support:util",
"//chromecast/external_mojo/public/cpp:common",
"//chromecast/graphics",
"//chromecast/media",
"//chromecast/media:libcast_media",
"//chromecast/media/audio",
"//chromecast/media/audio:audio_io_thread",
"//chromecast/media/audio/audio_output_service:constants",
"//chromecast/media/base:media_codec_support",
"//chromecast/media/base:video_plane_controller",
"//chromecast/media/cdm:cdm_origin_provider",
"//chromecast/media/common:media_pipeline_backend_manager",
"//chromecast/media/service",
"//chromecast/media/service/mojom",
"//chromecast/net",
"//chromecast/net:connectivity_checker",
"//chromecast/net:socket_util",
"//chromecast/service",
"//chromecast/ui:display_settings_manager",
"//chromecast/ui:display_settings_public",
"//components/cast/message_port:blink_message_port_adapter",
"//components/cast/message_port:message_port_cast",
"//components/cast_receiver/browser:permissions_manager",
"//components/download/public/common:public",
"//components/heap_profiling/multi_process",
"//components/media_control/browser",
"//components/memory_pressure",
"//components/metrics",
"//components/metrics:content",
"//components/metrics:net",
"//components/on_load_script_injector/browser",
"//components/profile_metrics",
"//components/variations/net",
# TODO(gfhuang): Eliminate this dependency if ScreenInfoMetricsProvider
# isn't needed. crbug.com/541577
"//components/metrics:ui",
"//components/network_hints/browser",
"//components/network_session_configurator/common",
"//components/policy/core/browser",
"//components/prefs",
"//components/proxy_config",
"//components/safe_search_api",
"//components/safe_search_api:safe_search_client",
"//components/services/heap_profiling",
"//components/services/heap_profiling/public/cpp",
"//components/services/heap_profiling/public/mojom",
"//components/url_matcher",
"//components/url_rewrite/browser",
"//components/url_rewrite/common",
"//components/url_rewrite/mojom",
"//components/viz/service",
"//content/public/browser",
"//content/public/common",
"//device/bluetooth",
"//gpu",
"//ipc",
"//media",
"//media/gpu:buildflags",
"//media/mojo:buildflags",
"//media/mojo/mojom",
"//media/mojo/mojom:remoting",
"//media/mojo/services",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/platform",
"//net",
"//services/cert_verifier/public/mojom",
"//services/media_session/public/mojom",
"//services/metrics/public/cpp:metrics_cpp",
"//services/network/public/mojom",
"//services/service_manager",
"//services/service_manager/public/cpp",
"//third_party/blink/public/common",
"//ui/base",
"//ui/compositor",
"//ui/display",
"//ui/events",
"//ui/events/devices",
"//ui/gl",
]
if (enable_media_drm_storage) {
deps += [ "//components/cdm/browser" ]
}
if (is_android) {
sources += [
"android/cast_content_window_android.cc",
"android/cast_content_window_android.h",
"android/cast_metrics_helper_android.cc",
"android/cast_web_service_android.cc",
]
deps += [
"//chromecast/browser/android:jni_headers",
"//components/embedder_support/android:view",
]
} else {
deps += [ ":display_configurator" ]
}
if (is_linux || is_chromeos) {
sources += [
"cast_system_memory_pressure_evaluator.cc",
"cast_system_memory_pressure_evaluator.h",
"memory_pressure_controller_impl.cc",
"memory_pressure_controller_impl.h",
]
deps += [ "//third_party/fontconfig" ]
}
if (use_aura) {
sources += [
"cast_content_window_aura.cc",
"cast_content_window_aura.h",
"cast_web_service_aura.cc",
"display_configurator_observer.cc",
"display_configurator_observer.h",
]
deps += [
"//ui/aura",
"//ui/views:views",
]
if (!is_fuchsia) {
sources += [
"devtools/cast_ui_devtools.cc",
"devtools/cast_ui_devtools.h",
]
deps += [
"//components/ui_devtools",
"//components/ui_devtools/views",
]
}
}
if (!is_fuchsia) {
# TODO(crbug.com/40188745): Complete crash reporting integration on Fuchsia.
deps += [
"//components/crash/content/browser",
"//components/crash/core/app",
]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
if (enable_external_mojo_services) {
deps += [ "//chromecast/external_mojo/broker_service" ]
}
configs += [ "//media/audio:platform_config" ]
if (chromecast_branding != "public") {
deps += [
"//chromecast/internal/shell/browser:cast_content_browser_internal_manifest_overlay",
"//chromecast/internal/shell/browser:cast_content_packaged_services_internal_manifest_overlay",
]
defines = [ "USE_INTERNAL_OVERLAY_MANIFESTS=1" ]
}
}
cast_source_set("display_configurator") {
sources = [
"cast_display_configurator.cc",
"cast_display_configurator.h",
"cast_touch_device_manager.cc",
"cast_touch_device_manager.h",
]
deps = [
"//base",
"//chromecast:chromecast_buildflags",
"//chromecast/base",
"//chromecast/graphics",
"//chromecast/public",
"//ui/display",
"//ui/events/devices",
"//ui/gfx/geometry",
]
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
public_configs = [ "//skia:skia_config" ]
}
cast_source_set("simple_main_parts") {
sources = [ "cast_browser_main_parts_simple.cc" ]
public_deps = [ ":browser" ]
}
cast_source_set("simple_client") {
sources = [ "cast_content_browser_client_simple.cc" ]
public_deps = [ ":browser" ]
deps = [
"//base",
"//chromecast/common:cors_exempt_headers",
]
}
cast_source_set("base_types") {
public = [
"visibility_types.h",
"web_types.h",
]
sources = [ "web_types.cc" ]
}
# Lightweight target for Cast interfaces that wrap //content/public/browser.
# This target should only include interfaces which are required for unit tests.
cast_source_set("public") {
sources = [
"cast_content_window.cc",
"cast_content_window.h",
"cast_web_contents.cc",
"cast_web_contents.h",
"cast_web_view.cc",
"cast_web_view.h",
"gesture_router.cc",
"gesture_router.h",
]
# Need to expose this so that internal public_configs are propagated.
public_deps = [
":base_types",
":client",
"//chromecast/browser/mojom",
"//chromecast/common/mojom",
"//chromecast/mojo",
"//content/public/browser",
]
deps = [
"//base",
"//chromecast/bindings/public/mojom",
"//chromecast/graphics",
"//chromecast/ui:back_gesture_router",
"//chromecast/ui/mojom",
"//content/public/browser",
"//content/public/common",
"//mojo/public/cpp/bindings",
"//ui/events",
"//url",
]
}
cast_source_set("client") {
public = [
"application_media_capabilities.h",
"cast_web_contents_observer.h",
]
sources = [
"application_media_capabilities.cc",
"cast_web_contents_observer.cc",
]
public_deps = [
":base_types",
"//base",
"//chromecast/browser/mojom",
"//chromecast/common/mojom",
"//mojo/public/cpp/bindings",
"//ui/gfx/geometry",
"//url",
]
deps = [ "//chromecast/base" ]
}
cast_source_set("test_support") {
testonly = true
sources = [
"test/cast_browser_test.cc",
"test/cast_browser_test.h",
"test/mock_cast_web_view.cc",
"test/mock_cast_web_view.h",
]
public_deps = [
":browser",
"//content/test:test_support",
"//mojo/public/cpp/bindings",
]
deps = [
"//base",
"//chromecast/base",
"//components/prefs:test_support",
"//content/public/browser",
"//content/public/common",
"//testing/gmock",
"//testing/gtest",
]
}
mojom("test_interfaces") {
testonly = true
sources = [ "test_interfaces.test-mojom" ]
}
cast_source_set("browsertests") {
testonly = true
sources = [
"cast_content_gesture_handler_test.cc",
"cast_media_blocker_browsertest.cc",
"cast_web_contents_browsertest.cc",
"renderer_prelauncher_test.cc",
"test/cast_features_browsertest.cc",
"test/cast_navigation_browsertest.cc",
]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
deps = [
":client",
":test_interfaces",
":test_support",
"//base",
"//chromecast:chromecast_buildflags",
"//chromecast/base",
"//chromecast/base:chromecast_switches",
"//chromecast/base/metrics",
"//chromecast/graphics:graphics",
"//chromecast/mojo",
"//components/keyed_service/content",
"//components/prefs",
"//content/public/browser",
"//content/test:test_support",
"//media:test_support",
"//net:test_support",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
]
if (use_aura) {
deps += [ "//ui/aura" ]
}
data = [
"//chromecast/browser/test/data/",
"//media/test/data/",
]
}
cast_source_set("unittests") {
testonly = true
sources = [
"application_media_info_manager_unittest.cc",
"audio_socket_broker_unittest.cc",
"bluetooth/cast_bluetooth_chooser_unittest.cc",
"cast_media_blocker_unittest.cc",
"cast_resource_bundle_unittest.cc",
"cast_session_id_map_unittest.cc",
"devtools/cast_devtools_manager_delegate_unittest.cc",
"lru_renderer_cache_test.cc",
"migration/migration_utils_test.cc",
]
deps = [
":browser",
":display_configurator",
":test_support",
"//base",
"//base/test:test_support",
"//chromecast/base",
"//chromecast/bindings/public/mojom",
"//chromecast/browser/migration",
"//chromecast/net:socket_util",
"//components/on_load_script_injector/browser",
"//content/public/browser",
"//content/test:test_support",
"//net:test_support",
"//services/network:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/blink/public/common",
"//ui/base",
"//ui/base:test_support",
"//ui/events/devices:devices",
"//ui/gl:test_support",
]
if (!is_android) {
sources += [ "cast_touch_device_manager_unittest.cc" ]
}
}
if (is_android) {
java_cpp_enum("java_enums") {
sources = [ "visibility_types.h" ]
}
}
# Could be used in the internal build if the internal implementation won't be
# included, for example, some unit tests.
cast_source_set("simple_browser") {
sources = [
"cast_browser_main_parts_simple.cc",
"cast_content_browser_client_simple.cc",
"pref_service_helper_simple.cc",
]
deps = [
":browser",
":prefs",
"//chromecast/base:default_create_sys_info",
"//chromecast/common:cors_exempt_headers",
]
}