# Copyright 2015 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/android/config.gni") import("//build/config/android/rules.gni") import("//build/config/locales.gni") import("//tools/grit/repack.gni") import("system_webview_apk_tmpl.gni") import("webview_repack_locales.gni") declare_args() { # Package name of the system_webview_apk target. system_webview_package_name = "com.android.webview" } if (!defined(use_webview_internal_framework)) { use_webview_internal_framework = false } group("android_webview") { if (!use_webview_internal_framework) { deps = [ ":system_webview_apk", ] } } jinja_template("system_webview_manifest") { input = "apk/java/AndroidManifest.xml" output = "$target_gen_dir/system_webview_manifest/AndroidManifest.xml" variables = [ "package=$system_webview_package_name" ] } webview_repack_locales("repack_locales") { input_locales = locales output_locales = locales } locale_pak_resources("locale_paks") { sources = [ "$root_out_dir/android_webview/locales/am.pak", "$root_out_dir/android_webview/locales/ar.pak", "$root_out_dir/android_webview/locales/bg.pak", "$root_out_dir/android_webview/locales/bn.pak", "$root_out_dir/android_webview/locales/ca.pak", "$root_out_dir/android_webview/locales/cs.pak", "$root_out_dir/android_webview/locales/da.pak", "$root_out_dir/android_webview/locales/de.pak", "$root_out_dir/android_webview/locales/el.pak", "$root_out_dir/android_webview/locales/en-GB.pak", "$root_out_dir/android_webview/locales/en-US.pak", "$root_out_dir/android_webview/locales/es-419.pak", "$root_out_dir/android_webview/locales/es.pak", "$root_out_dir/android_webview/locales/et.pak", "$root_out_dir/android_webview/locales/fa.pak", "$root_out_dir/android_webview/locales/fi.pak", "$root_out_dir/android_webview/locales/fil.pak", "$root_out_dir/android_webview/locales/fr.pak", "$root_out_dir/android_webview/locales/gu.pak", "$root_out_dir/android_webview/locales/he.pak", "$root_out_dir/android_webview/locales/hi.pak", "$root_out_dir/android_webview/locales/hr.pak", "$root_out_dir/android_webview/locales/hu.pak", "$root_out_dir/android_webview/locales/id.pak", "$root_out_dir/android_webview/locales/it.pak", "$root_out_dir/android_webview/locales/ja.pak", "$root_out_dir/android_webview/locales/kn.pak", "$root_out_dir/android_webview/locales/ko.pak", "$root_out_dir/android_webview/locales/lt.pak", "$root_out_dir/android_webview/locales/lv.pak", "$root_out_dir/android_webview/locales/ml.pak", "$root_out_dir/android_webview/locales/mr.pak", "$root_out_dir/android_webview/locales/ms.pak", "$root_out_dir/android_webview/locales/nb.pak", "$root_out_dir/android_webview/locales/nl.pak", "$root_out_dir/android_webview/locales/pl.pak", "$root_out_dir/android_webview/locales/pt-BR.pak", "$root_out_dir/android_webview/locales/pt-PT.pak", "$root_out_dir/android_webview/locales/ro.pak", "$root_out_dir/android_webview/locales/ru.pak", "$root_out_dir/android_webview/locales/sk.pak", "$root_out_dir/android_webview/locales/sl.pak", "$root_out_dir/android_webview/locales/sr.pak", "$root_out_dir/android_webview/locales/sv.pak", "$root_out_dir/android_webview/locales/sw.pak", "$root_out_dir/android_webview/locales/ta.pak", "$root_out_dir/android_webview/locales/te.pak", "$root_out_dir/android_webview/locales/th.pak", "$root_out_dir/android_webview/locales/tr.pak", "$root_out_dir/android_webview/locales/uk.pak", "$root_out_dir/android_webview/locales/vi.pak", "$root_out_dir/android_webview/locales/zh-CN.pak", "$root_out_dir/android_webview/locales/zh-TW.pak", ] deps = [ ":repack_locales", ] } repack("repack_pack") { sources = [ "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak", "$root_gen_dir/blink/public/resources/blink_resources.pak", "$root_gen_dir/content/app/resources/content_resources_100_percent.pak", "$root_gen_dir/content/content_resources.pak", "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/ui/resources/ui_resources_100_percent.pak", "$target_gen_dir/aw_resources.pak", ] deps = [ ":generate_aw_resources", "//content:resources", "//content/app/resources", "//net:net_resources", "//third_party/WebKit/public:image_resources", "//third_party/WebKit/public:resources", "//ui/resources", ] output = "$target_gen_dir/webviewchromium.pak" } webview_license_path = "$target_gen_dir/webview_licenses.notice" android_assets("pak_file_assets") { sources = [ "$target_gen_dir/webviewchromium.pak", ] deps = [ ":repack_pack", ] disable_compression = true } android_assets("assets") { sources = [ webview_license_path, ] deps = [ ":generate_webview_license_notice", ":pak_file_assets", "//third_party/icu:icu_assets", "//v8:v8_external_startup_data_assets", ] } action("generate_webview_license_notice") { script = "tools/webview_licenses.py" inputs = exec_script("//android_webview/tools/webview_licenses.py", [ "gn_notice_deps" ], "value") inputs += [ "tools/licenses_notice.tmpl" ] outputs = [ webview_license_path, ] args = [ "notice", rebase_path(webview_license_path), ] } android_resources("system_webview_resources") { resource_dirs = [ "apk/java/res" ] custom_package = system_webview_package_name } android_resources("resources") { resource_dirs = [ "java/res" ] custom_package = "org.chromium.android_webview" deps = [ ":locale_paks", ":strings_grd", ] } grit("generate_aw_resources") { source = "ui/aw_resources.grd" outputs = [ "grit/aw_resources.h", "aw_resources.pak", ] } grit("generate_aw_strings") { source = "ui/aw_strings.grd" outputs = [ "grit/aw_strings.h", "aw_strings_am.pak", "aw_strings_ar.pak", "aw_strings_bg.pak", "aw_strings_bn.pak", "aw_strings_ca.pak", "aw_strings_cs.pak", "aw_strings_da.pak", "aw_strings_de.pak", "aw_strings_el.pak", "aw_strings_en-US.pak", "aw_strings_en-GB.pak", "aw_strings_es.pak", "aw_strings_es-419.pak", "aw_strings_et.pak", "aw_strings_fa.pak", "aw_strings_fi.pak", "aw_strings_fil.pak", "aw_strings_fr.pak", "aw_strings_gu.pak", "aw_strings_he.pak", "aw_strings_hi.pak", "aw_strings_hr.pak", "aw_strings_hu.pak", "aw_strings_id.pak", "aw_strings_it.pak", "aw_strings_ja.pak", "aw_strings_kn.pak", "aw_strings_ko.pak", "aw_strings_lt.pak", "aw_strings_lv.pak", "aw_strings_ml.pak", "aw_strings_mr.pak", "aw_strings_ms.pak", "aw_strings_nl.pak", "aw_strings_nb.pak", "aw_strings_pl.pak", "aw_strings_pt-BR.pak", "aw_strings_pt-PT.pak", "aw_strings_ro.pak", "aw_strings_ru.pak", "aw_strings_sk.pak", "aw_strings_sl.pak", "aw_strings_sr.pak", "aw_strings_sv.pak", "aw_strings_sw.pak", "aw_strings_ta.pak", "aw_strings_te.pak", "aw_strings_th.pak", "aw_strings_tr.pak", "aw_strings_uk.pak", "aw_strings_vi.pak", "aw_strings_zh-CN.pak", "aw_strings_zh-TW.pak", ] } grit("generate_components_strings") { source = "../components/components_strings.grd" # components_strings contains strings from all components. WebView # will never display most of them, so we try to limit the included # strings whitelist = rebase_path("ui/grit_components_whitelist.txt") inputs = [ whitelist, ] grit_flags = [ "-w", whitelist, ] outputs = [ "grit/components_strings.h", "components_strings_am.pak", "components_strings_ar.pak", "components_strings_bg.pak", "components_strings_bn.pak", "components_strings_ca.pak", "components_strings_cs.pak", "components_strings_da.pak", "components_strings_de.pak", "components_strings_el.pak", "components_strings_en-GB.pak", "components_strings_en-US.pak", "components_strings_es.pak", "components_strings_es-419.pak", "components_strings_et.pak", "components_strings_fa.pak", "components_strings_fake-bidi.pak", "components_strings_fi.pak", "components_strings_fil.pak", "components_strings_fr.pak", "components_strings_gu.pak", "components_strings_he.pak", "components_strings_hi.pak", "components_strings_hr.pak", "components_strings_hu.pak", "components_strings_id.pak", "components_strings_it.pak", "components_strings_ja.pak", "components_strings_kn.pak", "components_strings_ko.pak", "components_strings_lt.pak", "components_strings_lv.pak", "components_strings_ml.pak", "components_strings_mr.pak", "components_strings_ms.pak", "components_strings_nl.pak", "components_strings_nb.pak", "components_strings_pl.pak", "components_strings_pt-BR.pak", "components_strings_pt-PT.pak", "components_strings_ro.pak", "components_strings_ru.pak", "components_strings_sk.pak", "components_strings_sl.pak", "components_strings_sr.pak", "components_strings_sv.pak", "components_strings_sw.pak", "components_strings_ta.pak", "components_strings_te.pak", "components_strings_th.pak", "components_strings_tr.pak", "components_strings_uk.pak", "components_strings_vi.pak", "components_strings_zh-CN.pak", "components_strings_zh-TW.pak", "java/res/values-am/components_strings.xml", "java/res/values-ar/components_strings.xml", "java/res/values-bg/components_strings.xml", "java/res/values-ca/components_strings.xml", "java/res/values-cs/components_strings.xml", "java/res/values-da/components_strings.xml", "java/res/values-de/components_strings.xml", "java/res/values-el/components_strings.xml", "java/res/values-en-rGB/components_strings.xml", "java/res/values-es-rUS/components_strings.xml", "java/res/values-es/components_strings.xml", "java/res/values-fa/components_strings.xml", "java/res/values-fi/components_strings.xml", "java/res/values-fr/components_strings.xml", "java/res/values-hi/components_strings.xml", "java/res/values-hr/components_strings.xml", "java/res/values-hu/components_strings.xml", "java/res/values-in/components_strings.xml", "java/res/values-it/components_strings.xml", "java/res/values-iw/components_strings.xml", "java/res/values-ja/components_strings.xml", "java/res/values-ko/components_strings.xml", "java/res/values-lt/components_strings.xml", "java/res/values-lv/components_strings.xml", "java/res/values-nb/components_strings.xml", "java/res/values-nl/components_strings.xml", "java/res/values-pl/components_strings.xml", "java/res/values-pt-rBR/components_strings.xml", "java/res/values-pt-rPT/components_strings.xml", "java/res/values-ro/components_strings.xml", "java/res/values-ru/components_strings.xml", "java/res/values-sk/components_strings.xml", "java/res/values-sl/components_strings.xml", "java/res/values-sr/components_strings.xml", "java/res/values-sv/components_strings.xml", "java/res/values-sw/components_strings.xml", "java/res/values-th/components_strings.xml", "java/res/values-tl/components_strings.xml", "java/res/values-tr/components_strings.xml", "java/res/values-uk/components_strings.xml", "java/res/values-vi/components_strings.xml", "java/res/values-zh-rCN/components_strings.xml", "java/res/values-zh-rTW/components_strings.xml", "java/res/values/components_strings.xml", ] } shared_library("libwebviewchromium") { deps = [ ":common", ] sources = [ "lib/main/webview_entry_point.cc", ] configs -= [ "//build/config/android:hide_native_jni_exports" ] } source_set("common") { sources = [ "browser/aw_browser_context.cc", "browser/aw_browser_context.h", "browser/aw_browser_main_parts.cc", "browser/aw_browser_main_parts.h", "browser/aw_browser_permission_request_delegate.h", "browser/aw_browser_policy_connector.cc", "browser/aw_browser_policy_connector.h", "browser/aw_content_browser_client.cc", "browser/aw_content_browser_client.h", "browser/aw_contents_client_bridge_base.cc", "browser/aw_contents_client_bridge_base.h", "browser/aw_contents_io_thread_client.h", "browser/aw_cookie_access_policy.cc", "browser/aw_cookie_access_policy.h", "browser/aw_dev_tools_discovery_provider.cc", "browser/aw_dev_tools_discovery_provider.h", "browser/aw_download_manager_delegate.cc", "browser/aw_download_manager_delegate.h", "browser/aw_form_database_service.cc", "browser/aw_form_database_service.h", "browser/aw_gl_surface.cc", "browser/aw_gl_surface.h", "browser/aw_http_auth_handler_base.cc", "browser/aw_http_auth_handler_base.h", "browser/aw_javascript_dialog_manager.cc", "browser/aw_javascript_dialog_manager.h", "browser/aw_locale_manager.h", "browser/aw_login_delegate.cc", "browser/aw_login_delegate.h", "browser/aw_media_client_android.cc", "browser/aw_media_client_android.h", "browser/aw_message_port_message_filter.cc", "browser/aw_message_port_message_filter.h", "browser/aw_message_port_service.h", "browser/aw_metrics_service_client.cc", "browser/aw_metrics_service_client.h", "browser/aw_permission_manager.cc", "browser/aw_permission_manager.h", "browser/aw_pref_store.cc", "browser/aw_pref_store.h", "browser/aw_print_manager.cc", "browser/aw_print_manager.h", "browser/aw_printing_message_filter.cc", "browser/aw_printing_message_filter.h", "browser/aw_quota_manager_bridge.cc", "browser/aw_quota_manager_bridge.h", "browser/aw_quota_permission_context.cc", "browser/aw_quota_permission_context.h", "browser/aw_render_thread_context_provider.cc", "browser/aw_render_thread_context_provider.h", "browser/aw_resource_context.cc", "browser/aw_resource_context.h", "browser/aw_result_codes.h", "browser/aw_ssl_host_state_delegate.cc", "browser/aw_ssl_host_state_delegate.h", "browser/aw_web_preferences_populater.cc", "browser/aw_web_preferences_populater.h", "browser/browser_view_renderer.cc", "browser/browser_view_renderer.h", "browser/browser_view_renderer_client.h", "browser/child_frame.cc", "browser/child_frame.h", "browser/deferred_gpu_command_service.cc", "browser/deferred_gpu_command_service.h", "browser/find_helper.cc", "browser/find_helper.h", "browser/gl_view_renderer_manager.cc", "browser/gl_view_renderer_manager.h", "browser/hardware_renderer.cc", "browser/hardware_renderer.h", "browser/icon_helper.cc", "browser/icon_helper.h", "browser/input_stream.h", "browser/jni_dependency_factory.h", "browser/net/android_stream_reader_url_request_job.cc", "browser/net/android_stream_reader_url_request_job.h", "browser/net/aw_cookie_store_wrapper.cc", "browser/net/aw_cookie_store_wrapper.h", "browser/net/aw_http_user_agent_settings.cc", "browser/net/aw_http_user_agent_settings.h", "browser/net/aw_network_delegate.cc", "browser/net/aw_network_delegate.h", "browser/net/aw_request_interceptor.cc", "browser/net/aw_request_interceptor.h", "browser/net/aw_url_request_context_getter.cc", "browser/net/aw_url_request_context_getter.h", "browser/net/aw_url_request_job_factory.cc", "browser/net/aw_url_request_job_factory.h", "browser/net/aw_web_resource_response.h", "browser/net/init_native_callback.h", "browser/net/input_stream_reader.cc", "browser/net/input_stream_reader.h", "browser/net/token_binding_manager.cc", "browser/net/token_binding_manager.h", "browser/net_disk_cache_remover.cc", "browser/net_disk_cache_remover.h", "browser/parent_compositor_draw_constraints.cc", "browser/parent_compositor_draw_constraints.h", "browser/parent_output_surface.cc", "browser/parent_output_surface.h", "browser/renderer_host/aw_render_view_host_ext.cc", "browser/renderer_host/aw_render_view_host_ext.h", "browser/renderer_host/aw_resource_dispatcher_host_delegate.cc", "browser/renderer_host/aw_resource_dispatcher_host_delegate.h", "browser/scoped_allow_wait_for_legacy_web_view_api.h", "browser/scoped_app_gl_state_restore.cc", "browser/scoped_app_gl_state_restore.h", "browser/shared_renderer_state.cc", "browser/shared_renderer_state.h", "common/android_webview_message_generator.cc", "common/android_webview_message_generator.h", "common/aw_content_client.cc", "common/aw_content_client.h", "common/aw_descriptors.h", "common/aw_hit_test_data.cc", "common/aw_hit_test_data.h", "common/aw_message_port_messages.h", "common/aw_resource.h", "common/aw_switches.cc", "common/aw_switches.h", "common/devtools_instrumentation.h", "common/render_view_messages.cc", "common/render_view_messages.h", "common/url_constants.cc", "common/url_constants.h", "crash_reporter/aw_microdump_crash_reporter.cc", "crash_reporter/aw_microdump_crash_reporter.h", "lib/aw_browser_dependency_factory_impl.cc", "lib/aw_browser_dependency_factory_impl.h", "lib/main/aw_main_delegate.cc", "lib/main/aw_main_delegate.h", "lib/main/webview_jni_onload.cc", "lib/main/webview_jni_onload.h", "public/browser/draw_gl.h", "renderer/aw_content_renderer_client.cc", "renderer/aw_content_renderer_client.h", "renderer/aw_content_settings_client.cc", "renderer/aw_content_settings_client.h", "renderer/aw_key_systems.cc", "renderer/aw_key_systems.h", "renderer/aw_message_port_client.cc", "renderer/aw_message_port_client.h", "renderer/aw_print_web_view_helper_delegate.cc", "renderer/aw_print_web_view_helper_delegate.h", "renderer/aw_render_frame_ext.cc", "renderer/aw_render_frame_ext.h", "renderer/aw_render_process_observer.cc", "renderer/aw_render_process_observer.h", "renderer/aw_render_view_ext.cc", "renderer/aw_render_view_ext.h", "renderer/print_render_frame_observer.cc", "renderer/print_render_frame_observer.h", ] deps = [ ":generate_aw_resources", ":generate_aw_strings", ":generate_components_strings", "//android_webview/common:version", "//android_webview/native:native", "//cc/surfaces", "//components/auto_login_parser:auto_login_parser", "//components/autofill/content/renderer", "//components/cdm/browser", "//components/cdm/renderer", "//components/crash/content/app", "//components/crash/content/browser", "//components/data_reduction_proxy/core/browser", "//components/devtools_discovery", "//components/metrics", "//components/metrics:gpu", "//components/metrics:net", "//components/metrics:profiler", "//components/metrics:ui", "//components/navigation_interception", "//components/printing/browser", "//components/printing/common", "//components/printing/renderer", "//components/visitedlink/browser", "//components/visitedlink/renderer", "//components/web_contents_delegate_android:web_contents_delegate_android", "//content", "//content/public/app:both", "//content/public/browser", "//gin", "//gpu/blink", "//gpu/command_buffer/client:gl_in_process_context", "//gpu/command_buffer/client:gles2_c_lib", "//gpu/command_buffer/client:gles2_implementation", "//gpu/command_buffer/common:gles2_utils", "//gpu/command_buffer/service", "//gpu/skia_bindings", "//media", "//media/midi", "//net:extras", "//printing", "//skia", "//third_party/WebKit/public:blink", "//ui/events:gesture_detection", "//ui/gl", "//ui/shell_dialogs", "//v8", ] if (enable_configuration_policy) { deps += [ "//components/policy", "//components/policy:policy_component", ] } configs += [ "//v8:external_startup_data" ] } android_library("android_webview_java") { DEPRECATED_java_in_dir = "java/src" deps = [ ":resources", ":strings_grd", "//base:base_java", "//components/external_video_surface:java", "//components/navigation_interception/android:navigation_interception_java", "//components/web_contents_delegate_android:web_contents_delegate_android_java", "//content/public/android:content_java", "//net/android:net_java", "//ui/android:ui_java", ] if (enable_configuration_policy) { deps += [ "//components/policy/android:policy_java" ] } srcjar_deps = [ "//android_webview/native:aw_permission_request_resource" ] } java_strings_grd("strings_grd") { grd_file = "java/strings/android_webview_strings.grd" outputs = [ "values-am/android_webview_strings.xml", "values-ar/android_webview_strings.xml", "values-bg/android_webview_strings.xml", "values-ca/android_webview_strings.xml", "values-cs/android_webview_strings.xml", "values-da/android_webview_strings.xml", "values-de/android_webview_strings.xml", "values-el/android_webview_strings.xml", "values-en-rGB/android_webview_strings.xml", "values-es-rUS/android_webview_strings.xml", "values-es/android_webview_strings.xml", "values-fa/android_webview_strings.xml", "values-fi/android_webview_strings.xml", "values-fr/android_webview_strings.xml", "values-hi/android_webview_strings.xml", "values-hr/android_webview_strings.xml", "values-hu/android_webview_strings.xml", "values-in/android_webview_strings.xml", "values-it/android_webview_strings.xml", "values-iw/android_webview_strings.xml", "values-ja/android_webview_strings.xml", "values-ko/android_webview_strings.xml", "values-lt/android_webview_strings.xml", "values-lv/android_webview_strings.xml", "values-nb/android_webview_strings.xml", "values-nl/android_webview_strings.xml", "values-pl/android_webview_strings.xml", "values-pt-rBR/android_webview_strings.xml", "values-pt-rPT/android_webview_strings.xml", "values-ro/android_webview_strings.xml", "values-ru/android_webview_strings.xml", "values-sk/android_webview_strings.xml", "values-sl/android_webview_strings.xml", "values-sr/android_webview_strings.xml", "values-sv/android_webview_strings.xml", "values-sw/android_webview_strings.xml", "values-th/android_webview_strings.xml", "values-tl/android_webview_strings.xml", "values-tr/android_webview_strings.xml", "values-uk/android_webview_strings.xml", "values-vi/android_webview_strings.xml", "values-zh-rCN/android_webview_strings.xml", "values-zh-rTW/android_webview_strings.xml", "values/android_webview_strings.xml", ] } if (!use_webview_internal_framework) { system_webview_apk_tmpl("system_webview_apk") { android_manifest = get_target_outputs(":system_webview_manifest") android_manifest = android_manifest[1] android_manifest_dep = ":system_webview_manifest" deps = [ ":system_webview_resources", "//android_webview/glue", ] apk_name = "SystemWebView" } }