chromium/chromecast/cast_core/runtime/browser/BUILD.gn

# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//chromecast/chromecast.gni")

cast_source_set("metrics_recorder") {
  sources = [
    "cast_runtime_action_recorder.cc",
    "cast_runtime_action_recorder.h",
    "cast_runtime_histogram_flattener.cc",
    "cast_runtime_histogram_flattener.h",
    "cast_runtime_metrics_recorder.cc",
    "cast_runtime_metrics_recorder.h",
    "cast_runtime_metrics_recorder_service.cc",
    "cast_runtime_metrics_recorder_service.h",
  ]

  public_deps = [
    "//base",
    "//chromecast/metrics:metrics_recorder",
    "//third_party/cast_core/public/src/proto/metrics:metrics_recorder_proto",
    "//third_party/grpc:grpc++",
  ]

  deps = [
    "//chromecast/base/metrics",
    "//third_party/abseil-cpp:absl",
    "//third_party/metrics_proto",
  ]
}

cast_source_set("grpc_webui") {
  sources = [
    "grpc_resource_data_source.cc",
    "grpc_resource_data_source.h",
    "grpc_webui_controller.cc",
    "grpc_webui_controller.h",
    "grpc_webui_controller_factory.cc",
    "grpc_webui_controller_factory.h",
  ]

  deps = [
    "//base",
    "//chromecast:chromecast_buildflags",
    "//chromecast/base",
    "//chromecast/base:chromecast_switches",
    "//chromecast/base:default_create_sys_info",
    "//chromecast/browser",
    "//net",
    "//third_party/blink/public/common:headers",
    "//third_party/grpc:grpc++",
  ]

  public_deps = [
    "//chromecast/browser:public",
    "//third_party/abseil-cpp:absl",
    "//third_party/cast_core/public/src/proto/v2:core_application_service_proto_castcore",
  ]
}

cast_source_set("runtime_service_impl") {
  public = [ "runtime_service_impl.h" ]
  sources = [
    "core_conversions.cc",
    "core_conversions.h",
    "core_streaming_config_manager.cc",
    "core_streaming_config_manager.h",
    "message_port_handler.cc",
    "message_port_handler.h",
    "message_port_service_grpc.cc",
    "message_port_service_grpc.h",
    "runtime_application_service_impl.cc",
    "runtime_application_service_impl.h",
    "runtime_service_impl.cc",
  ]

  public_deps = [ "//third_party/cast_core/public/src/proto/runtime:runtime_service_proto_castcore" ]

  deps = [
    ":grpc_webui",
    ":metrics_recorder",
    "//base",
    "//chromecast:chromecast_buildflags",
    "//chromecast/base:cast_version",
    "//chromecast/browser",
    "//chromecast/cast_core:cast_core_switches",
    "//chromecast/cast_core/runtime/browser/url_rewrite",
    "//chromecast/common:feature_constants",
    "//chromecast/metrics:cast_event_builder_simple",
    "//chromecast/shared:platform_info_serializer",
    "//components/cast/message_port",
    "//components/cast_receiver/browser",
    "//components/cast_receiver/common",
    "//components/cast_streaming/browser",
    "//components/media_control/browser",
    "//components/url_rewrite/browser",
    "//content/public/browser",
    "//mojo/public/cpp/bindings",
    "//third_party/abseil-cpp:absl",
    "//third_party/blink/public/common:headers",
    "//third_party/cast_core/public/src/proto/common:application_state_proto",
    "//third_party/cast_core/public/src/proto/common:value_proto",
    "//third_party/cast_core/public/src/proto/core:cast_core_service_proto_castcore",
    "//third_party/cast_core/public/src/proto/metrics:metrics_recorder_proto_castcore",
    "//third_party/cast_core/public/src/proto/v2:core_application_service_proto_castcore",
    "//third_party/cast_core/public/src/proto/v2:core_message_port_application_service_proto_castcore",
    "//third_party/cast_core/public/src/proto/v2:runtime_application_service_proto_castcore",
    "//third_party/cast_core/public/src/proto/v2:runtime_message_port_application_service_proto_castcore",
    "//third_party/cast_core/public/src/proto/web:message_channel_proto",
    "//third_party/grpc:grpc++",
    "//third_party/openscreen/src/cast/common:public",
    "//url",
  ]
  friend = [ ":unit_tests" ]
}

cast_source_set("browser") {
  sources = [
    "cast_core_switches.h",
    "cast_runtime_content_browser_client.cc",
    "cast_runtime_content_browser_client.h",
  ]

  deps = [
    ":runtime_service_impl",
    "//base",
    "//chromecast/cast_core:cast_core_switches",
    "//chromecast/common:cors_exempt_headers",
    "//chromecast/media/base:video_plane_controller",
    "//chromecast/metrics:cast_event_builder_simple",
    "//components/url_rewrite/browser",
    "//components/url_rewrite/common",
    "//content/public/browser",
    "//content/public/common",
    "//media",
  ]

  public_deps = [
    "//chromecast/browser",
    "//components/cast_receiver/browser",
  ]
}

cast_source_set("browser_simple") {
  sources = [ "cast_runtime_content_browser_client_simple.cc" ]

  deps = [
    ":browser",
    "//chromecast/common:cors_exempt_headers",
  ]
}

cast_source_set("browser_starboard") {
  sources = [
    "cast_runtime_content_browser_client_starboard.cc",
    "cast_runtime_content_browser_client_starboard.h",
    "cast_runtime_content_browser_client_starboard_factory.cc",
  ]
  deps = [
    ":browser",
    "//base",
    "//chromecast/common:cors_exempt_headers",
    "//chromecast/media/cdm",
    "//chromecast/media/cdm:cdm_origin_provider",
    "//chromecast/media/common:media_resource_tracker",
    "//chromecast/service",
    "//chromecast/starboard/media/cdm:starboard_decryptor_cast",
    "//media",
    "//media/mojo/mojom",
    "//media/mojo/services",
  ]
}

# TODO(b/194439829): Upstream additional metrics unit tests.
cast_source_set("unit_tests") {
  testonly = true

  sources = [
    "cast_runtime_histogram_flattener_unittest.cc",
    "cast_runtime_metrics_test_helpers.cc",
    "cast_runtime_metrics_test_helpers.h",
    "core_streaming_config_manager_unittest.cc",
    "grpc_resource_data_source_unittest.cc",
  ]

  deps = [
    ":grpc_webui",
    ":metrics_recorder",
    ":runtime_service_impl",
    "//base",
    "//base/test:test_support",
    "//chromecast/browser:test_support",
    "//chromecast/shared:platform_info_serializer",
    "//components/cast_receiver/browser",
    "//components/cast_receiver/common",
    "//components/cast_streaming/browser",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/cast_core/public/src/proto/metrics:metrics_recorder_proto",
    "//third_party/grpc:grpc++",
    "//third_party/metrics_proto",
  ]
}