0

CrOS Mojo bindings migration: Migrate annotator to use TS bindings

Also removing js_library() Closure Compiler targets since these can
no longer be accommodated with TS bindings.

Bug: 384098175
Change-Id: I9ddb33c73e7e1d89e679b35d5000faa60ae0b03f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6126304
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Fred Shih <ffred@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1400632}
This commit is contained in:
rbpotter
2024-12-27 19:44:50 -08:00
committed by Chromium LUCI CQ
parent 9148dcd49f
commit 1d764f6876
12 changed files with 23 additions and 53 deletions
ash/webui
chrome
tools

@ -25,8 +25,8 @@ static_library("annotator") {
"//ash/strings",
"//ash/webui/annotator/mojom:annotator_mojo_bindings",
"//ash/webui/annotator/public/mojom:annotator_mojo_bindings",
"//ash/webui/annotator/resources/untrusted:resources",
"//ash/webui/media_app_ui:buildflags",
"//ash/webui/resources:annotator_untrusted_resources",
"//ash/webui/resources:media_app_bundle_resources",
"//ash/webui/resources:projector_app_bundle_resources",
"//ash/webui/resources:projector_common_resources",

@ -7,13 +7,8 @@ import("//mojo/public/tools/bindings/mojom.gni")
assert(is_chromeos_ash, "Annotator is ChromeOS only")
cur_dir = rebase_path(".", "//")
mojom("annotator_mojo_bindings") {
sources = [ "untrusted_annotator.mojom" ]
deps = [ "//ash/webui/annotator/public/mojom:annotator_mojo_bindings" ]
webui_module_path = "/$cur_dir"
# Projector app is still using JS + Closure Compiler.
generate_webui_js_bindings = true
webui_module_path = "/"
}

@ -7,12 +7,7 @@ import("//mojo/public/tools/bindings/mojom.gni")
assert(is_chromeos_ash, "Annotator is ChromeOS only")
cur_dir = rebase_path(".", "//")
mojom("annotator_mojo_bindings") {
sources = [ "annotator_structs.mojom" ]
webui_module_path = "/$cur_dir"
# Projector app is still using JS + Closure Compiler.
generate_webui_js_bindings = true
webui_module_path = "/"
}

@ -2,42 +2,29 @@
# 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("//ui/webui/resources/tools/generate_grd.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//ui/webui/resources/tools/build_webui.gni")
assert(is_chromeos_ash, "Annotator is ChromeOS only")
js_library("untrusted_annotator_library") {
sources = [
build_webui("build") {
static_files = [ "annotator.html" ]
non_web_component_files = [
"annotator_browser_proxy.js",
"untrusted_annotator_comm_factory.js",
]
deps = [
"//ash/webui/annotator/mojom:annotator_mojo_bindings_webui_js",
"//ash/webui/annotator/public/mojom:annotator_mojo_bindings_webui_js",
"//ash/webui/projector_app/resources/common:message_types",
mojo_files = [
"$root_gen_dir/ash/webui/annotator/mojom/untrusted_annotator.mojom-webui.ts",
"$root_gen_dir/ash/webui/annotator/public/mojom/annotator_structs.mojom-webui.ts",
]
externs_list = [ "//ash/webui/projector_app/resources/common/projector_app.externs.js" ]
}
generate_grd("build_untrusted_grd") {
input_files = [
"annotator_browser_proxy.js",
"annotator.html",
"untrusted_annotator_comm_factory.js",
mojo_files_deps = [
"//ash/webui/annotator/mojom:annotator_mojo_bindings_ts__generator",
"//ash/webui/annotator/public/mojom:annotator_mojo_bindings_ts__generator",
]
input_files_base_dir = rebase_path(".", "//")
ts_deps = [ "//ui/webui/resources/mojo:build_ts" ]
webui_context_type = "untrusted"
grd_prefix = "ash_annotator_untrusted"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
deps = [
"//ash/webui/annotator/mojom:annotator_mojo_bindings_webui_grdp",
"//ash/webui/annotator/public/mojom:annotator_mojo_bindings_webui_grdp",
]
grdp_files = [
"$target_gen_dir/../../mojom/annotator_mojo_bindings_webui_resources.grdp",
"$target_gen_dir/../../public/mojom/annotator_mojo_bindings_webui_resources.grdp",
]
grit_output_dir = "$root_gen_dir/ash/webui"
}

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {UntrustedAnnotatorPageCallbackRouter, UntrustedAnnotatorPageHandlerFactory, UntrustedAnnotatorPageHandlerRemote, UntrustedAnnotatorPageRemote} from './ash/webui/annotator/mojom/untrusted_annotator.mojom-webui.js';
import {UntrustedAnnotatorPageCallbackRouter, UntrustedAnnotatorPageHandlerFactory, UntrustedAnnotatorPageHandlerRemote} from './untrusted_annotator.mojom-webui.js';
/**
* To use the annotator proxy, please import this module and call

@ -3,7 +3,6 @@
// found in the LICENSE file.
import {AnnotatorBrowserProxyImpl, browserProxy} from './annotator_browser_proxy.js';
import {UntrustedAnnotatorPageCallbackRouter} from './ash/webui/annotator/mojom/untrusted_annotator.mojom-webui.js';
/**
* Returns the projector app element inside this current DOM.

@ -28,10 +28,10 @@ static_library("projector_app") {
"//ash/public/cpp",
"//ash/strings",
"//ash/webui/annotator",
"//ash/webui/annotator/resources/untrusted:resources",
"//ash/webui/media_app_ui:buildflags",
"//ash/webui/projector_app/mojom:projector_mojo_bindings",
"//ash/webui/projector_app/public/mojom:projector_mojo_bindings",
"//ash/webui/resources:annotator_untrusted_resources",
"//ash/webui/resources:media_app_bundle_resources",
"//ash/webui/resources:projector_app_bundle_resources",
"//ash/webui/resources:projector_app_untrusted_resources",

@ -11,7 +11,6 @@ assert(is_chromeos_ash, "Projector is ChromeOS only")
js_type_check("closure_compile") {
is_polymer3 = true
deps = [
"//ash/webui/annotator/resources/untrusted:untrusted_annotator_library",
"//ash/webui/projector_app/resources/app/untrusted:untrusted_app",
"//ash/webui/projector_app/resources/common:message_types",
"//ash/webui/projector_app/resources/mock:mock_app",

@ -216,12 +216,6 @@ grit("projector_app_bundle_resources") {
output_dir = "$root_gen_dir/chromeos"
}
# Resources used by chrome-untrusted://projector-annotator SWA.
ash_generated_grit("annotator_untrusted_resources") {
source = "$root_gen_dir/ash/webui/annotator/resources/untrusted/ash_annotator_untrusted_resources.grd"
deps = [ "//ash/webui/annotator/resources/untrusted:build_untrusted_grd" ]
}
# Resources used by chrome://projector and chrome://projector-annotator SWA.
ash_generated_grit("projector_common_resources") {
source = "$root_gen_dir/ash/webui/projector_app/resources/common/ash_projector_common_resources.grd"

@ -342,6 +342,7 @@ template("chrome_extra_paks") {
"//ash/quick_insert/resources:quick_insert_resources",
"//ash/system/mahi/resources:mahi_resources",
"//ash/system/video_conference/resources:vc_resources",
"//ash/webui/annotator/resources/untrusted:resources",
"//ash/webui/boca_ui/resources:resources",
"//ash/webui/color_internals/resources:resources",
"//ash/webui/common/resources:resources",
@ -362,7 +363,6 @@ template("chrome_extra_paks") {
"//ash/webui/print_management/resources:resources",
"//ash/webui/print_preview_cros/resources:resources",
"//ash/webui/recorder_app_ui/resources",
"//ash/webui/resources:annotator_untrusted_resources",
"//ash/webui/resources:boca_app_bundle_resources",
"//ash/webui/resources:camera_app_resources",
"//ash/webui/resources:demo_mode_app_resources",

@ -887,7 +887,7 @@
"META": {"sizes": {"includes": [50],}},
"includes": [6520],
},
"<(SHARED_INTERMEDIATE_DIR)/ash/webui/annotator/resources/untrusted/ash_annotator_untrusted_resources.grd": {
"<(SHARED_INTERMEDIATE_DIR)/ash/webui/annotator/resources/untrusted/resources.grd": {
"META": {"sizes": {"includes": [50],}},
"includes": [6540],
},

@ -116,6 +116,7 @@ def validateJavaScriptAllowed(source_dir, out_dir, is_ios):
# TODO (rbpotter): If possible, standardize the build setup in some of these
# folders such that they can be more accurately specified in the list below.
ash_directories = [
'ash/webui/annotator/resources/untrusted/',
'ash/webui/camera_app_ui/',
'ash/webui/color_internals/',
'ash/webui/common/resources/',