naiveproxy/chrome/common/BUILD.gn

752 lines
22 KiB
Plaintext
Raw Normal View History

2018-01-28 21:32:06 +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/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("//device/vr/features/features.gni")
import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//pdf/features.gni")
import("//ppapi/features/features.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("features") {
header = "features.h"
flags = [
"ENABLE_APP_LIST=$enable_app_list",
"ENABLE_BACKGROUND=$enable_background",
"ENABLE_BASIC_PRINT_DIALOG=$enable_basic_print_dialog",
"ENABLE_CAPTIVE_PORTAL_DETECTION=$enable_captive_portal_detection",
"ENABLE_DOWNLOADABLE_STRINGS=$enable_downloadable_strings",
"ENABLE_GOOGLE_NOW=$enable_google_now",
"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_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_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" ]
}
}
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",
"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",
"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",
"partial_circular_buffer.cc",
"partial_circular_buffer.h",
"pause_tabs_field_trial.h",
"pdf_uma.cc",
"pdf_uma.h",
"pref_names_util.cc",
"pref_names_util.h",
"prerender_messages.h",
"prerender_types.h",
"profiling.cc",
"profiling.h",
"ref_counted_util.h",
"render_messages.h",
"resource_usage_reporter_type_converters.cc",
"resource_usage_reporter_type_converters.h",
"search/instant_types.cc",
"search/instant_types.h",
"search/ntp_logging_events.h",
"search/search_urls.cc",
"search/search_urls.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",
"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",
"webui_url_constants.cc",
"webui_url_constants.h",
]
defines = []
configs += [
"//build/config:precompiled_headers",
"//build/config/compiler:wexit_time_destructors",
]
public_deps = [
":channel_info",
":client_hints_mojom",
":common_param_traits_macros",
":features",
":ini_parser",
":mojo_bindings",
":page_load_metrics_mojom",
"//base:base",
"//base:base_static",
"//base:i18n",
"//chrome:resources",
"//chrome:strings",
"//chrome/app/theme:theme_resources",
"//chrome/common:constants",
"//chrome/common/net",
"//chrome/common/printing:interfaces",
"//chrome/common/profiling",
"//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/json_schema",
"//components/metrics",
"//components/metrics:net",
"//components/nacl/common:features",
"//components/nacl/common:process_type",
"//components/nacl/common:switches",
"//components/network_session_configurator/common",
"//components/ntp_tiles",
"//components/offline_pages/core:switches",
"//components/offline_pages/features:features",
"//components/omnibox/common",
"//components/password_manager/core/common",
"//components/policy:generated",
"//components/policy/core/common",
"//components/prefs",
"//components/safe_browsing/web_ui:constants",
"//components/strings",
"//components/translate/content/common",
"//components/translate/core/common",
"//components/url_formatter",
"//components/variations",
"//components/visitedlink/common",
"//content/public/common",
"//extensions/common:common_constants",
"//extensions/features",
"//google_apis",
"//gpu/command_buffer/service",
"//gpu/config",
"//gpu/config:crash_keys",
"//ipc",
"//media",
"//mojo/edk/system",
"//mojo/public/cpp/bindings",
"//pdf:features",
"//ppapi/features",
"//printing/features",
"//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",
]
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_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/extension_process_policy.cc",
"extensions/extension_process_policy.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/automation.cc",
"extensions/manifest_handlers/automation.h",
"extensions/manifest_handlers/content_scripts_handler.cc",
"extensions/manifest_handlers/content_scripts_handler.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",
]
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/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",
]
}
if (use_aura) {
# This dependency is for a header used only by extensions code.
public_deps += [ "//ui/keyboard:keyboard_with_content" ]
}
}
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 || enable_print_preview) {
sources += [ "chrome_utility_printing_messages.h" ]
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_posix.cc",
"service_process_util_posix.h",
"service_process_util_win.cc",
]
}
}
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 (enable_library_cdms) {
sources += [
"widevine_cdm_constants.cc",
"widevine_cdm_constants.h",
]
public_deps += [ "//media/cdm:cdm_paths" ]
}
if (!enable_webrtc) {
sources -= [ "media/webrtc_logging_messages.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 = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
branding_file_path,
]
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",
"env_vars.cc",
"env_vars.h",
]
deps = [
":version_header",
"//base",
]
}
static_library("constants") {
sources = [
"chrome_features.cc",
"chrome_features.h",
"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",
"chrome_switches.cc",
"chrome_switches.h",
"pref_font_script_names-inl.h",
"pref_font_webkit_names.h",
"pref_names.cc",
"pref_names.h",
]
public_deps = [
":features",
":non_code_constants",
"//content/public/common:result_codes",
"//extensions/features",
"//printing/features",
"//rlz/features",
"//ui/base:ui_features",
]
deps = [
":channel_info",
":version_header",
"//base",
"//base/third_party/dynamic_annotations",
"//components/bookmarks/common",
"//components/nacl/common:switches",
"//components/offline_pages/features",
"//device/vr/features",
"//media:media_features",
"//media/cdm:cdm_paths", # Needed by chrome_paths.cc.
"//ppapi/features",
"//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") {
sources = [
"cache_stats_recorder.mojom",
"chrome_render_frame.mojom",
"constants.mojom",
"insecure_content_renderer.mojom",
"navigation_corrector.mojom",
"net_benchmarking.mojom",
"network_diagnostics.mojom",
"open_search_description_document_handler.mojom",
"plugin.mojom",
"prerender.mojom",
"renderer_configuration.mojom",
"resource_usage_reporter.mojom",
]
if (is_win) {
sources += [ "conflicts/module_event_sink_win.mojom" ]
}
public_deps = [
"//components/content_settings/core/common:mojo_bindings",
"//content/public/common:interfaces",
"//mojo/common:common_custom_types",
"//third_party/WebKit/public:mojo_bindings",
"//ui/gfx/geometry/mojo",
"//url/mojo:url_mojom_gurl",
"//url/mojo:url_mojom_origin",
]
if (safe_browsing_mode == 1) {
public_deps += [ "//chrome/services/file_util/public/interfaces" ]
}
overridden_deps = [
"//third_party/WebKit/public:mojo_bindings",
"//content/public/common:interfaces",
]
component_deps = [ "//content/public/common" ]
# TODO(crbug.com/714018): Convert the implementation to use OnceCallback.
use_once_callback = false
}
mojom("search_mojom") {
sources = [
"search.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
"//url/mojo:url_mojom_gurl",
]
}
mojom("page_load_metrics_mojom") {
sources = [
"page_load_metrics/page_load_metrics.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
"//third_party/WebKit/public:web_feature_mojo_bindings",
]
}
mojom("client_hints_mojom") {
sources = [
"client_hints.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
"//third_party/WebKit/public:web_client_hints_types_mojo_bindings",
"//url/mojo:url_mojom_origin",
]
}
if (enable_print_preview && !is_chromeos) {
mojom("service_process_mojom") {
sources = [
"cloud_print.mojom",
"service_process.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
]
}
}