blob: 29cd267610e412a846864fe0dccd59349115d8c3 [file] [log] [blame]
# Copyright 2019 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("//components/captive_portal/core/features.gni")
import("//build/config/features.gni")
import("//build/config/locales.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/win/console_app.gni")
import("//build/config/win/manifest.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//gpu/vulkan/features.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
if (is_android) {
import("//build/config/android/config.gni")
} else if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build/mac/tweak_info_plist.gni")
import("//content/public/app/mac_helpers.gni")
import("//third_party/icu/config.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
}
source_set("android_descriptors") {
sources = [ "browser/android_descriptors.h" ]
public_deps = [ "//content/public/common:content_descriptors" ]
}
if (is_android) {
grit("generate_components_strings") {
source = "../components/components_strings.grd"
# components_strings contains strings from all components. WebLayer
# will never display most of them, so we try to limit the included
# strings.
whitelist = rebase_path("grit_strings_whitelist.txt", root_build_dir)
inputs = [ "//weblayer/grit_strings_whitelist.txt" ]
grit_flags = [
"-w",
whitelist,
]
outputs =
[
"grit/components_strings.h",
"java/res/values/components_strings.xml",
] +
process_file_template(
android_bundle_locales_as_resources,
[ "java/res/values-{{source_name_part}}/components_strings.xml" ]) +
process_file_template(locales_with_fake_bidi,
[ "components_strings_{{source_name_part}}.pak" ])
}
repack_locales("weblayer_locales") {
input_locales = locales
output_locales = locales
source_patterns = [ "${root_gen_dir}/weblayer/components_strings_" ]
deps = [ ":generate_components_strings" ]
output_dir = "$root_out_dir/weblayer/locales"
}
android_assets("locale_pak_assets") {
disable_compression = true
renaming_sources = [ "$root_out_dir/weblayer/locales/en-US.pak" ]
renaming_destinations = [ "stored-locales/weblayer/en-US.pak" ]
treat_as_locale_paks = true
deps = [ ":weblayer_locales" ]
}
android_assets("bundle_locale_pak_assets") {
disable_compression = true
renaming_sources = []
renaming_destinations = []
foreach(_locale, locales) {
renaming_sources += [ "$root_out_dir/weblayer/locales/$_locale.pak" ]
renaming_destinations += [ "locales/$_locale.pak" ]
}
treat_as_locale_paks = true
deps = [ ":weblayer_locales" ]
}
}
jumbo_static_library("weblayer_lib") {
sources = [
"app/content_main_delegate_impl.cc",
"app/content_main_delegate_impl.h",
"app/main.cc",
"browser/autofill_client_impl.cc",
"browser/autofill_client_impl.h",
"browser/browser_context_impl.cc",
"browser/browser_context_impl.h",
"browser/browser_impl.cc",
"browser/browser_impl.h",
"browser/browser_main_parts_impl.cc",
"browser/browser_main_parts_impl.h",
"browser/browser_process.cc",
"browser/browser_process.h",
"browser/content_browser_client_impl.cc",
"browser/content_browser_client_impl.h",
"browser/controls_visibility_reason.h",
"browser/download_impl.cc",
"browser/download_impl.h",
"browser/download_manager_delegate_impl.cc",
"browser/download_manager_delegate_impl.h",
"browser/fake_permission_controller_delegate.cc",
"browser/fake_permission_controller_delegate.h",
"browser/feature_list_creator.cc",
"browser/feature_list_creator.h",
"browser/file_select_helper.cc",
"browser/file_select_helper.h",
"browser/host_content_settings_map_factory.cc",
"browser/host_content_settings_map_factory.h",
"browser/i18n_util.cc",
"browser/i18n_util.h",
"browser/isolated_world_ids.h",
"browser/javascript_tab_modal_dialog_manager_delegate_android.cc",
"browser/javascript_tab_modal_dialog_manager_delegate_android.h",
"browser/navigation_controller_impl.cc",
"browser/navigation_controller_impl.h",
"browser/navigation_impl.cc",
"browser/navigation_impl.h",
"browser/persistence/browser_persistence_common.cc",
"browser/persistence/browser_persistence_common.h",
"browser/persistence/browser_persister.cc",
"browser/persistence/browser_persister.h",
"browser/persistence/minimal_browser_persister.cc",
"browser/persistence/minimal_browser_persister.h",
"browser/profile_impl.cc",
"browser/profile_impl.h",
"browser/ssl_error_controller_client.cc",
"browser/ssl_error_controller_client.h",
"browser/stateful_ssl_host_state_delegate_factory.cc",
"browser/stateful_ssl_host_state_delegate_factory.h",
"browser/system_network_context_manager.cc",
"browser/system_network_context_manager.h",
"browser/tab_impl.cc",
"browser/tab_impl.h",
"browser/urlbar/autocomplete_scheme_classifier_impl.cc",
"browser/urlbar/autocomplete_scheme_classifier_impl.h",
"browser/urlbar/url_bar_controller_impl.cc",
"browser/urlbar/url_bar_controller_impl.h",
"browser/web_contents_view_delegate_impl.cc",
"browser/web_contents_view_delegate_impl.h",
"browser/weblayer_browser_interface_binders.cc",
"browser/weblayer_browser_interface_binders.h",
"browser/weblayer_content_browser_overlay_manifest.cc",
"browser/weblayer_content_browser_overlay_manifest.h",
"browser/weblayer_field_trials.h",
"browser/weblayer_security_blocking_page_factory.cc",
"browser/weblayer_security_blocking_page_factory.h",
"browser/weblayer_variations_service_client.cc",
"browser/weblayer_variations_service_client.h",
"browser/webui/web_ui_controller_factory.cc",
"browser/webui/web_ui_controller_factory.h",
"browser/webui/weblayer_internals_ui.cc",
"browser/webui/weblayer_internals_ui.h",
"common/content_client_impl.cc",
"common/content_client_impl.h",
"common/features.cc",
"common/features.h",
"common/weblayer_paths.cc",
"common/weblayer_paths.h",
"public/browser.cc",
"public/browser.h",
"public/browser_observer.h",
"public/common/switches.cc",
"public/common/switches.h",
"public/download.h",
"public/download_delegate.h",
"public/error_page_delegate.h",
"public/fullscreen_delegate.h",
"public/main.h",
"public/navigation.h",
"public/navigation_controller.h",
"public/navigation_observer.h",
"public/new_tab_delegate.h",
"public/profile.h",
"public/tab.h",
"public/tab_observer.h",
"public/url_bar_controller.h",
"renderer/content_renderer_client_impl.cc",
"renderer/content_renderer_client_impl.h",
"renderer/error_page_helper.cc",
"renderer/error_page_helper.h",
"renderer/weblayer_render_frame_observer.cc",
"renderer/weblayer_render_frame_observer.h",
"utility/content_utility_client_impl.cc",
"utility/content_utility_client_impl.h",
]
if (is_android) {
sources += [
"browser/android/metrics/uma_utils.cc",
"browser/android/metrics/uma_utils.h",
"browser/android/metrics/weblayer_metrics_service_client.cc",
"browser/android/metrics/weblayer_metrics_service_client.h",
"browser/devtools_manager_delegate_android.cc",
"browser/devtools_manager_delegate_android.h",
"browser/devtools_server_android.cc",
"browser/devtools_server_android.h",
"browser/weblayer_impl_android.cc",
"renderer/url_loader_throttle_provider.cc",
"renderer/url_loader_throttle_provider.h",
]
}
if (enable_captive_portal_detection) {
sources += [
"browser/captive_portal_service_factory.cc",
"browser/captive_portal_service_factory.h",
]
}
configs += [
"//build/config:precompiled_headers",
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
"//build/config/compiler:no_size_t_to_int_warning",
]
public_deps = [ ":android_descriptors" ]
deps = [
"//base",
"//base:base_static",
"//base/third_party/dynamic_annotations",
"//cc",
"//components/autofill/content/browser",
"//components/autofill/content/renderer",
"//components/autofill/core/browser",
"//components/base32",
"//components/captive_portal/core:buildflags",
"//components/content_settings/core/browser",
"//components/crash/content/app",
"//components/crash/content/browser",
"//components/embedder_support",
"//components/find_in_page",
"//components/keyed_service/content",
"//components/metrics",
"//components/network_time",
"//components/omnibox/browser",
"//components/policy/core/browser",
"//components/pref_registry:pref_registry",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/security_interstitials/content:security_interstitial_page",
"//components/security_interstitials/content/renderer:security_interstitial_page_controller",
"//components/security_interstitials/core",
"//components/security_state/content",
"//components/sessions",
"//components/spellcheck:buildflags",
"//components/ssl_errors",
"//components/startup_metric_utils/browser",
"//components/user_prefs",
"//components/variations",
"//components/variations/service",
"//components/version_info",
"//components/web_cache/browser",
"//content:content_resources",
"//content:dev_ui_content_resources",
"//content/app/resources",
"//content/public/app:both",
"//content/public/browser",
"//content/public/child",
"//content/public/common",
"//content/public/common:service_names",
"//content/public/renderer",
"//content/public/utility",
"//net",
"//net:net_resources",
"//sandbox",
"//services/network/public/mojom",
"//services/preferences/tracked",
"//services/service_manager/embedder:embedder_result_codes",
"//skia",
"//third_party/blink/public/common",
"//third_party/blink/public/strings",
"//third_party/icu",
"//ui/base",
"//ui/base/clipboard",
"//ui/base/ime/init",
"//ui/display",
"//ui/events:events_base",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/ipc",
"//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia",
"//ui/gl",
"//ui/platform_window",
"//ui/shell_dialogs",
"//ui/webui",
"//url",
"//v8",
"//weblayer:resources",
"//weblayer/browser/webui:mojo_bindings",
]
if (enable_captive_portal_detection) {
deps += [ "//components/captive_portal/content" ]
}
if (use_browser_spellchecker) {
deps += [
"//components/spellcheck/browser",
"//components/spellcheck/renderer",
]
}
if (is_android) {
sources += [
"common/crash_reporter/crash_keys.cc",
"common/crash_reporter/crash_keys.h",
"common/crash_reporter/crash_reporter_client.cc",
"common/crash_reporter/crash_reporter_client.h",
]
deps += [
"//android_webview:generate_aw_resources",
"//android_webview:generate_aw_strings",
"//components/android_system_error_page",
"//components/autofill/android:provider",
"//components/crash/android:crashpad_main",
"//components/embedder_support/android:context_menu",
"//components/embedder_support/android/metrics",
"//components/javascript_dialogs",
"//components/metrics",
"//components/minidump_uploader",
"//components/safe_browsing/content/common:interfaces",
"//components/safe_browsing/content/renderer:throttles",
"//components/safe_browsing/core/common",
"//components/version_info/android:channel_getter",
"//weblayer/browser/safe_browsing:safe_browsing",
]
}
if (enable_vulkan) {
deps += [ "//gpu/vulkan/init" ]
}
if (mojo_media_host == "browser") {
deps += [ "//media/mojo/services" ]
}
if (is_win) {
deps += [ "//content:sandbox_helper_win" ]
if (win_console_app) {
defines = [ "WIN_CONSOLE_APP" ]
}
}
if (is_linux) {
deps += [
"//build/config/freetype",
"//third_party/fontconfig",
]
}
if (is_android) {
deps += [
"//components/embedder_support/android:web_contents_delegate",
"//services/resource_coordinator/public/cpp/memory_instrumentation:browser",
"//ui/android",
"//weblayer/browser/java:jni",
]
sources += [
"app/jni_onload.cc",
"app/jni_onload.h",
"browser/content_view_render_view.cc",
"browser/content_view_render_view.h",
"browser/download_callback_proxy.cc",
"browser/download_callback_proxy.h",
"browser/error_page_callback_proxy.cc",
"browser/error_page_callback_proxy.h",
"browser/fullscreen_callback_proxy.cc",
"browser/fullscreen_callback_proxy.h",
"browser/new_tab_callback_proxy.cc",
"browser/new_tab_callback_proxy.h",
"browser/tab_callback_proxy.cc",
"browser/tab_callback_proxy.h",
"browser/top_controls_container_view.cc",
"browser/top_controls_container_view.h",
]
}
if (!is_android) {
deps += [ "//ui/views/controls/webview" ]
}
if (toolkit_views) {
deps += [ "//ui/views" ]
}
if (use_aura) {
deps += [
"//ui/aura",
"//ui/events",
"//ui/strings",
"//ui/wm",
]
}
}
grit("resources") {
source = "weblayer_resources.grd"
source_is_generated = true
outputs = [
"grit/weblayer_resources.h",
"weblayer_resources.pak",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [ "//weblayer/browser/webui:mojo_bindings_js" ]
}
# TODO(jam): move weblayer_shell_resources_grit and copy_shell_resources here in
# a way that's shareable?
if (is_android) {
shared_library("libweblayer") {
sources = [ "app/entry_point.cc" ]
deps = [
":weblayer_lib",
"//base",
"//content/public/app:both",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
}
}