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

source_set("sharing") {
  sources = [
    "sharing_device_registration_impl.h",
    "sharing_handler_registry_impl.h",
    "sharing_message_bridge_factory.h",
    "sharing_service_factory.h",
  ]
  public_deps = [
    "//base",
    "//chrome/browser/notifications",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui/page_action:icon_type",
    "//components/gcm_driver/instance_id",
    "//components/keyed_service/core",
    "//components/sharing_message",
    "//components/sharing_message/proto",
    "//components/sync_device_info",
  ]

  if (!is_android) {
    sources += [
      "sharing_notification_handler.h",
      "sharing_ui_controller.h",
    ]
  }
}

source_set("impl") {
  sources = [
    "sharing_device_registration_impl.cc",
    "sharing_handler_registry_impl.cc",
    "sharing_message_bridge_factory.cc",
    "sharing_service_factory.cc",
  ]
  deps = [
    ":sharing",
    "//chrome/browser/autofill",
    "//chrome/browser/gcm",
    "//chrome/browser/glic",
    "//chrome/browser/optimization_guide",
    "//chrome/browser/sharing/browser_actuator",
    "//chrome/browser/sharing/glic_experimental_triggering",
    "//chrome/browser/sharing/one_time_tokens",
    "//chrome/browser/sharing/optimization_guide",
    "//chrome/browser/sharing/shared_clipboard",
    "//chrome/browser/sync",
    "//chrome/common:channel_info",
    "//components/browser_actuator/public",
    "//components/gcm_driver/crypto",
    "//components/optimization_guide/core:features",
    "//components/send_tab_to_self",
    "//components/sharing_message/ios_push",
    "//components/sync/base",
    "//components/sync/model",
    "//components/sync/service",
  ]

  if (!is_android) {
    sources += [
      "sharing_notification_handler.cc",
      "sharing_ui_controller.cc",
    ]
    deps += [
      "//chrome/browser/sync:factories",
      "//chrome/browser/ui",
      "//chrome/browser/ui/views/sharing",
      "//components/send_tab_to_self:features",
      "//components/sharing_message/proto",
    ]
  } else {
    deps += [
      "//chrome/android:jni_headers",
      "//chrome/browser/sharing/sms",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [ "sharing_device_registration_impl_unittest.cc" ]

  deps = [
    ":impl",
    ":sharing",
    "//base",
    "//base/test:test_support",
    "//chrome/browser/sharing/browser_actuator:unit_tests",
    "//chrome/common:chrome_features",
    "//components/browser_actuator/public",
    "//components/gcm_driver/instance_id",
    "//components/prefs",
    "//components/sharing_message",
    "//components/sync:test_support",
    "//components/sync_device_info",
    "//components/sync_device_info:test_support",
    "//components/sync_preferences:test_support",
    "//google_apis/gcm",
    "//testing/gmock",
    "//testing/gtest",
  ]
}
