# Copyright 2024 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/python.gni") import("//extensions/buildflags/buildflags.gni") import("//ui/webui/resources/tools/build_webui.gni") import("//ui/webui/resources/tools/optimize_webui.gni") build_webui("build") { grd_prefix = "glic" static_files = [ "glic.css", "glic.html", "internals/glic_internals.html", ] css_files = [ "internals/glic_internals_app.css" ] ts_files = [ "app_router.ts", "browser_proxy.ts", "glic_api_impl/actor/actor_client.ts", "glic_api_impl/actor/actor_host.ts", "glic_api_impl/actor/actor_types.ts", "glic_api_impl/annotation/annotation_client.ts", "glic_api_impl/annotation/annotation_host.ts", "glic_api_impl/annotation/annotation_types.ts", "glic_api_impl/skills/skills_client.ts", "glic_api_impl/skills/skills_host.ts", "glic_api_impl/skills/skills_types.ts", "glic_api_impl/client/glic_api_client.ts", "glic_api_impl/client/image_utils.ts", "glic_api_impl/client/observable_set_by_tab_id.ts", "glic_api_impl/conversions.ts", "glic_api_impl/experimental_triggering/experimental_triggering_client.ts", "glic_api_impl/experimental_triggering/experimental_triggering_host.ts", "glic_api_impl/experimental_triggering/experimental_triggering_types.ts", "glic_api_impl/glic_api_injected_client.ts", "glic_api_impl/host/conversions.ts", "glic_api_impl/host/glic_api_host.ts", "glic_api_impl/host/host_from_client.ts", "glic_api_impl/host/host_to_client.ts", "glic_api_impl/host/host_utils.ts", "glic_api_impl/host/types.ts", "glic_api_impl/request_types.ts", "glic_api_impl/transport/messaging.ts", "glic_api_impl/transport/post_message_transport.ts", "glic_api_impl/zero_state_suggestions/zero_state_suggestions_client.ts", "glic_api_impl/zero_state_suggestions/zero_state_suggestions_host.ts", "glic_api_impl/zero_state_suggestions/zero_state_suggestions_types.ts", "glic_api_impl/client/glic_client_common.ts", "glic_api/glic_api.ts", "glic_api/glic_api_generated.ts", "glic_app_controller.ts", "glic.ts", "icons.html.ts", "internals.ts", "internals/glic_internals_app.html.ts", "internals/glic_internals_app.ts", "main.ts", "observable.ts", "shared/glic_request_headers.ts", "shared/web_view_type.ts", "task_queue.ts", "timer.ts", "webview.ts", ] webui_context_type = "trusted" ts_deps = [ "//third_party/lit/v3_0:build_ts", "//ui/webui/resources/cr_elements:build_ts", "//ui/webui/resources/js:build_ts", "//ui/webui/resources/mojo:build_ts", ] if (!is_android) { ts_deps += [ "//ui/webui/resources/cr_components/color_change_listener:build_ts" ] } extra_grdp_deps = [ ":glic_api_injection_grdp" ] extra_grdp_files = [ "$target_gen_dir/glic_api_injection.grdp" ] mojo_files_deps = [ "glic_api_impl/generate_impl:generate_enum_conversions", "//chrome/browser/glic:mojo_bindings_ts__generator", "//chrome/common:actor_webui_mojom_ts__generator", "//chrome/common:glic_enums_mojom_ts__generator", "//components/content_settings/core/common:content_settings_types_ts__generator", "//components/optimization_guide/content/mojom:mojo_interfaces_ts__generator", "//third_party/blink/public/mojom/content_extraction:content_extraction_ts__generator", ] mojo_files = [ "$target_gen_dir/glic_api_impl/generate_impl/enum_conversions.ts", "$root_gen_dir/chrome/browser/glic/host/glic.mojom-webui.ts", "$root_gen_dir/chrome/browser/glic/host/glic_internals.mojom-webui.ts", "$root_gen_dir/chrome/browser/glic/host/glic_webui.mojom-webui.ts", "$root_gen_dir/chrome/common/actor_webui.mojom-webui.ts", "$root_gen_dir/chrome/common/glic_enums.mojom-webui.ts", "$root_gen_dir/components/content_settings/core/common/content_settings_types.mojom-webui.ts", "$root_gen_dir/third_party/blink/public/mojom/content_extraction/ai_page_content_metadata.mojom-webui.ts", ] ts_definitions = [ "//tools/typescript/definitions/chrome_event.d.ts", "//tools/typescript/definitions/context_menus.d.ts", "//tools/typescript/definitions/extension_types.d.ts", "//tools/typescript/definitions/chrome_histograms.d.ts", "//tools/typescript/definitions/tabs.d.ts", "//tools/typescript/definitions/web_request.d.ts", "//tools/typescript/definitions/webview_tag.d.ts", ] if (!enable_extensions_core) { ts_deps += [ "//chrome/browser/resources/guest_view_shared:build_ts" ] ts_path_mappings = [ "/shared/guest_view/*|" + rebase_path( "$root_gen_dir/chrome/browser/resources/guest_view_shared/tsc/*", target_gen_dir) ] } if (optimize_webui) { optimize_webui_host = "glic" optimize_webui_in_files = [ "glic.js", "internals.js", ] if (!enable_extensions_core) { optimize_webui_external_paths = [ "/shared/guest_view|" + rebase_path( "$root_gen_dir/chrome/browser/resources/guest_view_shared/tsc", root_build_dir) ] } } ts_composite = true } # Build the API provided to the Glic web client. It needs to be built into a # single js file and sent to the Glic web client at runtime. glic_api_injection_manifest = "$target_gen_dir/glic_api_injection_manifest.json" optimize_webui("glic_api_injection") { host = "about:blank" input = rebase_path("$target_gen_dir/tsc", root_build_dir) js_module_in_files = [ "glic_api_impl/glic_api_injected_client.js" ] out_manifest = "$glic_api_injection_manifest" deps = [ ":build_ts" ] } generate_grd("glic_api_injection_grdp") { manifest_files = [ "$glic_api_injection_manifest" ] deps = [ ":glic_api_injection" ] grd_prefix = "glic" out_grd = "$target_gen_dir/glic_api_injection.grdp" }