# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//base/win/embedded_i18n/generate_embedded_i18n.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/nocompile.gni")
import("//build/toolchain/win/midl.gni")
import("//chrome/process_version_rc_template.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")
# This static library is shared with the setup program.
source_set("common") {
sources = [
"experiments_fetcher.cc",
"experiments_fetcher.h",
"experiments_manager.cc",
"experiments_manager.h",
"gcp_crash_reporter_client.cc",
"gcp_crash_reporter_client.h",
"gcp_crash_reporting_utils.cc",
"gcp_crash_reporting_utils.h",
"gem_device_details_manager.cc",
"gem_device_details_manager.h",
]
public_configs = [ ":common_config" ]
public_deps = [ "//chrome/credential_provider/common:common_constants" ]
deps = [
":gaia_credential_provider_idl",
":string_resources",
":util",
"../extension:extension_lib",
"//base",
"//build:branding_buildflags",
"//chrome/common:version_header",
"//chrome/installer/launcher_support",
"//components/crash/core/app",
"//components/crash/core/common",
"//components/version_info",
"//google_apis:google_apis",
"//url",
]
}
config("common_config") {
defines = [
# Needed in order to include the win32 header security.h.
"SECURITY_WIN32",
]
libs = [
"secur32.lib", # For LsaXXX functions
"wbemuuid.lib", # For CLSID_WbemLocator
"netapi32.lib", # For NetUserXXX()
"iphlpapi.lib", # For GetAdaptersInfo
"userenv.lib", # For GetUserProfileDirectoryW()
]
}
# This utility library is shared with the GCPW extension.
source_set("util") {
sources = [
"gcp_utils.cc",
"gcp_utils.h",
"gcpw_strings.cc",
"gcpw_strings.h",
"internet_availability_checker.cc",
"internet_availability_checker.h",
"logging.cc",
"logging.h",
"os_gaia_user_manager.cc",
"os_gaia_user_manager.h",
"os_user_manager.cc",
"os_user_manager.h",
"reg_utils.cc",
"reg_utils.h",
"scoped_handle.h",
"scoped_lsa_policy.cc",
"scoped_lsa_policy.h",
"token_generator.cc",
"token_generator.h",
"win_http_url_fetcher.cc",
"win_http_url_fetcher.h",
]
public_configs = [ ":util_config" ]
public_deps = [ "//chrome/credential_provider/common:common_constants" ]
deps = [
":gaia_credential_provider_idl",
":string_resources",
"//base",
"//build:branding_buildflags",
"//chrome/common:version_header",
"//chrome/installer/launcher_support",
"//google_apis:google_apis",
"//third_party/re2",
"//url:url",
]
}
config("util_config") {
defines = [
# Needed in order to include the win32 header security.h.
"SECURITY_WIN32",
]
}
# This component is used for the cloud policies feature.
component("policies") {
output_name = "gcpw_policies"
sources = [
"device_policies.cc",
"device_policies.h",
"device_policies_manager.cc",
"device_policies_manager.h",
"gcpw_version.cc",
"gcpw_version.h",
"user_policies.cc",
"user_policies.h",
"user_policies_manager.cc",
"user_policies_manager.h",
]
defines = [ "IS_GCPW_POLICIES_IMPL" ]
deps = [
":common",
":util",
"../extension:extension_lib",
"//base",
"//chrome/updater/protos:omaha_proto",
"//components/policy/proto",
"//url",
]
}
source_set("mdm_utils") {
sources = [
"mdm_utils.cc",
"mdm_utils.h",
]
public_configs = [ ":gaiacp_config" ]
deps = [
":policies",
":util",
"//base",
"//build:branding_buildflags",
"//url:url",
]
}
# This static library is shared with the test code.
source_set("gaiacp_lib") {
sources = [
"associated_user_validator.cc",
"associated_user_validator.h",
"auth_utils.cc",
"auth_utils.h",
"chrome_availability_checker.cc",
"chrome_availability_checker.h",
"credential_provider_broker_win.cc",
"credential_provider_broker_win.h",
"event_logging_api_manager.cc",
"event_logging_api_manager.h",
"event_logs_upload_manager.cc",
"event_logs_upload_manager.h",
"gaia_credential.cc",
"gaia_credential.h",
"gaia_credential_base.cc",
"gaia_credential_base.h",
"gaia_credential_other_user.cc",
"gaia_credential_other_user.h",
"gaia_credential_provider.cc",
"gaia_credential_provider.h",
"gaia_credential_provider_filter.cc",
"gaia_credential_provider_filter.h",
"gaia_credential_provider_module.cc",
"gaia_credential_provider_module.h",
"gcp_crash_reporting.cc",
"gcp_crash_reporting.h",
"initguid.cc",
"os_process_manager.cc",
"os_process_manager.h",
"password_recovery_manager.cc",
"password_recovery_manager.h",
"reauth_credential.cc",
"reauth_credential.h",
"scoped_user_profile.cc",
"scoped_user_profile.h",
"stdafx.h",
]
public_configs = [ ":gaiacp_config" ]
public_deps = [ ":common" ]
deps = [
":gaia_credential_provider_idl",
":mdm_utils",
":policies",
":static_resources",
":string_resources",
":util",
"../eventlog:gcp_eventlog_messages",
"../extension:common",
"../extension:extension_lib",
"//build:branding_buildflags",
"//chrome/common:non_code_constants",
"//chrome/common:version_header",
"//chrome/credential_provider/gaiacp/mojom",
"//chrome/installer/launcher_support",
"//components/crash/core/app:app",
"//components/crash/core/app:crash_export_thunks",
"//components/crash/core/app:run_as_crashpad_handler",
"//content/public/browser",
"//crypto",
"//google_apis",
"//net",
"//third_party/boringssl",
"//third_party/re2",
"//url",
]
libs = [
"hid.lib",
"setupapi.lib",
"wevtapi.lib",
]
}
config("gaiacp_config") {
defines = [
# Make single parameter CString constructors explicit.
"_ATL_CSTRING_EXPLICIT_CONSTRUCTORS",
# Needed to build COM objects that will be hosted in a DLL.
"_WINDLL",
]
libs = [
"advapi32.lib", # For LookupAccountSid()
"credui.lib", # For CredPackAuthenticationBufferW()
"crypt32.lib", # For CryptProtectData()
"netapi32.lib", # For NetUserXXX()
"userenv.lib", # For GetUserProfileDirectoryW()
"winhttp.lib", # For WinHttpXXX()
]
}
# Targets for the credential provider dll.
process_version_rc_template("version") {
template_file = "gaia_credential_provider.rc.version"
output = "$root_out_dir/gaia_credential_provider.rc"
}
GCP_PLACEHOLDER_CLSID = "PLACEHOLDER-GUID-89adae71-aee5-4ee2-bffb-e8424e06f519"
if (is_chrome_branded) {
gaia_credential_provider_clsid = "0b5bfdf0-4594-47ac-940a-cfc69abc561c"
} else {
gaia_credential_provider_clsid = "89adae71-aee5-4ee2-bffb-e8424e06f519"
}
midl("gaia_credential_provider_idl") {
dynamic_guids = "$GCP_PLACEHOLDER_CLSID=$gaia_credential_provider_clsid"
header_file = "gaia_credential_provider_i.h"
sources = [ "gaia_credential_provider.templ" ]
}
grit("static_resources") {
source = "gaia_static_resources.grd"
inputs = [
"gaia_credential_provider.rgs",
"google_logo_small.bmp",
]
outputs = [
"grit/gaia_static_resources.h",
"grit/gaia_static_resources.rc",
]
resource_ids = ""
}
shared_library("gaia1_0") {
sources = [
"dllmain.cc",
"dllmain.h",
"gaia_credential_provider.def",
]
deps = [
":common",
":gaiacp_lib",
":mdm_utils",
":policies",
":util",
":version",
"//base",
"//build:branding_buildflags",
"//chrome/common:version_header",
"//components/crash/core/app",
"//components/crash/core/app:run_as_crashpad_handler",
"//content/public/browser",
]
configs += [ "//build/config/win:windowed" ]
}
# String Resource targets for the credential provider dll.
generate_embedded_i18n("generate_strings") {
grdfile_folder = "./"
grdfile_name = "gaia_resources"
xtb_relative_path = "strings"
grd_files_info = [ [
grdfile_folder,
grdfile_name,
xtb_relative_path,
default_embedded_i18_locales,
] ]
output_file_name_base = grdfile_name
}
# Compile the generated .rc file.
source_set("string_resources") {
sources = get_target_outputs(":generate_strings")
public_deps = [ ":generate_strings" ]
}