123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- # Copyright 2014 The Chromium Authors. All rights reserved.
- # Use of this source code is governed by a BSD-style license that can be
- # found in the LICENSE file.
- import("//build/config/chromecast_build.gni")
- import("//build/config/chromeos/ui_mode.gni")
- import("//build/config/features.gni")
- import("//build/config/linux/pkg_config.gni")
- import("//build/config/ui.gni")
- import("//components/os_crypt/features.gni")
- if (use_gnome_keyring) {
- # Gnome-keyring is normally dynamically loaded. The gnome_keyring config
- # will set this up.
- pkg_config("gnome_keyring") {
- packages = [ "gnome-keyring-1" ]
- defines = [ "USE_GNOME_KEYRING" ]
- ignore_libs = true
- }
- # If you want to link gnome-keyring directly (use only for unit tests)
- # ADDITIONALLY add this config on top of ":gnome_keyring". pkg-config is a
- # bit slow, so prefer not to run it again. In practice, gnome-keyring's libs
- # are just itself and common gnome ones we link already, so we can get away
- # with additionally just coding the library name here.
- # TODO(cfroussios): This is only used by
- # chrome/browser/password_manager/native_backend_gnome_x_unittest.cc
- # We should deprecate both.
- config("gnome_keyring_direct") {
- libs = [ "gnome-keyring" ]
- }
- }
- component("os_crypt") {
- sources = [
- "os_crypt.h",
- "os_crypt_switches.cc",
- "os_crypt_switches.h",
- ]
- deps = [
- "//base",
- "//build:branding_buildflags",
- "//build:chromecast_buildflags",
- "//build:chromeos_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" ]
- }
- # TODO(crbug.com/1339022): Provide a Fuchsia-specific implementation.
- if ((is_posix && !is_apple && !(is_linux && !is_castos)) || is_fuchsia) {
- sources += [ "os_crypt_posix.cc" ]
- }
- if (is_apple) {
- sources += [
- "keychain_password_mac.h",
- "keychain_password_mac.mm",
- "os_crypt_mac.mm",
- ]
- }
- if (is_win) {
- sources += [ "os_crypt_win.cc" ]
- libs = [ "crypt32.lib" ]
- }
- 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_gnome_keyring) {
- sources += [
- "key_storage_keyring.cc",
- "key_storage_keyring.h",
- "keyring_util_linux.cc",
- "keyring_util_linux.h",
- ]
- configs += [ ":gnome_keyring" ]
- defines += [ "USE_KEYRING" ]
- }
- if (use_glib) {
- 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" ]
- }
- }
- }
- static_library("test_support") {
- testonly = true
- sources = [
- "os_crypt_mocker.cc",
- "os_crypt_mocker.h",
- ]
- deps = [
- ":os_crypt",
- "//base",
- "//testing/gtest",
- ]
- if (is_linux && !is_castos) {
- sources += [
- "os_crypt_mocker_linux.cc",
- "os_crypt_mocker_linux.h",
- ]
- defines = []
- if (use_gnome_keyring) {
- defines += [ "USE_KEYRING" ]
- }
- if (use_glib) {
- defines += [ "USE_LIBSECRET" ]
- }
- if (use_dbus) {
- defines += [ "USE_KWALLET" ]
- }
- }
- }
- source_set("unit_tests") {
- testonly = true
- sources = [ "os_crypt_unittest.cc" ]
- deps = [
- ":os_crypt",
- ":test_support",
- "//base",
- "//base/test:test_support",
- "//build:branding_buildflags",
- "//build:chromeos_buildflags",
- "//components/prefs:test_support",
- "//crypto",
- "//testing/gmock",
- "//testing/gtest",
- ]
- if (is_apple) {
- sources += [ "keychain_password_mac_unittest.mm" ]
- }
- 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_gnome_keyring) {
- sources += [ "key_storage_keyring_unittest.cc" ]
- configs += [ ":gnome_keyring" ]
- deps += [ "//base/test:test_support" ]
- defines += [ "USE_KEYRING" ]
- }
- 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" ]
- }
- }
- }
|