1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
# 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/features.gni")
import("//build/config/ui.gni")
import("//build/config/linux/pkg_config.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" ]
}
}
static_library("os_crypt") {
sources = [
"ie7_password_win.cc",
"ie7_password_win.h",
"keychain_password_mac.h",
"keychain_password_mac.mm",
"os_crypt.h",
"os_crypt_mac.mm",
"os_crypt_posix.cc",
"os_crypt_switches.cc",
"os_crypt_switches.h",
"os_crypt_win.cc",
]
deps = [
"//base",
"//crypto",
# TODO(tfarina): Remove this dep when http://crbug.com/363749 is fixed.
"//crypto:platform",
]
if (is_mac || is_ios) {
sources -= [ "os_crypt_posix.cc" ]
}
if (is_ios) {
set_sources_assignment_filter([])
sources += [
"keychain_password_mac.mm",
"os_crypt_mac.mm",
]
set_sources_assignment_filter(sources_assignment_filter)
}
if (is_win) {
libs = [ "crypt32.lib" ]
}
if (is_desktop_linux) {
sources -= [ "os_crypt_posix.cc" ]
sources += [
"key_storage_linux.cc",
"key_storage_linux.h",
"key_storage_util_linux.cc",
"key_storage_util_linux.h",
"os_crypt_linux.cc",
]
defines = []
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_desktop_linux) {
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 = [
"ie7_password_win_unittest.cc",
"keychain_password_mac_unittest.mm",
"os_crypt_unittest.cc",
]
deps = [
":os_crypt",
":test_support",
"//base",
"//crypto",
"//testing/gmock",
"//testing/gtest",
]
if (is_desktop_linux) {
sources += [ "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" ]
}
}
}
|