# Copyright 2018 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("//chrome/common/features.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") import("//tools/grit/preprocess_grit.gni") import("//tools/polymer/html_to_js.gni") import("//tools/polymer/polymer.gni") import("//ui/webui/resources/tools/generate_grd.gni") import("//ui/webui/resources/tools/js_modulizer.gni") import("//ui/webui/webui_features.gni") import("../optimize_webui.gni") import("settings.gni") preprocess_folder = "preprocessed" preprocess_manifest = "preprocessed_manifest.json" preprocess_gen_manifest = "preprocessed_gen_manifest.json" if (optimize_webui) { build_manifest = "build_manifest.json" optimize_webui("build") { host = "settings" input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) js_module_in_files = [ "settings.js", "lazy_load.js", ] js_out_files = [ "settings.rollup.js", "lazy_load.rollup.js", "shared.rollup.js", ] out_manifest = "$target_gen_dir/$build_manifest" deps = [ ":preprocess", ":preprocess_generated", "../../../../ui/webui/resources:preprocess", ] excludes = [ "chrome://resources/js/cr.m.js", "chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js", "chrome://resources/mojo/skia/public/mojom/skcolor.mojom-lite.js", ] } } generate_grd("build_grd") { grd_prefix = "settings" out_grd = "$target_gen_dir/${grd_prefix}_resources.grd" input_files = [ "images/cookies_banner_dark.svg", "images/cookies_banner.svg", "images/password_check_neutral_dark.svg", "images/password_check_neutral.svg", "images/password_check_positive_dark.svg", "images/password_check_positive.svg", "images/permissions_banner_dark.svg", "images/permissions_banner.svg", "images/safe_browsing_banner_dark.svg", "images/safe_browsing_banner.svg", "images/sync_banner_dark.svg", "images/sync_banner.svg", "settings.html", ] input_files_base_dir = rebase_path(".", "//") if (optimize_webui) { deps = [ ":build" ] manifest_files = [ "$target_gen_dir/$build_manifest" ] resource_path_rewrites = [ "settings.rollup.js|settings.js", "lazy_load.rollup.js|lazy_load.js", ] } else { deps = [ ":preprocess", ":preprocess_generated", ] manifest_files = [ "$target_gen_dir/$preprocess_manifest", "$target_gen_dir/$preprocess_gen_manifest", ] } } preprocess_grit("preprocess") { in_folder = "./" out_folder = "$target_gen_dir/$preprocess_folder" out_manifest = "$target_gen_dir/$preprocess_manifest" in_files = [ "a11y_page/captions_browser_proxy.js", "appearance_page/appearance_browser_proxy.js", "autofill_page/merge_exceptions_store_copies_behavior.js", "autofill_page/merge_passwords_store_copies_behavior.js", "autofill_page/multi_store_exception_entry.js", "autofill_page/multi_store_id_handler.js", "autofill_page/multi_store_password_ui_entry.js", "autofill_page/password_check_behavior.js", "autofill_page/password_manager_proxy.js", "autofill_page/show_password_behavior.js", "chrome_cleanup_page/chrome_cleanup_proxy.js", "clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js", "controls/settings_idle_load.js", "downloads_page/downloads_browser_proxy.js", "ensure_lazy_loaded.js", "hats_browser_proxy.js", "i18n_setup.js", "incompatible_applications_page/incompatible_applications_browser_proxy.js", "lazy_load.js", "metrics_browser_proxy.js", "on_startup_page/on_startup_browser_proxy.js", "on_startup_page/startup_urls_page_browser_proxy.js", "open_window_proxy.js", "page_visibility.js", "privacy_page/security_keys_browser_proxy.js", "reset_page/reset_browser_proxy.js", "route.js", "safety_check_page/safety_check_browser_proxy.js", "settings.js", "settings_page/main_page_behavior.js", "settings_routes.js", "site_settings/constants.js", "site_settings/cookie_info.js", "site_settings/local_data_browser_proxy.js", "site_settings/site_settings_behavior.js", "site_settings/site_settings_prefs_browser_proxy.js", "site_settings/website_usage_browser_proxy.js", ] if (is_chromeos) { in_files += [ "autofill_page/blocking_request_manager.js", "languages_page/languages_metrics_proxy.js", "site_settings/android_info_browser_proxy.js", ] } else { in_files += [ "default_browser_page/default_browser_browser_proxy.js", "people_page/import_data_browser_proxy.js", "people_page/manage_profile_browser_proxy.js", "system_page/system_page_browser_proxy.js", ] } } preprocess_grit("preprocess_generated") { deps = [ ":polymer3_elements" ] in_folder = target_gen_dir out_folder = "$target_gen_dir/$preprocess_folder" out_manifest = "$target_gen_dir/$preprocess_gen_manifest" in_files = [ "a11y_page/a11y_page.js", "a11y_page/captions_subpage.m.js", "about_page/about_page_browser_proxy.m.js", "about_page/about_page.js", "appearance_page/appearance_fonts_page.js", "appearance_page/appearance_page.js", "appearance_page/fonts_browser_proxy.m.js", "appearance_page/home_url_input.js", "autofill_page/autofill_page.js", "autofill_page/avatar_icon.js", "autofill_page/payments_list.js", "autofill_page/credit_card_list_entry.js", "autofill_page/upi_id_list_entry.js", "autofill_page/passwords_shared_css.js", "autofill_page/credit_card_edit_dialog.js", "autofill_page/autofill_section.js", "autofill_page/address_edit_dialog.js", "autofill_page/address_remove_confirmation_dialog.js", "autofill_page/password_check.js", "autofill_page/password_check_edit_dialog.js", "autofill_page/password_check_edit_disclaimer_dialog.js", "autofill_page/password_check_list_item.js", "autofill_page/password_list_item.js", "autofill_page/passwords_list_handler.js", "autofill_page/password_remove_confirmation_dialog.js", "autofill_page/passwords_section.js", "autofill_page/passwords_device_section.js", "autofill_page/password_edit_dialog.js", "autofill_page/password_move_to_account_dialog.js", "autofill_page/password_remove_dialog.js", "autofill_page/passwords_export_dialog.js", "autofill_page/payments_section.js", "basic_page/basic_page.js", "clear_browsing_data_dialog/clear_browsing_data_dialog.js", "clear_browsing_data_dialog/history_deletion_dialog.js", "clear_browsing_data_dialog/installed_app_checkbox.js", "clear_browsing_data_dialog/passwords_deletion_dialog.js", "controls/controlled_button.m.js", "controls/controlled_radio_button.m.js", "controls/extension_controlled_indicator.m.js", "controls/password_prompt_dialog.m.js", "controls/settings_boolean_control_behavior.m.js", "controls/settings_checkbox.js", "controls/settings_dropdown_menu.m.js", "controls/pref_control_behavior.m.js", "controls/settings_radio_group.m.js", "controls/settings_slider.m.js", "controls/settings_textarea.m.js", "controls/settings_toggle_button.m.js", "downloads_page/downloads_page.js", "extension_control_browser_proxy.m.js", "global_scroll_target_behavior.m.js", "icons.m.js", "languages_page/languages.m.js", "languages_page/languages_browser_proxy.m.js", "languages_page/add_languages_dialog.js", "languages_page/languages_page.js", "lifetime_browser_proxy.m.js", "settings_menu/settings_menu.js", "on_startup_page/on_startup_page.js", "on_startup_page/startup_url_dialog.js", "on_startup_page/startup_url_entry.js", "on_startup_page/startup_urls_page.js", "people_page/sync_account_control.m.js", "people_page/sync_browser_proxy.m.js", "people_page/sync_encryption_options.m.js", "people_page/people_page.js", "people_page/profile_info_browser_proxy.m.js", "people_page/signout_dialog.m.js", "people_page/sync_controls.m.js", "people_page/sync_page.m.js", "prefs/prefs.m.js", "prefs/prefs_behavior.m.js", "prefs/prefs_types.m.js", "prefs/pref_util.m.js", "privacy_page/collapse_radio_button.js", "privacy_page/cookies_page.js", "privacy_page/do_not_track_toggle.js", "privacy_page/privacy_page.js", "privacy_page/personalization_options.m.js", "privacy_page/privacy_page_browser_proxy.m.js", "privacy_page/secure_dns.js", "privacy_page/secure_dns_input.js", "privacy_page/security_page.js", "privacy_page/disable_safebrowsing_dialog.js", "privacy_page/security_keys_bio_enroll_dialog.js", "privacy_page/security_keys_credential_management_dialog.js", "privacy_page/security_keys_pin_field.js", "privacy_page/security_keys_reset_dialog.js", "privacy_page/security_keys_set_pin_dialog.js", "privacy_page/security_keys_subpage.js", "reset_page/reset_page.js", "reset_page/reset_profile_dialog.js", "reset_page/reset_profile_banner.js", "router.m.js", "safety_check_page/safety_check_child.js", "safety_check_page/safety_check_extensions_child.js", "safety_check_page/safety_check_page.js", "safety_check_page/safety_check_passwords_child.js", "safety_check_page/safety_check_safe_browsing_child.js", "safety_check_page/safety_check_updates_child.js", "search_engines_page/search_engines_browser_proxy.m.js", "search_engines_page/omnibox_extension_entry.js", "search_engines_page/search_engine_dialog.js", "search_engines_page/search_engine_entry_css.js", "search_engines_page/search_engine_entry.js", "search_engines_page/search_engines_list.js", "search_engines_page/search_engines_page.js", "search_page/search_page.js", "search_settings.m.js", "settings_main/settings_main.js", "settings_page/settings_animated_pages.m.js", "settings_page/settings_section.m.js", "settings_page/settings_subpage.m.js", "settings_ui/settings_ui.js", "setting_id_param_util.m.js", "settings_page_css.m.js", "settings_shared_css.m.js", "settings_vars_css.m.js", "site_favicon.js", "site_settings/add_site_dialog.js", "site_settings/all_sites.js", "site_settings/all_sites_icons.js", "site_settings/category_default_setting.js", "site_settings/category_setting_exceptions.js", "site_settings/chooser_exception_list.js", "site_settings/chooser_exception_list_entry.js", "site_settings/clear_storage_dialog_css.js", "site_settings/edit_exception_dialog.js", "site_settings/media_picker.js", "site_settings/pdf_documents.js", "site_settings/protocol_handlers.js", "site_settings/settings_category_default_radio_group.js", "site_settings/site_data.js", "site_settings/site_data_details_subpage.js", "site_settings/site_data_entry.js", "site_settings/site_details.js", "site_settings/site_details_permission.js", "site_settings/site_entry.js", "site_settings/site_list.js", "site_settings/site_list_entry.js", "site_settings/zoom_levels.js", "site_settings_page/recent_site_permissions.js", "site_settings_page/site_settings_list.js", "site_settings_page/site_settings_page.js", ] if (is_win) { in_files += [ "chrome_cleanup_page/chrome_cleanup_page.js", "chrome_cleanup_page/items_to_remove_list.js", "incompatible_applications_page/incompatible_applications_page.js", "incompatible_applications_page/incompatible_application_item.js", "safety_check_page/safety_check_chrome_cleaner_child.js", ] } if (!is_mac) { in_files += [ "languages_page/edit_dictionary_page.js" ] } if (is_chromeos) { in_files += [ "people_page/account_manager_browser_proxy.m.js" ] } else { in_files += [ "default_browser_page/default_browser_page.js", "people_page/import_data_dialog.js", "people_page/manage_profile.js", "system_page/system_page.js", ] } } grit("settings_resources") { defines = chrome_grit_defines # These arguments are needed since the grd is generated at build time. enable_input_discovery_for_gn_analyze = false source = "$target_gen_dir/settings_resources.grd" deps = [ ":build_grd" ] outputs = [ "grit/settings_resources.h", "grit/settings_resources_map.cc", "grit/settings_resources_map.h", "settings_resources.pak", ] output_dir = "$root_gen_dir/chrome" } group("closure_compile") { deps = [ ":local_resources", "a11y_page:closure_compile", "about_page:closure_compile", "appearance_page:closure_compile", "controls:closure_compile", "languages_page:closure_compile", "people_page:closure_compile", "prefs:closure_compile", "privacy_page:closure_compile", "search_engines_page:closure_compile", "settings_page:closure_compile", ] if (is_chromeos) { deps += [ "../../../test/data/webui/settings/chromeos:closure_compile", "chromeos:closure_compile", ] } } js_type_check("local_resources") { deps = [ ":extension_control_browser_proxy", ":global_scroll_target_behavior", ":lifetime_browser_proxy", ":router", ":search_settings", ":setting_id_param_util", ] } js_library("extension_control_browser_proxy") { deps = [ "//ui/webui/resources/js:assert", "//ui/webui/resources/js:cr", ] externs_list = [ "$externs_path/chrome_send.js" ] } js_library("global_scroll_target_behavior") { deps = [ ":router", "//ui/webui/resources/js:cr", ] } js_library("lifetime_browser_proxy") { deps = [ "//ui/webui/resources/js:cr" ] externs_list = [ "$externs_path/chrome_send.js" ] } js_library("router") { deps = [ "//ui/webui/resources/js:cr", "//ui/webui/resources/js:load_time_data", ] externs_list = [ "$externs_path/metrics_private.js" ] } js_library("search_settings") { deps = [ "//ui/webui/resources/js:assert", "//ui/webui/resources/js:cr", "//ui/webui/resources/js:search_highlight_utils", "//ui/webui/resources/js:util", ] externs_list = [ "$externs_path/pending_polymer.js" ] } js_library("setting_id_param_util") { deps = [ ":router", "//ui/webui/resources/js:load_time_data", ] } # Polymer 3 related rules. group("closure_compile_module") { deps = [ ":closure_compile_local_module", "a11y_page:closure_compile_module", "about_page:closure_compile_module", "appearance_page:closure_compile_module", "autofill_page:closure_compile_module", "basic_page:closure_compile_module", "clear_browsing_data_dialog:closure_compile_module", "controls:closure_compile_module", "downloads_page:closure_compile_module", "languages_page:closure_compile_module", "on_startup_page:closure_compile_module", "people_page:closure_compile_module", "prefs:closure_compile_module", "privacy_page:closure_compile_module", "reset_page:closure_compile_module", "safety_check_page:closure_compile_module", "search_engines_page:closure_compile_module", "search_page:closure_compile_module", "settings_main:closure_compile_module", "settings_menu:closure_compile_module", "settings_page:closure_compile_module", "settings_ui:closure_compile_module", "site_settings:closure_compile_module", "site_settings_page:closure_compile_module", ] if (!is_chromeos) { deps += [ "default_browser_page:closure_compile_module", "system_page:closure_compile_module", ] } if (is_win) { deps += [ "chrome_cleanup_page:closure_compile_module", "incompatible_applications_page:closure_compile_module", ] } if (is_chromeos) { deps += [ "chromeos:closure_compile_module" ] } } js_type_check("closure_compile_local_module") { is_polymer3 = true closure_flags = settings_closure_flags deps = [ ":extension_control_browser_proxy.m", ":global_scroll_target_behavior.m", ":hats_browser_proxy", ":i18n_setup", ":lazy_load", ":lifetime_browser_proxy.m", ":metrics_browser_proxy", ":open_window_proxy", ":page_visibility", ":route", ":router.m", ":search_settings.m", ":setting_id_param_util.m", ":settings", ":settings_routes", ":site_favicon", ] } js_library("settings") { deps = [ ":hats_browser_proxy", ":lifetime_browser_proxy.m", ":metrics_browser_proxy", ":open_window_proxy", "about_page:about_page_browser_proxy.m", "autofill_page:multi_store_exception_entry", "autofill_page:multi_store_password_ui_entry", "autofill_page:password_manager_proxy", "people_page:sync_browser_proxy.m", "privacy_page:privacy_page_browser_proxy.m", "safety_check_page:safety_check_browser_proxy", "search_engines_page:search_engines_browser_proxy.m", "settings_ui:settings_ui", ] } js_library("extension_control_browser_proxy.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/extension_control_browser_proxy.m.js" ] deps = [ "//ui/webui/resources/js:cr.m" ] extra_deps = [ ":modulize" ] externs_list = [ "$externs_path/chrome_send.js" ] } js_library("i18n_setup") { deps = [ "//ui/webui/resources/js:load_time_data.m" ] } js_library("global_scroll_target_behavior.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/global_scroll_target_behavior.m.js" ] deps = [ ":router.m", "//ui/webui/resources/js:promise_resolver.m", ] extra_deps = [ ":modulize" ] } js_library("hats_browser_proxy") { deps = [ "//ui/webui/resources/js:cr.m" ] } js_library("lazy_load") { deps = [ "autofill_page:autofill_section", "autofill_page:payments_section", "chrome_cleanup_page:chrome_cleanup_proxy", "clear_browsing_data_dialog:clear_browsing_data_browser_proxy", "languages_page:languages_browser_proxy.m", "languages_page:languages_metrics_proxy", "languages_page:languages_page", "privacy_page:cookies_page", "privacy_page:security_page", "site_settings:category_setting_exceptions", "site_settings:local_data_browser_proxy", "site_settings:protocol_handlers", "site_settings:settings_category_default_radio_group", "site_settings:site_settings_prefs_browser_proxy", "site_settings_page", ] } js_library("lifetime_browser_proxy.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/lifetime_browser_proxy.m.js" ] deps = [ "//ui/webui/resources/js:cr.m" ] extra_deps = [ ":modulize" ] } js_library("metrics_browser_proxy") { deps = [ "//ui/webui/resources/js:cr.m" ] } js_library("open_window_proxy") { deps = [ "//ui/webui/resources/js:cr.m" ] } js_library("page_visibility") { deps = [ "//ui/webui/resources/js:load_time_data.m" ] } js_library("route") { deps = [ ":page_visibility", ":router.m", ":settings_routes", "//ui/webui/resources/js:load_time_data.m", ] } js_library("router.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/router.m.js" ] deps = [ "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:load_time_data.m", ] extra_deps = [ ":modulize" ] externs_list = [ "$externs_path/metrics_private.js" ] } js_library("search_settings.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/search_settings.m.js" ] deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:promise_resolver.m", "//ui/webui/resources/js:search_highlight_utils.m", "//ui/webui/resources/js:util.m", ] extra_deps = [ ":modulize" ] } js_library("setting_id_param_util.m") { sources = [ "$root_gen_dir/chrome/browser/resources/settings/setting_id_param_util.m.js" ] deps = [ ":router.m", "//ui/webui/resources/js:load_time_data.m", ] extra_deps = [ ":modulize" ] } js_library("settings_routes") { deps = [ ":router.m" ] } js_library("site_favicon") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:icon.m", ] } group("polymer3_elements") { public_deps = [ # Sub-folder targets "a11y_page:polymer3_elements", "about_page:web_components", "appearance_page:web_components", "autofill_page:web_components", "basic_page:web_components", "clear_browsing_data_dialog:web_components", "controls:polymer3_elements", "downloads_page:web_components", "languages_page:polymer3_elements", "on_startup_page:web_components", "people_page:polymer3_elements", "prefs:polymer3_elements", "privacy_page:polymer3_elements", "reset_page:web_components", "safety_check_page:web_components", "search_engines_page:web_components", "search_page:web_components", "settings_main:web_components", "settings_menu:web_components", "settings_page:polymer3_elements", "settings_ui:web_components", "site_settings:web_components", "site_settings_page:web_components", # Local targets ":icons_module", ":modulize", ":settings_page_css_module", ":settings_shared_css_module", ":settings_vars_css_module", ":web_components_local", ] if (!is_chromeos) { public_deps += [ "default_browser_page:web_components", "system_page:web_components", ] } if (is_win) { public_deps += [ "chrome_cleanup_page:web_components", "incompatible_applications_page:web_components", ] } } polymer_modulizer("icons") { js_file = "icons.m.js" html_file = "icons.html" html_type = "iron-iconset" } polymer_modulizer("settings_page_css") { js_file = "settings_page_css.m.js" html_file = "settings_page_css.html" html_type = "style-module" } polymer_modulizer("settings_shared_css") { js_file = "settings_shared_css.m.js" html_file = "settings_shared_css.html" html_type = "style-module" } polymer_modulizer("settings_vars_css") { js_file = "settings_vars_css.m.js" html_file = "settings_vars_css.html" html_type = "custom-style" } html_to_js("web_components_local") { js_files = [ "site_favicon.js" ] } js_modulizer("modulize") { input_files = [ "extension_control_browser_proxy.js", "global_scroll_target_behavior.js", "lifetime_browser_proxy.js", "router.js", "search_settings.js", "setting_id_param_util.js", ] namespace_rewrites = settings_namespace_rewrites + [ "cr.search_highlight_utils.createEmptySearchBubble|createEmptySearchBubble", "cr.search_highlight_utils.findAndRemoveHighlights|findAndRemoveHighlights", "cr.search_highlight_utils.highlight|highlight", "cr.search_highlight_utils.removeHighlights|removeHighlights", "cr.search_highlight_utils.stripDiacritics|stripDiacritics", "Polymer.DomIf|DomIf", ] }