Commit dddd1d10 authored by Ken Rockot's avatar Ken Rockot Committed by Chromium LUCI CQ

Migrate reset-password WebUI to Mojo JS modules

Bug: 1004256
Change-Id: I5e835e779fcd6e6096886d7bf38869ae19e25bd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569384Reviewed-by: default avatarcalamity <calamity@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Auto-Submit: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#834351}
parent 7c554ad1
......@@ -499,7 +499,7 @@
<if expr="safe_browsing_mode == 1">
<include name="IDR_RESET_PASSWORD_HTML" file="resources\reset_password\reset_password.html" type="BINDATA" />
<include name="IDR_RESET_PASSWORD_JS" file="resources\reset_password\reset_password.js" type="BINDATA" />
<include name="IDR_RESET_PASSWORD_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\reset_password\reset_password.mojom-lite.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_RESET_PASSWORD_MOJOM_WEBUI_JS" file="${root_gen_dir}\mojom-webui\chrome\browser\ui\webui\reset_password\reset_password.mojom-webui.js" use_base_dir="false" type="BINDATA" />
</if>
<if expr="not is_android">
<include name="IDR_TAB_RANKER_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="resource_coordinator\tab_ranker\example_preprocessor_config.pb" type="BINDATA" />
......
......@@ -6,12 +6,19 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
uses_js_modules = true
closure_flags = default_closure_args + mojom_js_args + [
"js_module_root=" + rebase_path(
"$root_gen_dir/mojom-webui/chrome/browser/ui/webui/reset_password",
root_build_dir),
"js_module_root=" + rebase_path(".", root_build_dir),
]
deps = [ ":reset_password" ]
}
js_library("reset_password") {
deps = [
"//chrome/browser/ui/webui/reset_password:mojo_bindings_js_library_for_compile",
"//chrome/browser/ui/webui/reset_password:mojo_bindings_webui_js",
"//ui/webui/resources/js:util.m",
]
}
......@@ -7,16 +7,16 @@
import 'chrome://resources/cr_elements/icons.m.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import './reset_password.mojom-lite.js';
import {$} from 'chrome://resources/js/util.m.js';
/** @type {mojom.ResetPasswordHandlerRemote} */
import {ResetPasswordHandler, ResetPasswordHandlerRemote} from './reset_password.mojom-webui.js';
/** @type {ResetPasswordHandlerRemote} */
let pageHandler;
document.addEventListener('DOMContentLoaded', function() {
pageHandler = mojom.ResetPasswordHandler.getRemote();
pageHandler = ResetPasswordHandler.getRemote();
/** @type {?HTMLElement} */
const resetPasswordButton = $('reset-password-button');
......
......@@ -6,4 +6,5 @@ import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojo_bindings") {
sources = [ "reset_password.mojom" ]
webui_module_path = "/"
}
......@@ -115,8 +115,8 @@ ResetPasswordUI::ResetPasswordUI(content::WebUI* web_ui)
content::WebUIDataSource::Create(chrome::kChromeUIResetPasswordHost));
html_source->DisableTrustedTypesCSP();
html_source->AddResourcePath("reset_password.js", IDR_RESET_PASSWORD_JS);
html_source->AddResourcePath("reset_password.mojom-lite.js",
IDR_RESET_PASSWORD_MOJOM_LITE_JS);
html_source->AddResourcePath("reset_password.mojom-webui.js",
IDR_RESET_PASSWORD_MOJOM_WEBUI_JS);
html_source->SetDefaultResource(IDR_RESET_PASSWORD_HTML);
html_source->AddLocalizedStrings(PopulateStrings());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment