| # 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/cast.gni") |
| import("//build/config/features.gni") |
| import("//build/config/ui.gni") |
| import("//components/os_crypt/sync/features.gni") |
| |
| component("sync") { |
| # New code should use os_crypt async. |
| visibility = [ |
| "//chrome/browser", |
| "//chrome/browser/ui", |
| "//chrome/test:test_support", |
| "//components/os_crypt/async/browser:dpapi_key_provider", |
| "//components/os_crypt/async/browser:freedesktop_secret_key_provider", |
| "//components/os_crypt/async/browser:keychain_key_provider", |
| "//components/os_crypt/async/browser:secret_portal_key_provider", |
| "//components/os_crypt/async/browser:unit_tests", |
| "//components/os_crypt/async/common", |
| "//components/os_crypt/async/common:unit_tests", |
| "//components/os_crypt/sync:test_support", |
| "//components/os_crypt/sync:unit_tests", |
| "//components/signin/core/browser", |
| "//components/sync:unit_tests", |
| "//components/sync/nigori", |
| "//components/sync/service", |
| "//headless:headless_non_renderer", |
| "//ios/chrome/browser/web/model:web_internal", |
| "//services/network:network_service", |
| "//services/test/echo:lib", |
| ] |
| if (is_mac) { |
| visibility += [ "//headless:headless_shell_lib" ] |
| } |
| |
| sources = [ |
| "os_crypt.h", |
| "os_crypt_metrics.cc", |
| "os_crypt_metrics.h", |
| "os_crypt_switches.cc", |
| "os_crypt_switches.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//build:branding_buildflags", |
| "//build:chromecast_buildflags", |
| "//components/prefs", |
| "//crypto", |
| ] |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| defines = [ "IS_OS_CRYPT_IMPL" ] |
| |
| if (allow_runtime_configurable_key_storage) { |
| defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ] |
| } |
| |
| if (is_apple) { |
| sources += [ |
| "keychain_password_mac.h", |
| "keychain_password_mac.mm", |
| "os_crypt_mac.mm", |
| ] |
| deps += [ "//crypto:mock_apple_keychain" ] |
| } else if (is_win) { |
| sources += [ "os_crypt_win.cc" ] |
| deps += [ "//components/version_info" ] |
| libs = [ "crypt32.lib" ] |
| } else if (is_linux && !is_castos) { |
| sources += [ |
| "key_storage_config_linux.cc", |
| "key_storage_config_linux.h", |
| "key_storage_linux.cc", |
| "key_storage_linux.h", |
| "key_storage_util_linux.cc", |
| "key_storage_util_linux.h", |
| "os_crypt_linux.cc", |
| ] |
| |
| if (use_glib && use_dbus) { |
| sources += [ |
| "key_storage_libsecret.cc", |
| "key_storage_libsecret.h", |
| "libsecret_util_linux.cc", |
| "libsecret_util_linux.h", |
| ] |
| configs += [ "//build/config/linux:glib" ] |
| deps += [ "//third_party/libsecret" ] |
| defines += [ "USE_LIBSECRET" ] |
| } |
| if (use_dbus) { |
| sources += [ |
| "key_storage_kwallet.cc", |
| "key_storage_kwallet.h", |
| "kwallet_dbus.cc", |
| "kwallet_dbus.h", |
| ] |
| deps += [ "//dbus" ] |
| defines += [ "USE_KWALLET" ] |
| } |
| } else if (is_posix || is_fuchsia) { |
| sources += [ "os_crypt_posix.cc" ] |
| } |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| sources = [ |
| "os_crypt_mocker.cc", |
| "os_crypt_mocker.h", |
| ] |
| deps = [ |
| ":sync", |
| "//base", |
| "//testing/gtest", |
| ] |
| if (is_linux && !is_castos) { |
| sources += [ |
| "os_crypt_mocker_linux.cc", |
| "os_crypt_mocker_linux.h", |
| ] |
| defines = [] |
| if (use_glib) { |
| defines += [ "USE_LIBSECRET" ] |
| } |
| if (use_dbus) { |
| defines += [ "USE_KWALLET" ] |
| } |
| } |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ "os_crypt_unittest.cc" ] |
| deps = [ |
| ":sync", |
| ":test_support", |
| "//base", |
| "//base/test:test_support", |
| "//build:branding_buildflags", |
| "//components/prefs:test_support", |
| "//crypto", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//ui/base", |
| ] |
| |
| if (is_apple) { |
| sources += [ |
| "keychain_password_mac_unittest.mm", |
| "os_crypt_mac_unittest.cc", |
| ] |
| deps += [ "//crypto:mock_apple_keychain" ] |
| } else if (is_linux && !is_castos) { |
| sources += [ |
| "key_storage_linux_unittest.cc", |
| "key_storage_util_linux_unittest.cc", |
| "os_crypt_linux_unittest.cc", |
| ] |
| defines = [] |
| |
| if (use_glib) { |
| sources += [ "key_storage_libsecret_unittest.cc" ] |
| deps += [ "//third_party/libsecret" ] |
| defines += [ "USE_LIBSECRET" ] |
| } |
| if (use_dbus) { |
| sources += [ |
| "key_storage_kwallet_unittest.cc", |
| "kwallet_dbus_unittest.cc", |
| ] |
| deps += [ "//dbus:test_support" ] |
| defines += [ "USE_KWALLET" ] |
| } |
| } else if (is_posix || is_fuchsia) { |
| sources += [ "os_crypt_posix_unittest.cc" ] |
| } |
| } |