chromium/chrome/browser/resources/password_manager/BUILD.gn

# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//ui/webui/resources/tools/build_webui.gni")

build_webui("build") {
  grd_prefix = "password_manager"
  static_files = [
    "images/checkup_result_banner_compromised.svg",
    "images/checkup_result_banner_compromised_dark.svg",
    "images/checkup_result_banner_error.svg",
    "images/checkup_result_banner_error_dark.svg",
    "images/checkup_result_banner_ok.svg",
    "images/checkup_result_banner_ok_dark.svg",
    "images/checkup_result_banner_running.svg",
    "images/checkup_result_banner_running_dark.svg",
    "images/password_manager_logo.svg",
    "images/password_sharing_family_banner.svg",
    "images/password_sharing_family_banner_dark.svg",
    "images/password_sharing_secure_lock.svg",
    "images/password_sharing_progress_bar.svg",
    "password_manager.html",
  ]
  if (is_chrome_branded) {
    static_files += [
      "chrome_branded_manifest.webmanifest",
      "images/access_on_any_device_promo.svg",
      "images/access_on_any_device_promo_dark.svg",
      "images/password_checkup_promo.svg",
      "images/password_checkup_promo_dark.svg",
      "images/password_shortcut_promo.svg",
      "images/password_shortcut_promo_dark.svg",
      "images/passwords_on_web_promo.svg",
      "images/passwords_on_web_promo_dark.svg",
      "images/relaunch_chrome_promo.svg",
      "images/relaunch_chrome_promo_dark.svg",
      "images/move_passwords_promo.svg",
      "images/move_passwords_promo_dark.svg",
    ]
  } else {
    static_files += [
      "manifest.webmanifest",
      "images/relaunch_chrome_promo_non_branded.svg",
      "images/relaunch_chrome_promo_dark_non_branded.svg",
    ]
  }

  if (is_mac || is_win) {
    if (is_chrome_branded) {
      static_files += [
        "images/screenlock_reauth_promo.svg",
        "images/screenlock_reauth_promo_dark.svg",
      ]
    } else {
      static_files += [
        "images/screenlock_reauth_promo_non_branded.svg",
        "images/screenlock_reauth_promo_dark_non_branded.svg",
      ]
    }
  }

  web_component_files = [
    "checkup_section.ts",
    "checkup_details_section.ts",
    "checkup_list_item.ts",
    "dialogs/add_password_dialog.ts",
    "dialogs/auth_timed_out_dialog.ts",
    "dialogs/delete_password_disclaimer_dialog.ts",
    "dialogs/delete_passkey_dialog.ts",
    "dialogs/disconnect_cloud_authenticator_dialog.ts",
    "dialogs/edit_passkey_dialog.ts",
    "dialogs/edit_password_dialog.ts",
    "dialogs/edit_password_disclaimer_dialog.ts",
    "dialogs/multi_store_delete_password_dialog.ts",
    "dialogs/move_passwords_dialog.ts",
    "dialogs/move_single_password_dialog.ts",
    "dialogs/password_preview_item.ts",
    "full_data_reset.ts",
    "credential_details/credential_note.ts",
    "credential_details/credential_field.ts",
    "credential_details/passkey_details_card.ts",
    "credential_details/password_details_card.ts",
    "password_details_section.ts",
    "password_list_item.ts",
    "password_manager_app.ts",
    "passwords_exporter.ts",
    "passwords_importer.ts",
    "passwords_section.ts",
    "prefs/pref_toggle_button.ts",
    "settings_section.ts",
    "sharing/share_password_flow.ts",
    "sharing/share_password_dialog_header.ts",
    "sharing/share_password_group_avatar.ts",
    "sharing/share_password_recipient.ts",
    "sharing/share_password_family_picker_dialog.ts",
    "sharing/share_password_loading_dialog.ts",
    "sharing/share_password_error_dialog.ts",
    "sharing/share_password_no_other_family_members_dialog.ts",
    "sharing/share_password_not_family_member_dialog.ts",
    "sharing/share_password_confirmation_dialog.ts",
    "side_bar.ts",
    "site_favicon.ts",
    "toolbar.ts",
    "promo_cards/promo_card.ts",
  ]

  non_web_component_files = [
    "password_manager.ts",
    "passkeys_browser_proxy.ts",
    "password_manager_proxy.ts",
    "focus_config.ts",
    "router.ts",
    "searchable_label.ts",
    "show_password_mixin.ts",
    "sync_browser_proxy.ts",
    "user_utils_mixin.ts",
    "promo_cards/promo_cards_browser_proxy.ts",
    "sharing/metrics_utils.ts",
  ]

  # Files that are passed as input to css_to_wrapper().
  css_files = [
    "credential_details/credential_details_card.css",
    "shared_vars.css",
    "shared_style.css",
  ]

  icons_html_files = [ "icons.html" ]

  ts_composite = true

  ts_definitions = [
    "//tools/typescript/definitions/chrome_event.d.ts",
    "//tools/typescript/definitions/chrome_send.d.ts",
    "//tools/typescript/definitions/metrics_private.d.ts",
    "//tools/typescript/definitions/passwords_private.d.ts",
    "//tools/typescript/definitions/runtime.d.ts",
    "//tools/typescript/definitions/settings_private.d.ts",
    "//tools/typescript/definitions/tabs.d.ts",
  ]

  ts_deps = [
    "//chrome/browser/resources/settings_shared:build_ts",
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources/cr_components/help_bubble:build_ts",
    "//ui/webui/resources/cr_elements:build_ts",
    "//ui/webui/resources/js:build_ts",
  ]

  ts_path_mappings =
      [ "/shared/settings/*|" + rebase_path(
            "$root_gen_dir/chrome/browser/resources/settings_shared/tsc/*",
            target_gen_dir) ]

  webui_context_type = "trusted"
  optimize = optimize_webui
  if (optimize) {
    optimize_webui_host = "password-manager"
    optimize_webui_in_files = [ "password_manager.js" ]
    optimize_webui_external_paths =
        [ "/shared/settings|" + rebase_path(
              "$root_gen_dir/chrome/browser/resources/settings_shared/tsc",
              root_build_dir) ]
  }
}