chromium/chrome/browser/chromeos/BUILD.gn

# 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/config/chromeos/ui_mode.gni")
import("//build/config/ozone.gni")
import("//extensions/buildflags/buildflags.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//third_party/protobuf/proto_library.gni")

assert(enable_extensions)
assert(is_chromeos)
assert(use_ozone)

source_set("chromeos") {
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
  sources = [
    "extensions/accessibility_service_private.cc",
    "extensions/accessibility_service_private.h",
    "extensions/device_local_account_external_policy_loader.cc",
    "extensions/device_local_account_external_policy_loader.h",
    "extensions/info_private_api.cc",
    "extensions/info_private_api.h",
    "extensions/login_screen/login/login_api.cc",
    "extensions/login_screen/login/login_api.h",
    "extensions/login_screen/login/login_api_prefs.cc",
    "extensions/login_screen/login/login_api_prefs.h",
    "extensions/login_screen/login_screen_storage/login_screen_storage_api.cc",
    "extensions/login_screen/login_screen_storage/login_screen_storage_api.h",

    # Extension API implementations.
    "extensions/login_screen/login/errors.cc",
    "extensions/login_screen/login/errors.h",
    "extensions/wallpaper_api.cc",
    "extensions/wallpaper_api.h",
  ]

  allow_circular_includes_from = [
    "//chrome/browser/apps/app_service",
    "//chrome/browser/chromeos/enterprise/cloud_storage",
    "//chrome/browser/chromeos/policy/dlp/dialogs",
    "//chrome/browser/chromeos/reporting/websites",
    "//chrome/browser/extensions",
    "//chrome/browser/media/webrtc",
  ]

  public_deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//chrome/browser:browser_public_dependencies",
    "//chrome/browser/extensions",
    "//chrome/browser/image_decoder",
    "//chrome/browser/profiles",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/web_applications",
    "//chrome/common/chromeos/extensions/api",
    "//chrome/common/extensions/api",
    "//chromeos/components/mahi/public/cpp:cpp",
    "//chromeos/crosapi/cpp",
    "//chromeos/crosapi/mojom",
    "//chromeos/dbus/dlp:dlp_proto",
    "//chromeos/dbus/power",
    "//components/account_id",
    "//components/arc/common",
    "//components/enterprise/data_controls/core/browser:dlp_policy_event_proto",
    "//components/file_access",
    "//components/keyed_service/content",
    "//components/keyed_service/core",
    "//components/prefs",
    "//components/proxy_config",
    "//components/renderer_context_menu",
    "//components/reporting/client:report_queue",
    "//components/reporting/client:report_queue_configuration",
    "//components/reporting/metrics:metrics_data_collection",
    "//components/reporting/util:status",
    "//components/sessions",
    "//components/url_matcher",
    "//content/public/browser",
    "//extensions/browser",
    "//extensions/common",
    "//mojo/public/cpp/bindings",
    "//net",
    "//ppapi/buildflags",
    "//services/network/public/cpp",
    "//storage/browser",
    "//third_party/abseil-cpp:absl",
    "//ui/base",
    "//ui/base/clipboard",
    "//ui/base/data_transfer_policy",
    "//ui/base/metadata",
    "//ui/display",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/views",
    "//url",
  ]

  deps = [
    ":system_stack_sampled_metrics_status_proto",
    "//chrome/app:command_ids",
    "//chrome/app:generated_resources",
    "//chrome/app/vector_icons",
    "//chrome/browser:browser_process",
    "//chrome/browser:resources",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/apps/app_service/app_icon",
    "//chrome/browser/apps/link_capturing",
    "//chrome/browser/browsing_data:constants",
    "//chrome/browser/chromeos/arc",
    "//chrome/browser/chromeos/echo",
    "//chrome/browser/chromeos/enterprise",
    "//chrome/browser/chromeos/enterprise/cloud_storage",
    "//chrome/browser/chromeos/extensions/login_screen/login/cleanup",
    "//chrome/browser/chromeos/full_restore",
    "//chrome/browser/chromeos/policy/dlp/dialogs",
    "//chrome/browser/chromeos/reporting/websites",
    "//chrome/browser/chromeos/smart_reader",
    "//chrome/browser/chromeos/tablet_mode",
    "//chrome/browser/chromeos/tast_support",
    "//chrome/browser/enterprise/data_controls",
    "//chrome/browser/favicon",
    "//chrome/browser/media/webrtc",
    "//chrome/browser/resources:component_extension_resources",
    "//chrome/browser/screen_ai:screen_ai_service_router_factory",
    "//chrome/browser/ui:browser_navigator_params_headers",
    "//chrome/common",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/common:non_code_constants",
    "//chromeos/components/kcer",
    "//chromeos/components/mahi/public/cpp",
    "//chromeos/components/mahi/public/mojom",
    "//chromeos/components/mgs",
    "//chromeos/constants",
    "//chromeos/dbus/dlp",
    "//chromeos/ui/base",
    "//components/app_constants",
    "//components/arc/common:arc_intent_helper_constants",
    "//components/device_event_log",
    "//components/download/content/public:public",
    "//components/enterprise/data_controls/core/browser",
    "//components/pdf/browser",
    "//components/pdf/common:constants",
    "//components/policy:generated",
    "//components/policy/core/common",
    "//components/policy/core/common:common_constants",
    "//components/policy/core/common:policy_namespace",
    "//components/pref_registry",
    "//components/printing/browser",
    "//components/printing/common:mojo_interfaces",
    "//components/reporting/client:report_queue_factory",
    "//components/reporting/proto:metric_data_proto",
    "//components/reporting/util:rate_limiter_interface",
    "//components/reporting/util:rate_limiter_slide_window",
    "//components/services/app_service",
    "//components/sharing_message",
    "//components/strings:components_strings",
    "//components/sync/protocol",
    "//components/sync_device_info",
    "//components/ukm",
    "//components/vector_icons",
    "//components/webapps/common",
    "//content/public/common",
    "//crypto",
    "//extensions/browser/updater",
    "//extensions/common:common_constants",
    "//extensions/common:mojom",
    "//net",
    "//pdf:features",
    "//services/data_decoder/public/cpp",
    "//services/network/public/cpp:cpp_base",
    "//services/network/public/mojom",
    "//services/network/public/mojom:url_loader_base",
    "//skia",
    "//third_party/blink/public/common:headers",
    "//third_party/blink/public/mojom/service_worker:storage",
    "//third_party/boringssl",
    "//ui/base",
    "//ui/base:types",
    "//ui/base/ime",
    "//ui/chromeos/strings",
    "//ui/chromeos/styles:cros_styles_views",
    "//ui/chromeos/styles:cros_tokens_color_mappings",
    "//ui/color:color_headers",
    "//ui/compositor",
    "//ui/events:event_constants",
    "//ui/gfx/codec",
    "//ui/message_center/public/cpp",
    "//ui/native_theme",
  ]

  if (is_chromeos_ash) {
    sources += [
      "extensions/login_screen/login/external_logout_done/external_logout_done_event_handler.cc",
      "extensions/login_screen/login/external_logout_done/external_logout_done_event_handler.h",
      "extensions/login_screen/login/external_logout_done/external_logout_done_event_handler_factory.cc",
      "extensions/login_screen/login/external_logout_done/external_logout_done_event_handler_factory.h",
      "extensions/login_screen/login/login_api_lock_handler.cc",
      "extensions/login_screen/login/login_api_lock_handler.h",
      "extensions/login_screen/login/shared_session_handler.cc",
      "extensions/login_screen/login/shared_session_handler.h",
    ]
    allow_circular_includes_from += [
      "//chrome/browser/ash/app_restore",
      "//chrome/browser/ash/arc",
      "//chrome/browser/ash/arc/enterprise/cert_store",
      "//chrome/browser/ash/extensions/file_manager",
      "//chrome/browser/ash/arc/fileapi",
      "//chrome/browser/ash/arc/intent_helper",
      "//chrome/browser/ash/arc/policy",
      "//chrome/browser/ash/attestation",
      "//chrome/browser/ash/cert_provisioning",
      "//chrome/browser/ash/file_manager",
      "//chrome/browser/ash/file_manager/virtual_tasks",
      "//chrome/browser/ash/file_system_provider",
      "//chrome/browser/ash/platform_keys",
      "//chrome/browser/ash/platform_keys/key_permissions",
      "//chrome/browser/ash/policy/core",
      "//chrome/browser/ash/policy/dlp",
      "//chrome/browser/ash/policy/dlp/dialogs",
      "//chrome/browser/ash/policy/reporting/metrics_reporting",
      "//chrome/browser/ash/policy/reporting/metrics_reporting/apps",
      "//chrome/browser/ash/policy/skyvault",
      "//chrome/browser/ash/printing",
      "//chrome/browser/ash/printing/history",
      "//chrome/browser/ash/printing/print_management",
      "//chrome/browser/ash/system_web_apps/apps",
      "//chrome/browser/ash/system_web_apps/apps/help_app",
      "//chrome/browser/ash/video_conference",
      "//chrome/browser/ash/app_mode",
      "//chrome/browser/ash/app_mode/web_app",
      "//chrome/browser/chromeos/tablet_mode",
      "//chrome/browser/ui/ash/network",
      "//chrome/browser/ui/webui/ash/cloud_upload",
      "//chrome/browser/ui/webui/ash/settings/pages/files",
    ]
    public_deps += [
      "//ash/constants",
      "//components/services/app_service/public/cpp:instance_update",
    ]
    deps += [
      "//ash",
      "//ash/components/arc:arc_metrics_constants",
      "//ash/public/cpp",
      "//ash/webui/file_manager:constants",
      "//ash/webui/file_manager:file_manager_ui",
      "//ash/webui/file_manager:file_manager_untrusted_ui",
      "//chrome/browser/ash/accessibility",
      "//chrome/browser/ash/app_mode",
      "//chrome/browser/ash/app_mode/web_app",
      "//chrome/browser/ash/app_restore",
      "//chrome/browser/ash/arc",
      "//chrome/browser/ash/arc/enterprise/cert_store",
      "//chrome/browser/ash/arc/fileapi",
      "//chrome/browser/ash/arc/intent_helper",
      "//chrome/browser/ash/arc/policy",
      "//chrome/browser/ash/attestation",
      "//chrome/browser/ash/cert_provisioning",
      "//chrome/browser/ash/extensions/file_manager",
      "//chrome/browser/ash/file_manager",
      "//chrome/browser/ash/file_manager/virtual_tasks",
      "//chrome/browser/ash/file_system_provider",
      "//chrome/browser/ash/guest_os",
      "//chrome/browser/ash/login",
      "//chrome/browser/ash/login/lock",
      "//chrome/browser/ash/mahi:mahi",
      "//chrome/browser/ash/platform_keys",
      "//chrome/browser/ash/platform_keys/key_permissions",
      "//chrome/browser/ash/policy/core",
      "//chrome/browser/ash/policy/dlp",
      "//chrome/browser/ash/policy/dlp/dialogs",
      "//chrome/browser/ash/policy/reporting/metrics_reporting",
      "//chrome/browser/ash/policy/reporting/metrics_reporting/apps",
      "//chrome/browser/ash/policy/skyvault",
      "//chrome/browser/ash/printing",
      "//chrome/browser/ash/printing/history",
      "//chrome/browser/ash/printing/print_management",
      "//chrome/browser/ash/printing/print_preview",
      "//chrome/browser/ash/profiles",
      "//chrome/browser/ash/system_web_apps/apps",
      "//chrome/browser/ash/system_web_apps/apps/help_app",
      "//chrome/browser/ash/video_conference",
      "//chrome/browser/ui/ash/network",
      "//chrome/browser/ui/ash/session",
      "//chrome/browser/ui/ash/shelf",
      "//chrome/browser/ui/ash/system_web_apps",
      "//chrome/browser/ui/webui/ash/cloud_upload",
      "//chrome/browser/ui/webui/ash/settings/pages/files",
      "//chromeos/ash/components/browser_context_helper",
      "//chromeos/ash/components/chaps_util",
      "//chromeos/ash/components/login/auth/public:authpublic",
      "//chromeos/ash/components/login/session",
      "//chromeos/ash/components/network",
      "//chromeos/ash/components/settings",
      "//components/session_manager:base",
      "//components/session_manager/core",
      "//components/user_manager",
      "//ui/aura",
    ]
  }

  if (is_chromeos_lacros) {
    deps += [
      "//chromeos/lacros",
      "//chromeos/startup",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "../ui/views/frame/immersive_mode_controller_chromeos_unittest.cc",

    # TODO(zturner): Enable this on Windows. See
    # BrowserWithTestWindowTest::SetUp() for a comment explaining why this is
    # broken.
    "../../common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc",
    "../../common/extensions/api/file_system_provider/file_system_provider_handler_unittest.cc",
  ]

  deps = [
    ":chromeos",
    ":system_stack_sampled_metrics_status_proto",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//chrome/app:command_ids",
    "//chrome/app:generated_resources",
    "//chrome/browser",
    "//chrome/browser:browser_process",
    "//chrome/browser/apps/app_service:test_support",
    "//chrome/browser/chromeos/extensions/login_screen/login/cleanup",
    "//chrome/browser/chromeos/extensions/login_screen/login/cleanup:test_support",
    "//chrome/browser/chromeos/extensions/login_screen/login/external_logout_request",
    "//chrome/browser/enterprise/data_controls",
    "//chrome/browser/enterprise/data_controls:test_support",
    "//chrome/browser/extensions",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui",
    "//chrome/browser/ui:ui_features",
    "//chrome/browser/ui/chromeos",
    "//chrome/browser/ui/chromeos:test_support",
    "//chrome/common",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/common:non_code_constants",
    "//chrome/common/extensions/api",
    "//chrome/test:test_support",
    "//chromeos/components/kcer",
    "//chromeos/crosapi/mojom",
    "//chromeos/dbus/dlp",
    "//chromeos/ui/frame:test_support",
    "//components/account_id",
    "//components/arc/common",
    "//components/arc/common:arc_intent_helper_constants",
    "//components/arc/common:arc_test_support",
    "//components/enterprise/data_controls/core/browser",
    "//components/enterprise/data_controls/core/browser:dlp_policy_event_proto",
    "//components/file_access",
    "//components/keyed_service/core",
    "//components/policy/core/common:common_constants",
    "//components/prefs",
    "//components/renderer_context_menu",
    "//components/reporting/client:test_support",
    "//components/reporting/metrics/fakes:test_support",
    "//components/reporting/proto:metric_data_proto",
    "//components/reporting/storage:test_support",
    "//components/reporting/util:status",
    "//components/reporting/util:test_callbacks_support",
    "//components/sharing_message/proto",
    "//components/strings:components_strings",
    "//components/ukm",
    "//components/user_manager",
    "//content/public/browser",
    "//content/test:test_support",
    "//extensions:test_support",
    "//extensions/browser",
    "//extensions/browser:test_support",
    "//extensions/common",
    "//extensions/common:common_constants",
    "//storage/browser",
    "//storage/browser:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/abseil-cpp:absl",
    "//ui/base",
    "//ui/base/data_transfer_policy",
    "//ui/gfx",
    "//ui/views",
    "//url",

    # Unit tests from subdirectories.
    "//chrome/browser/chromeos/app_mode:unit_tests",
    "//chrome/browser/chromeos/arc:unit_tests",
    "//chrome/browser/chromeos/container_app:unit_tests",
    "//chrome/browser/chromeos/drivefs:unit_tests",
    "//chrome/browser/chromeos/extensions/contact_center_insights:unit_tests",
    "//chrome/browser/chromeos/extensions/desk_api:unit_tests",
    "//chrome/browser/chromeos/extensions/file_system_provider:unit_tests",
    "//chrome/browser/chromeos/extensions/login_screen/login/external_logout_request:unit_tests",
    "//chrome/browser/chromeos/extensions/login_screen/login_state:unit_tests",
    "//chrome/browser/chromeos/extensions/odfs_config_private:unit_tests",
    "//chrome/browser/chromeos/extensions/telemetry:unit_tests",
    "//chrome/browser/chromeos/launcher_search:unit_tests",
    "//chrome/browser/chromeos/mahi:unit_tests",
    "//chrome/browser/chromeos/office_web_app:unit_tests",
    "//chrome/browser/chromeos/policy/dlp:unit_tests",
    "//chrome/browser/chromeos/printing/print_preview:unit_tests",
    "//chrome/browser/chromeos/reporting:unit_tests",
    "//chrome/browser/chromeos/reporting/network:unit_tests",
    "//chrome/browser/chromeos/reporting/websites:unit_tests",
    "//chrome/browser/chromeos/tast_support:unit_tests",
    "//chrome/browser/chromeos/video_conference:unit_tests",

    # Unit tests from elsewhere.
    "//components/sharing_message:unit_tests",
  ]

  if (is_chromeos_ash) {
    sources += [
      "extensions/login_screen/login/external_logout_done/external_logout_done_event_handler_unittest.cc",
      "extensions/login_screen/login/login_api_ash_unittest.cc",
      "extensions/login_screen/login_screen_storage/login_screen_storage_api_ash_unittest.cc",
    ]

    deps += [
      "//ash:test_support",
      "//ash/constants",
      "//chrome/browser/ash/crosapi",
      "//chrome/browser/ash/crosapi:test_support",
      "//chrome/browser/ash/login/ui:test_support",
      "//chrome/browser/ash/login/users:test_support",
      "//chrome/browser/ash/printing:test_support",
      "//chrome/browser/ash/printing/history",
      "//chrome/browser/ash/printing/history:test_support",
      "//chrome/browser/ash/printing/print_management",
      "//chrome/browser/ash/system_web_apps/test_support:test_support",
      "//chrome/browser/extensions:test_support",
      "//chrome/browser/ui/ash/system_web_apps:system_web_apps",
      "//chrome/browser/web_applications:web_applications_test_support",
      "//chromeos/ash/components/dbus/session_manager",
      "//chromeos/ash/components/login/auth/public:authpublic",
      "//chromeos/ash/components/login/login_state",
      "//chromeos/ash/components/network/portal_detector",
      "//chromeos/ash/components/settings",
      "//chromeos/dbus/power",
      "//components/history/core/test",
      "//components/prefs:test_support",
      "//components/services/app_service",
      "//components/session_manager:base",
      "//components/session_manager/core",
      "//components/sync_preferences:test_support",
      "//components/user_manager",
      "//content/public/common",
      "//extensions/common/api",
      "//mojo/public/cpp/bindings",
      "//ui/gfx/geometry",

      # Unit tests from subdirectories.
      "//chrome/browser/chromeos/extensions/login_screen/login/cleanup:unit_tests",
      "//chrome/browser/chromeos/tablet_mode:unit_tests",
    ]

    if (use_cups) {
      sources +=
          [ "extensions/printing_metrics/printing_metrics_api_unittest.cc" ]
      deps += [
        "//chrome/browser/ash/printing/history:print_job_info_proto",
        "//chrome/browser/chromeos/extensions/printing_metrics",
        "//chrome/common/extensions/api",
      ]
    }
  }
}

group("browser_tests") {
  testonly = true

  deps = [ "//chrome/browser/chromeos/extensions/system_log:browser_tests" ]

  if (is_chromeos_ash) {
    deps += [
      "//chrome/browser/chromeos/extensions/action_handlers:browser_tests",
      "//chrome/browser/chromeos/extensions/contact_center_insights:browser_tests",
      "//chrome/browser/chromeos/extensions/echo_private:browser_tests",
      "//chrome/browser/chromeos/extensions/file_system_provider:browser_tests",
      "//chrome/browser/chromeos/extensions/login_screen/login/cleanup:browser_tests",
      "//chrome/browser/chromeos/extensions/odfs_config_private:browser_tests",
      "//chrome/browser/chromeos/mahi:browser_tests",
      "//chrome/browser/chromeos/network:browser_tests",
      "//chrome/browser/chromeos/policy:browser_tests",
      "//chrome/browser/chromeos/policy/dlp:browser_tests",
      "//chrome/browser/chromeos/printing/print_preview:browser_tests",
      "//chrome/browser/chromeos/reporting/network:browser_tests",
      "//chrome/browser/chromeos/reporting/websites:browser_tests",
      "//chrome/browser/chromeos/smart_reader:browser_tests",
      "//chrome/browser/chromeos/video_conference:browser_tests",
    ]
  }
}

if (is_chromeos_lacros) {
  group("lacros_chrome_browsertests") {
    testonly = true

    deps = [
      "//chrome/browser/chromeos/extensions/contact_center_insights:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/extensions/odfs_config_private:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/network:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/policy/dlp:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/printing/print_preview:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/reporting/network:lacros_chrome_browsertests",
      "//chrome/browser/chromeos/tablet_mode:lacros_chrome_browsertests",
    ]
  }
}

if (!is_chromeos_device) {
  group("interactive_ui_tests") {
    testonly = true

    deps = [ "//chrome/browser/chromeos/policy/dlp:interactive_ui_tests" ]
  }
}

proto_library("system_stack_sampled_metrics_status_proto") {
  sources = [ "//third_party/cros_system_api/proto/stack_sampled_metrics_status//stack_sampled_metrics_status.proto" ]

  proto_out_dir =
      "third_party/cros_system_api/proto/stack_sampled_metrics_status"
}