chromium/ash/webui/personalization_app/resources/BUILD.gn

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

import("//build/config/chromeos/ui_mode.gni")
import("//chromeos/components/libsegmentation/buildflags.gni")
import("//ui/webui/resources/tools/build_webui.gni")
import("//ui/webui/webui_features.gni")

assert(is_chromeos_ash)

build_webui("build") {
  grd_prefix = "ash_personalization_app"

  # When adding a new file to personalization app, add it to one of the lists
  # below. `non_web_component_files` are plain ts files, `web_component_files` are
  # polymer based ts files, `css_files` are Polymer css files,
  # `static_files` are non-js files, e.g. image, html, plain css.

  static_files = [
    "hub_icon_64.png",
    "hub_icon_128.png",
    "hub_icon_192.png",
    "hub_icon_256.png",
    "icon_192.png",

    "index.html",

    "images/ambient_mode_disabled.svg",
    "images/ambient_mode_disabled_dark.svg",
    "images/feel_the_breeze.png",
    "images/float_on_by.png",
    "images/google_photos.svg",
    "images/no_images.svg",
    "images/no_google_photos_images.svg",
    "images/no_google_photos_images_dark.svg",
    "images/slideshow.png",

    "css/base.css",
  ]

  web_component_files = [
    "js/ambient/album_list_element.ts",
    "js/ambient/albums_subpage_element.ts",
    "js/ambient/ambient_preview_large_element.ts",
    "js/ambient/ambient_preview_small_element.ts",
    "js/ambient/art_album_dialog_element.ts",
    "js/ambient/ambient_duration_element.ts",
    "js/ambient/ambient_subpage_element.ts",
    "js/ambient/ambient_zero_state_svg_element.ts",
    "js/ambient/ambient_weather_element.ts",
    "js/ambient/ambient_theme_item_element.ts",
    "js/ambient/ambient_theme_list_element.ts",
    "js/ambient/toggle_row_element.ts",
    "js/ambient/topic_source_item_element.ts",
    "js/ambient/topic_source_list_element.ts",
    "js/ambient/zero_state_element.ts",
    "js/keyboard_backlight/keyboard_backlight_element.ts",
    "js/keyboard_backlight/zone_customization_element.ts",
    "js/keyboard_backlight/color_icon_element.ts",
    "js/keyboard_backlight/color_selector_element.ts",
    "js/personalization_main_element.ts",
    "js/personalization_router_element.ts",
    "js/personalization_toast_element.ts",
    "js/personalization_breadcrumb_element.ts",
    "js/geolocation_dialog.ts",
    "js/time_of_day_banner_element.ts",
    "js/theme/personalization_theme_element.ts",
    "js/theme/color_scheme_icon_svg_element.ts",
    "js/theme/dynamic_color_element.ts",
    "js/user/avatar_camera_element.ts",
    "js/user/avatar_list_element.ts",
    "js/user/user_preview_element.ts",
    "js/user/user_subpage_element.ts",
    "js/wallpaper/google_photos_albums_element.ts",
    "js/wallpaper/google_photos_collection_element.ts",
    "js/wallpaper/google_photos_photos_by_album_id_element.ts",
    "js/wallpaper/google_photos_photos_element.ts",
    "js/wallpaper/google_photos_shared_album_dialog_element.ts",
    "js/wallpaper/google_photos_zero_state_element.ts",
    "js/wallpaper/info_svg_element.ts",
    "js/wallpaper/local_images_element.ts",
    "js/wallpaper/time_of_day_wallpaper_dialog_element.ts",
    "js/wallpaper/wallpaper_collections_element.ts",
    "js/wallpaper/wallpaper_error_element.ts",
    "js/wallpaper/wallpaper_fullscreen_element.ts",
    "js/wallpaper/wallpaper_images_element.ts",
    "js/wallpaper/wallpaper_preview_element.ts",
    "js/wallpaper/wallpaper_selected_element.ts",
    "js/wallpaper/wallpaper_subpage_element.ts",
  ]

  non_web_component_files = [
    "js/ambient/ambient_actions.ts",
    "js/ambient/ambient_controller.ts",
    "js/ambient/ambient_interface_provider.ts",
    "js/ambient/ambient_observer.ts",
    "js/ambient/ambient_preview_base.ts",
    "js/ambient/ambient_reducers.ts",
    "js/ambient/ambient_state.ts",
    "js/ambient/utils.ts",
    "js/keyboard_backlight/keyboard_backlight_actions.ts",
    "js/keyboard_backlight/keyboard_backlight_controller.ts",
    "js/keyboard_backlight/keyboard_backlight_interface_provider.ts",
    "js/keyboard_backlight/keyboard_backlight_observer.ts",
    "js/keyboard_backlight/keyboard_backlight_reducers.ts",
    "js/keyboard_backlight/keyboard_backlight_state.ts",
    "js/load_time_booleans.ts",
    "js/personalization_actions.ts",
    "js/personalization_app.ts",
    "js/personalization_metrics_logger.ts",
    "js/personalization_reducers.ts",
    "js/personalization_state.ts",
    "js/personalization_store.ts",
    "js/personalization_test_api.ts",
    "js/sea_pen_store_adapter.ts",
    "js/theme/theme_actions.ts",
    "js/theme/theme_controller.ts",
    "js/theme/theme_interface_provider.ts",
    "js/theme/theme_observer.ts",
    "js/theme/theme_reducers.ts",
    "js/theme/theme_state.ts",
    "js/theme/utils.ts",
    "js/user/user_actions.ts",
    "js/user/user_controller.ts",
    "js/user/user_image_observer.ts",
    "js/user/user_interface_provider.ts",
    "js/user/user_reducers.ts",
    "js/user/user_selectors.ts",
    "js/user/user_state.ts",
    "js/user/utils.ts",
    "js/user/webcam_utils_proxy.ts",
    "js/utils.ts",
    "js/wallpaper/constants.ts",
    "js/wallpaper/google_photos_metrics_logger.ts",
    "js/wallpaper/utils.ts",
    "js/wallpaper/wallpaper_actions.ts",
    "js/wallpaper/wallpaper_controller.ts",
    "js/wallpaper/wallpaper_interface_provider.ts",
    "js/wallpaper/wallpaper_observer.ts",
    "js/wallpaper/wallpaper_reducers.ts",
    "js/wallpaper/wallpaper_state.ts",
    "js/wallpaper/index.ts",
  ]

  icons_html_files = [ "common/icons.html" ]

  mojo_files_deps = [
    "../mojom:mojom_ts__generator",
    "//ash/style/mojom:color_scheme_ts__generator",
  ]
  mojo_files = [
    "$root_gen_dir/ash/webui/personalization_app/mojom/personalization_app.mojom-webui.ts",
    "$root_gen_dir/ash/style/mojom/color_scheme.mojom-webui.ts",
  ]

  ts_composite = true
  ts_definitions = [ "//tools/typescript/definitions/metrics_private.d.ts" ]
  ts_deps = [
    "//ash/webui/common/resources:build_ts",
    "//ash/webui/common/resources/cr_elements:build_ts",
    "//ash/webui/common/resources/personalization:build_ts",
    "//ash/webui/common/resources/sea_pen:build_ts",
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources/cr_components/color_change_listener:build_ts",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]
  ts_extra_deps = [ "//ash/webui/common/resources:generate_definitions" ]
  ts_tsconfig_base = "tsconfig_base.json"

  webui_context_type = "trusted"
  optimize = optimize_webui
  if (optimize) {
    optimize_webui_host = "personalization"
    optimize_webui_in_files = [ "js/personalization_app.js" ]
  }

  # Time of day assets cannot be made public until after the feature is
  # released. Thus, they are currently hosted in CIPD and downloaded to
  # this directory only if an internal chrome-branded checkout is being used.
  if (is_chrome_branded && overlay_include_cbx) {
    static_files += [
      "time_of_day/thumbnails/clouds.jpg",
      "time_of_day/thumbnails/new_mexico.jpg",
    ]
  }

  grit_output_dir = "$root_gen_dir/ash/webui"
  enable_source_maps = enable_webui_inline_sourcemaps
}