# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")
}
source_set("core") {
sources = [
"empty_tab_group_sync_delegate.cc",
"empty_tab_group_sync_delegate.h",
"startup_helper.cc",
"startup_helper.h",
"tab_group_sync_coordinator.h",
"tab_group_sync_coordinator_impl.cc",
"tab_group_sync_coordinator_impl.h",
"tab_group_sync_delegate.h",
"tab_group_sync_service.h",
"tab_group_sync_service_impl.cc",
"tab_group_sync_service_impl.h",
]
deps = [
":tab_group_sync_bridge",
"//base",
"//components/keyed_service/core",
"//components/sync",
"//components/tab_groups",
"//ui/gfx",
"//url",
]
if (is_android) {
sources += [
"android/tab_group_sync_conversions_bridge.cc",
"android/tab_group_sync_conversions_bridge.h",
"android/tab_group_sync_conversions_utils.cc",
"android/tab_group_sync_conversions_utils.h",
"android/tab_group_sync_service_android.cc",
"android/tab_group_sync_service_android.h",
]
deps += [ ":jni_headers" ]
}
public_deps = [ ":model" ]
}
source_set("model") {
sources = [
"features.cc",
"features.h",
"pref_names.cc",
"pref_names.h",
"saved_tab_group.cc",
"saved_tab_group.h",
"saved_tab_group_model.cc",
"saved_tab_group_model.h",
"saved_tab_group_model_observer.h",
"saved_tab_group_tab.cc",
"saved_tab_group_tab.h",
"stats.cc",
"stats.h",
"tab_group_sync_metrics_logger.cc",
"tab_group_sync_metrics_logger.h",
"types.cc",
"types.h",
"utils.cc",
"utils.h",
]
deps = [
"//base",
"//components/pref_registry",
"//components/sync",
"//components/sync_device_info",
"//components/tab_groups",
"//ui/gfx",
"//url",
]
public_deps = []
}
source_set("string_utils") {
sources = [
"string_utils.cc",
"string_utils.h",
]
deps = [
"//components/strings",
"//ui/base",
]
}
if (is_android) {
android_library("java") {
sources = [
"android/java/src/org/chromium/components/tab_group_sync/EventDetails.java",
"android/java/src/org/chromium/components/tab_group_sync/LocalTabGroupId.java",
"android/java/src/org/chromium/components/tab_group_sync/SavedTabGroup.java",
"android/java/src/org/chromium/components/tab_group_sync/SavedTabGroupTab.java",
"android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncConversionsBridge.java",
"android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncService.java",
"android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncServiceImpl.java",
]
deps = [
"//base:base_java",
"//components/tab_groups:tab_groups_java",
"//net/android:net_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/jni_zero:jni_zero_java",
"//url:gurl_java",
]
srcjar_deps = [
":jni_headers",
":tab_group_sync_enums_java",
]
}
generate_jni("jni_headers") {
visibility = [
":*",
"//chrome/browser",
]
sources = [
"android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncConversionsBridge.java",
"android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncServiceImpl.java",
]
}
java_cpp_enum("tab_group_sync_enums_java") {
visibility = [ ":*" ]
sources = [ "types.h" ]
}
android_library("native_java_unittests_java") {
testonly = true
deps = [
":java",
"//base:base_java",
"//base:base_java_test_support",
"//components/tab_groups:tab_groups_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit",
"//third_party/mockito:mockito_java",
"//url:url_java",
]
srcjar_deps = [ ":native_j_unittests_jni_headers" ]
sources = [ "android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncServiceAndroidUnitTest.java" ]
}
generate_jni("native_j_unittests_jni_headers") {
testonly = true
sources = [ "android/java/src/org/chromium/components/tab_group_sync/TabGroupSyncServiceAndroidUnitTest.java" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"saved_tab_group_model_unittest.cc",
"saved_tab_group_proto_conversion_unittest.cc",
"saved_tab_group_sync_bridge_unittest.cc",
"saved_tab_group_unittest.cc",
"shared_tab_group_data_sync_bridge_unittest.cc",
"startup_helper_unittest.cc",
"string_utils_unittest.cc",
"tab_group_sync_bridge_mediator_unittest.cc",
"tab_group_sync_coordinator_unittest.cc",
"tab_group_sync_metrics_logger_unittest.cc",
"tab_group_sync_service_unittest.cc",
]
deps = [
":core",
":model",
":string_utils",
":tab_group_sync_bridge",
":test_support",
"//base",
"//base/test:test_support",
"//components/pref_registry:pref_registry",
"//components/prefs:test_support",
"//components/sync",
"//components/sync:test_support",
"//components/sync_device_info",
"//components/sync_device_info:test_support",
"//components/tab_groups",
"//testing/gmock",
"//testing/gtest",
"//url",
]
if (is_android) {
sources += [ "android/tab_group_sync_service_android_unittest.cc" ]
deps += [
":native_j_unittests_jni_headers",
":native_java_unittests_java",
]
}
}
source_set("test_support") {
testonly = true
sources = [
"mock_tab_group_sync_delegate.cc",
"mock_tab_group_sync_delegate.h",
"mock_tab_group_sync_service.cc",
"mock_tab_group_sync_service.h",
"saved_tab_group_test_utils.cc",
"saved_tab_group_test_utils.h",
]
deps = [
":core",
":fake_tab_group_sync_service",
":model",
"//base",
"//base/test:test_support",
"//components/sync_device_info",
"//components/tab_groups",
"//testing/gtest",
"//url",
]
}
source_set("fake_tab_group_sync_service") {
sources = [
"fake_tab_group_sync_service.cc",
"fake_tab_group_sync_service.h",
]
deps = [
":core",
":model",
"//base",
]
}
source_set("tab_group_sync_bridge") {
visibility = [
":*",
# This is allowed until usage of SavedTabGroupKeyedService has been migrated
# to TabGroupSyncService.
"//chrome/browser",
"//chrome/browser/ui",
"//chrome/test:sync_integration_tests",
"//ios/chrome/browser/saved_tab_groups/model",
]
sources = [
"saved_tab_group_proto_conversions.cc",
"saved_tab_group_proto_conversions.h",
"saved_tab_group_sync_bridge.cc",
"saved_tab_group_sync_bridge.h",
"shared_tab_group_data_sync_bridge.cc",
"shared_tab_group_data_sync_bridge.h",
"sync_data_type_configuration.cc",
"sync_data_type_configuration.h",
"tab_group_sync_bridge_mediator.cc",
"tab_group_sync_bridge_mediator.h",
]
deps = [
":model",
"//components/saved_tab_groups/proto",
"//components/tab_groups:tab_groups",
]
public_deps = [
"//base",
"//components/sync/base",
"//components/sync/model",
]
}