naiveproxy/chrome/common/BUILD.gn

812 lines
23 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
# 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/buildflag_header.gni")
import("//build/util/lastchange.gni")
import("//build/util/process_version.gni")
import("//chrome/common/features.gni")
import("//chrome/process_version_rc_template.gni") # For branding_file_path.
import("//components/nacl/features.gni")
import("//components/offline_pages/buildflags/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//tools/grit/grit_rule.gni")
if (enable_pdf) {
assert(enable_plugins, "PDF support requires plugins be enabled.")
}
grit("resources") {
source = "common_resources.grd"
defines = chrome_grit_defines
output_dir = "$root_gen_dir/chrome"
output_name = "common_resources"
outputs = [
"grit/common_resources.h",
"common_resources.pak",
]
}
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [
"ENABLE_APP_LIST=$enable_app_list",
"ENABLE_BACKGROUND_MODE=$enable_background_mode",
"ENABLE_BACKGROUND_CONTENTS=$enable_background_contents",
"ENABLE_BASIC_PRINT_DIALOG=$enable_basic_print_dialog",
"ENABLE_CAPTIVE_PORTAL_DETECTION=$enable_captive_portal_detection",
"ENABLE_HANGOUT_SERVICES_EXTENSION=$enable_hangout_services_extension",
"ENABLE_ONE_CLICK_SIGNIN=$enable_one_click_signin",
"ENABLE_NATIVE_NOTIFICATIONS=$enable_native_notifications",
"ENABLE_SERVICE_DISCOVERY=$enable_service_discovery",
"ENABLE_SESSION_SERVICE=$enable_session_service",
"ENABLE_SIMPLE_BROWSER_SERVICE_IN_PROCESS=$enable_simple_browser_service_in_process",
"ENABLE_SIMPLE_BROWSER_SERVICE_OUT_OF_PROCESS=$enable_simple_browser_service_out_of_process",
"ENABLE_SUPERVISED_USERS=$enable_supervised_users",
"ENABLE_WAYLAND_SERVER=$enable_wayland_server",
"PGO_BUILD=$pgo_build",
"OPTIMIZE_WEBUI=$optimize_webui",
]
}
source_set("channel_info") {
sources = [
"channel_info.cc",
"channel_info.h",
"channel_info_android.cc",
"channel_info_chromeos.cc",
"channel_info_mac.mm",
"channel_info_win.cc",
]
if (is_posix && !is_android && !is_chromeos && !is_mac) {
sources += [ "channel_info_posix.cc" ]
}
public_deps = [
"//base",
"//components/version_info",
"//components/version_info:version_string",
]
if (is_win) {
public_deps += [ "//chrome/install_static:install_static_util" ]
}
if (is_android) {
public_deps += [ "//components/version_info/android:channel_getter" ]
}
}
source_set("ini_parser") {
sources = [
"ini_parser.cc",
"ini_parser.h",
]
deps = [
"//base",
]
}
source_set("common_param_traits_macros") {
sources = [
"common_param_traits_macros.h",
]
deps = [
"//components/content_settings/core/common",
"//ipc",
]
}
# Use a static library here because many test binaries depend on this but don't
# require many files from it. This makes linking more efficient.
static_library("common") {
sources = [
"all_messages.h",
"attrition_experiments.h",
"auto_start_linux.cc",
"auto_start_linux.h",
"browser_controls_state_param_traits.h",
"child_process_logging.h",
"child_process_logging_win.cc",
"chrome_content_client.cc",
"chrome_content_client.h",
"chrome_content_client_constants.cc",
"chrome_isolated_world_ids.h",
"chrome_result_codes.h",
"client_hints/client_hints.cc",
"client_hints/client_hints.h",
"common_message_generator.cc",
"common_message_generator.h",
"common_param_traits.cc",
"common_param_traits.h",
"component_flash_hint_file_linux.cc",
"component_flash_hint_file_linux.h",
"conflicts/module_watcher_win.cc",
"conflicts/module_watcher_win.h",
"content_restriction.h",
"crash_keys.cc",
"crash_keys.h",
"custom_handlers/protocol_handler.cc",
"custom_handlers/protocol_handler.h",
"descriptors_android.h",
"google_url_loader_throttle.cc",
"google_url_loader_throttle.h",
"instant_struct_traits.h",
"logging_chrome.cc",
"logging_chrome.h",
"mac/app_shim_launch.h",
"mac/app_shim_messages.h",
"mac/cfbundle_blocker.h",
"mac/cfbundle_blocker.mm",
"mac/launchd.h",
"mac/launchd.mm",
"media/media_resource_provider.cc",
"media/media_resource_provider.h",
"media/webrtc_logging_message_data.cc",
"media/webrtc_logging_message_data.h",
"media/webrtc_logging_messages.h",
"media_galleries/metadata_types.h",
"multi_process_lock.h",
"multi_process_lock_linux.cc",
"multi_process_lock_mac.cc",
"multi_process_lock_win.cc",
"origin_trials/chrome_origin_trial_policy.cc",
"origin_trials/chrome_origin_trial_policy.h",
"page_load_metrics/page_load_metrics_constants.h",
"page_load_metrics/page_load_metrics_util.cc",
"page_load_metrics/page_load_metrics_util.h",
"page_load_metrics/page_load_timing.cc",
"page_load_metrics/page_load_timing.h",
"page_load_metrics/page_track_decider.cc",
"page_load_metrics/page_track_decider.h",
"pdf_uma.cc",
"pdf_uma.h",
"pref_names_util.cc",
"pref_names_util.h",
"prerender_messages.h",
"prerender_types.h",
"prerender_url_loader_throttle.cc",
"prerender_url_loader_throttle.h",
"prerender_util.cc",
"prerender_util.h",
"profiling.cc",
"profiling.h",
"ref_counted_util.h",
"render_messages.h",
"search/instant_types.cc",
"search/instant_types.h",
"search/ntp_logging_events.h",
"secure_origin_whitelist.cc",
"secure_origin_whitelist.h",
"ssl_insecure_content.cc",
"ssl_insecure_content.h",
"stack_sampling_configuration.cc",
"stack_sampling_configuration.h",
"thread_profiler.cc",
"thread_profiler.h",
"trace_event_args_whitelist.cc",
"trace_event_args_whitelist.h",
"tts_messages.h",
"tts_utterance_request.cc",
"tts_utterance_request.h",
"url_constants.cc",
"url_constants.h",
"web_application_info.cc",
"web_application_info.h",
"web_application_info_provider_param_traits.h",
"webui_url_constants.cc",
"webui_url_constants.h",
]
defines = []
configs += [
"//build/config:precompiled_headers",
"//build/config/compiler:wexit_time_destructors",
]
public_deps = [
":available_offline_content_mojom",
":buildflags",
":channel_info",
":client_hints_mojom",
":common_param_traits_macros",
":ini_parser",
":mojo_bindings",
":page_load_metrics_mojom",
":supervised_user_commands_mojom",
"//base:base",
"//base:base_static",
"//base:i18n",
"//chrome:resources",
"//chrome:strings",
"//chrome/app/theme:theme_resources",
"//chrome/common:constants",
"//chrome/common/net",
"//chrome/installer/util:with_no_strings",
"//components/cast_certificate",
"//components/cdm/common",
"//components/cloud_devices/common",
"//components/component_updater",
"//components/content_settings/core/common",
"//components/crash/core/common",
"//components/dom_distiller/core",
"//components/error_page/common",
"//components/favicon_base",
"//components/flags_ui:switches",
"//components/gcm_driver/common",
"//components/metrics",
"//components/metrics:net",
"//components/nacl/common:buildflags",
"//components/nacl/common:process_type",
"//components/nacl/common:switches",
"//components/net_log",
"//components/network_session_configurator/common",
"//components/ntp_tiles",
"//components/offline_pages/buildflags",
"//components/offline_pages/core:switches",
"//components/omnibox/common",
"//components/password_manager/core/common",
"//components/policy:generated",
"//components/policy/core/common",
"//components/prefs",
"//components/safe_browsing/web_ui:constants",
"//components/services/heap_profiling/public/cpp",
"//components/strings",
"//components/translate/content/common",
"//components/translate/core/common",
"//components/url_formatter",
"//components/variations",
"//components/variations/net:net",
"//components/visitedlink/common",
"//content/public/common",
"//extensions/buildflags",
"//extensions/common:common_constants",
"//google_apis",
"//gpu/command_buffer/service",
"//gpu/config",
"//ipc",
"//media",
"//mojo/public/cpp/bindings",
"//pdf:buildflags",
"//ppapi/buildflags",
"//printing/buildflags",
"//services/service_manager/sandbox",
"//skia",
"//third_party/icu",
"//third_party/re2",
"//third_party/widevine/cdm:headers",
"//ui/accessibility",
"//ui/base",
"//ui/gfx/ipc",
"//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia",
"//ui/gl",
"//ui/message_center/public/cpp",
"//ui/resources:resources",
"//url",
]
deps = [
"//components/metrics:call_stack_profile_builder",
]
if (enable_plugins) {
public_deps += [ "//ppapi/shared_impl" ]
}
if (enable_extensions) {
sources += [
"cast_messages.cc",
"cast_messages.h",
"extensions/api/automation_api_constants.h",
"extensions/api/commands/commands_handler.cc",
"extensions/api/commands/commands_handler.h",
"extensions/api/extension_action/action_info.cc",
"extensions/api/extension_action/action_info.h",
"extensions/api/notifications/notification_style.cc",
"extensions/api/notifications/notification_style.h",
"extensions/api/omnibox/omnibox_handler.cc",
"extensions/api/omnibox/omnibox_handler.h",
"extensions/api/speech/tts_engine_manifest_handler.cc",
"extensions/api/speech/tts_engine_manifest_handler.h",
"extensions/api/spellcheck/spellcheck_handler.cc",
"extensions/api/spellcheck/spellcheck_handler.h",
"extensions/api/storage/storage_schema_manifest_handler.cc",
"extensions/api/storage/storage_schema_manifest_handler.h",
"extensions/api/system_indicator/system_indicator_handler.cc",
"extensions/api/system_indicator/system_indicator_handler.h",
"extensions/api/url_handlers/url_handlers_parser.cc",
"extensions/api/url_handlers/url_handlers_parser.h",
"extensions/api/webstore/webstore_api_constants.cc",
"extensions/api/webstore/webstore_api_constants.h",
"extensions/chrome_aliases.cc",
"extensions/chrome_aliases.h",
"extensions/chrome_extension_messages.h",
"extensions/chrome_extensions_api_provider.cc",
"extensions/chrome_extensions_api_provider.h",
"extensions/chrome_extensions_client.cc",
"extensions/chrome_extensions_client.h",
"extensions/chrome_manifest_handlers.cc",
"extensions/chrome_manifest_handlers.h",
"extensions/chrome_manifest_url_handlers.cc",
"extensions/chrome_manifest_url_handlers.h",
"extensions/command.cc",
"extensions/command.h",
"extensions/extension_constants.cc",
"extensions/extension_constants.h",
"extensions/extension_metrics.cc",
"extensions/extension_metrics.h",
"extensions/image_writer/image_writer_util_mac.cc",
"extensions/image_writer/image_writer_util_mac.h",
"extensions/manifest_handlers/app_icon_color_info.cc",
"extensions/manifest_handlers/app_icon_color_info.h",
"extensions/manifest_handlers/app_launch_info.cc",
"extensions/manifest_handlers/app_launch_info.h",
"extensions/manifest_handlers/app_theme_color_info.cc",
"extensions/manifest_handlers/app_theme_color_info.h",
"extensions/manifest_handlers/extension_action_handler.cc",
"extensions/manifest_handlers/extension_action_handler.h",
"extensions/manifest_handlers/linked_app_icons.cc",
"extensions/manifest_handlers/linked_app_icons.h",
"extensions/manifest_handlers/minimum_chrome_version_checker.cc",
"extensions/manifest_handlers/minimum_chrome_version_checker.h",
"extensions/manifest_handlers/settings_overrides_handler.cc",
"extensions/manifest_handlers/settings_overrides_handler.h",
"extensions/manifest_handlers/theme_handler.cc",
"extensions/manifest_handlers/theme_handler.h",
"extensions/manifest_handlers/ui_overrides_handler.cc",
"extensions/manifest_handlers/ui_overrides_handler.h",
"extensions/mojom/inline_install_traits.h",
"extensions/permissions/chrome_api_permissions.cc",
"extensions/permissions/chrome_api_permissions.h",
"extensions/permissions/chrome_permission_message_provider.cc",
"extensions/permissions/chrome_permission_message_provider.h",
"extensions/permissions/chrome_permission_message_rules.cc",
"extensions/permissions/chrome_permission_message_rules.h",
"extensions/sync_helper.cc",
"extensions/sync_helper.h",
"extensions/webstore_install_result.cc",
"extensions/webstore_install_result.h",
"initialize_extensions_client.cc",
"initialize_extensions_client.h",
]
public_deps += [
"//chrome/common/extensions:mojo_bindings",
"//chrome/common/extensions/api",
"//chrome/common/extensions/api:extensions_features",
"//device/usb",
"//extensions:extensions_resources",
"//extensions/common",
"//extensions/common:core_api_provider",
"//extensions/common/api",
"//extensions/strings",
"//media/cast:net",
]
if (is_chromeos) {
sources += [
"extensions/api/file_browser_handlers/file_browser_handler.cc",
"extensions/api/file_browser_handlers/file_browser_handler.h",
"extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.cc",
"extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h",
"extensions/api/input_ime/input_components_handler.cc",
"extensions/api/input_ime/input_components_handler.h",
]
# This dependency is for a header used only by extensions code.
public_deps += [ "//ui/keyboard:keyboard" ]
}
}
if (is_mac) {
public_deps += [ ":app_mode_app_support" ]
}
if (is_chromeos) {
public_deps += [ "//chromeos" ]
}
if (enable_nacl) {
public_deps += [ "//components/nacl/common" ]
}
# Printing.
if (enable_basic_printing) {
public_deps += [
"//chrome/common/cloud_print",
"//components/printing/common",
"//printing",
]
if (enable_print_preview && !is_chromeos) {
sources += [
"service_process_util.cc",
"service_process_util.h",
"service_process_util_linux.cc",
"service_process_util_mac.mm",
"service_process_util_win.cc",
]
if (is_posix) {
sources += [
"service_process_util_posix.cc",
"service_process_util_posix.h",
]
}
}
if (enable_print_preview && is_win) {
sources += [ "chrome_utility_printing_messages.h" ]
}
}
if (is_android) {
sources -= [ "media_galleries/metadata_types.h" ]
sources += [
"media/chrome_media_drm_bridge_client.cc",
"media/chrome_media_drm_bridge_client.h",
]
} else {
# Non-Android.
public_deps += [ "//chrome/common/importer" ]
}
if (is_win) {
deps += [
"//chrome/common/win:eventlog_messages",
"//chrome_elf:chrome_elf_main_include",
"//components/crash/content/app:crash_export_thunk_include",
]
public_deps += [
"//components/dom_distiller/core", # Needed by chrome_content_client.cc.
"//third_party/wtl",
]
libs = [ "wintrust.lib" ]
}
if (is_mac) {
public_deps += [
"//third_party/google_toolbox_for_mac",
"//third_party/mach_override",
]
}
if (enable_plugins) {
sources += [
"pepper_flash.cc",
"pepper_flash.h",
"plugin_utils.cc",
"plugin_utils.h",
"ppapi_utils.cc",
"ppapi_utils.h",
]
public_deps += [ "//third_party/adobe/flash:flapper_version_h" ]
}
if (enable_plugins && enable_extensions) {
sources += [
"pepper_permission_util.cc",
"pepper_permission_util.h",
]
}
if (safe_browsing_mode != 0) {
public_deps += [ "//chrome/common/safe_browsing" ]
}
if (is_linux) {
deps += [ "//sandbox/linux:sandbox_services" ]
}
if (enable_cdm_host_verification) {
sources += [
"media/cdm_host_file_path.cc",
"media/cdm_host_file_path.h",
]
public_deps += [ "//chrome/common:version_header" ]
}
}
process_version("version_header") {
# TODO(brettw) this should have more reduced visibility, but chrome/browser
# currently depends on this.
#visibility = [ ":*" ]
sources = [
"//chrome/VERSION",
branding_file_path,
lastchange_file,
]
template_file = "chrome_version.h.in"
output = "$target_gen_dir/chrome_version.h"
}
# Separate out the constants that aren't intermingled with or dependent on code
# so that they can be used without adding any binary bloat.
static_library("non_code_constants") {
sources = [
"chrome_constants.cc",
"chrome_constants.h",
"chrome_icon_resources_win.h",
"chrome_switches.cc",
"chrome_switches.h",
"env_vars.cc",
"env_vars.h",
]
deps = [
":buildflags",
":version_header",
"//base",
"//ppapi/buildflags",
]
public_deps = [
"//printing/buildflags",
"//ui/base:ui_features",
]
}
component("chrome_features") {
defines = [ "IS_CHROME_FEATURES_IMPL" ]
sources = [
"chrome_features.cc",
"chrome_features.h",
]
deps = [
":buildflags",
":non_code_constants",
"//base",
"//components/offline_pages/buildflags",
"//device/vr/buildflags",
"//extensions/buildflags",
"//media:media_buildflags",
"//ppapi/buildflags",
"//printing/buildflags",
"//rlz/buildflags",
]
public_deps = [
"//ui/base:ui_features",
]
}
static_library("constants") {
sources = [
"chrome_paths.cc",
"chrome_paths.h",
"chrome_paths_android.cc",
"chrome_paths_internal.h",
"chrome_paths_linux.cc",
"chrome_paths_mac.mm",
"chrome_paths_win.cc",
"chrome_result_codes.h",
"pref_font_script_names-inl.h",
"pref_font_webkit_names.h",
"pref_names.cc",
"pref_names.h",
]
public_deps = [
":buildflags",
":chrome_features",
":non_code_constants",
"//content/public/common:result_codes",
"//rlz/buildflags",
]
deps = [
":channel_info",
":version_header",
"//base",
"//base/third_party/dynamic_annotations",
"//components/bookmarks/common",
"//components/nacl/common:switches",
"//components/offline_pages/buildflags",
"//extensions/buildflags",
"//media/cdm:cdm_paths", # Needed by chrome_paths.cc.
"//ppapi/buildflags",
"//printing/buildflags",
"//third_party/widevine/cdm:headers",
]
if (is_android) {
# This dependency must only be added for Android.
#
# On Windows, //chrome/installer/util depends on this target to get
# constants. That target is in turn used in a number of installer helper
# targets independent of Chrome that we want to keep small. So we don't
# want something large like //ui/base.
#
# Android doesn't have this structure and corresponding size limitation
# on this target. On that platform one of the Chrome paths forwards to one
# implemented in //ui/base, so we need that dependency.
deps += [ "//ui/base" ]
}
if (is_win) {
deps += [ "//chrome/install_static:install_static_util" ]
}
}
if (is_win) {
source_set("metrics_constants_util_win") {
sources = [
"metrics_constants_util_win.cc",
"metrics_constants_util_win.h",
]
deps = [
"//base",
"//chrome/install_static:install_static_util",
]
}
}
# Use a static library here because many test binaries depend on this but don't
# require many files from it. This makes linking more efficient.
static_library("test_support") {
testonly = true
visibility = [ "//chrome/test:*" ]
sources = [
"page_load_metrics/test/page_load_metrics_test_util.cc",
"page_load_metrics/test/page_load_metrics_test_util.h",
"search/mock_embedded_search_client.cc",
"search/mock_embedded_search_client.h",
]
deps = [
":common",
":search_mojom",
"//base",
"//testing/gmock",
"//testing/gtest",
]
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (enable_extensions) {
sources += [
"extensions/extension_test_util.cc",
"extensions/extension_test_util.h",
]
deps += [ "//chrome/common/extensions:test_features" ]
}
}
source_set("app_mode_app_support") {
sources = [
"mac/app_mode_chrome_locator.h",
"mac/app_mode_chrome_locator.mm",
"mac/app_mode_common.h",
"mac/app_mode_common.mm",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
":constants",
"//base",
]
}
mojom("mojo_bindings") {
disable_variants = true
sources = [
"cache_stats_recorder.mojom",
"chrome_render_frame.mojom",
"constants.mojom",
"content_settings_renderer.mojom",
"navigation_corrector.mojom",
"net_benchmarking.mojom",
"network_diagnostics.mojom",
"open_search_description_document_handler.mojom",
"plugin.mojom",
"prerender.mojom",
"renderer_configuration.mojom",
]
if (is_android) {
sources += [ "sandbox_status_extension_android.mojom" ]
}
if (is_mac) {
sources += [ "mac/app_shim.mojom" ]
}
if (is_win) {
sources += [ "conflicts/module_event_sink_win.mojom" ]
}
if (enable_offline_pages) {
sources += [ "mhtml_page_notifier.mojom" ]
}
public_deps = [
"//components/content_settings/core/common:mojo_bindings",
"//content/public/common:interfaces",
"//mojo/public/mojom/base",
"//third_party/blink/public:mojo_bindings",
"//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl",
"//url/mojom:url_mojom_origin",
]
if (safe_browsing_mode == 1) {
public_deps += [ "//chrome/services/file_util/public/mojom" ]
}
overridden_deps = [
"//third_party/blink/public:mojo_bindings",
"//content/public/common:interfaces",
]
component_deps = [ "//content/public/common" ]
}
mojom("search_mojom") {
sources = [
"search.mojom",
]
public_deps = [
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl",
]
}
mojom("page_load_metrics_mojom") {
sources = [
"page_load_metrics/page_load_metrics.mojom",
]
public_deps = [
"//mojo/public/mojom/base",
"//third_party/blink/public:web_feature_mojo_bindings",
]
}
mojom("client_hints_mojom") {
sources = [
"client_hints.mojom",
]
public_deps = [
"//mojo/public/mojom/base",
"//third_party/blink/public:web_client_hints_types_mojo_bindings",
"//url/mojom:url_mojom_origin",
]
}
if (enable_print_preview && !is_chromeos) {
mojom("service_process_mojom") {
sources = [
"cloud_print.mojom",
"service_process.mojom",
]
public_deps = [
"//mojo/public/mojom/base",
]
}
}
mojom("supervised_user_commands_mojom") {
sources = [
"supervised_user_commands.mojom",
]
}
mojom("available_offline_content_mojom") {
sources = [
"available_offline_content.mojom",
]
public_deps = [
"//url/mojom:url_mojom_gurl",
]
}