diff --git a/chrome/browser/resources/settings/chromeos/BUILD.gn b/chrome/browser/resources/settings/chromeos/BUILD.gn index 6b967a8d1f202..f50bbf3c23dd1 100644 --- a/chrome/browser/resources/settings/chromeos/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/BUILD.gn @@ -299,7 +299,6 @@ group("generate_web_components") { "multidevice_page:web_components", "nearby_share_page:web_components", "os_a11y_page:web_components", - "os_bluetooth_page:web_components", "os_people_page:web_components", "os_privacy_page:web_components", ] diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn index a146ad82f95e6..40b4960527a70 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn @@ -3,19 +3,15 @@ # found in the LICENSE file. import("//third_party/closure_compiler/compile_js.gni") -import("//tools/polymer/html_to_js.gni") import("../os_settings.gni") js_type_check("closure_compile_module") { closure_flags = os_settings_closure_flags is_polymer3 = true deps = [ - ":os_bluetooth_change_device_name_dialog", - ":os_bluetooth_device_detail_subpage", ":os_bluetooth_devices_subpage", ":os_bluetooth_devices_subpage_browser_proxy", ":os_bluetooth_page", - ":os_bluetooth_pairing_dialog", ":os_bluetooth_saved_devices_subpage", ":os_bluetooth_summary", ":os_bluetooth_true_wireless_images", @@ -31,7 +27,6 @@ js_type_check("closure_compile_module") { js_library("os_bluetooth_page") { deps = [ ":os_bluetooth_devices_subpage", - ":os_bluetooth_pairing_dialog", ":os_bluetooth_summary", "//ash/webui/common/resources:i18n_behavior", "//ash/webui/common/resources/bluetooth:cros_bluetooth_config", @@ -110,27 +105,8 @@ js_library("os_bluetooth_true_wireless_images") { ] } -js_library("os_bluetooth_device_detail_subpage") { - deps = [ - ":os_bluetooth_change_device_name_dialog", - ":os_bluetooth_forget_device_dialog", - ":os_bluetooth_true_wireless_images", - "..:os_route", - "..:route_observer_behavior", - "..:route_origin_behavior", - "..:router", - "//ash/webui/common/resources:i18n_behavior", - "//ash/webui/common/resources/bluetooth:bluetooth_device_battery_info", - "//ash/webui/common/resources/bluetooth:bluetooth_metrics_utils", - "//ash/webui/common/resources/bluetooth:bluetooth_utils", - "//chromeos/ash/services/bluetooth_config/public/mojom:mojom_webui_js", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -} - js_library("os_bluetooth_saved_devices_subpage") { deps = [ - ":os_bluetooth_change_device_name_dialog", ":os_bluetooth_true_wireless_images", ":os_saved_devices_list", ":settings_fast_pair_constants", @@ -147,26 +123,6 @@ js_library("os_bluetooth_saved_devices_subpage") { ] } -js_library("os_bluetooth_change_device_name_dialog") { - deps = [ - "//ash/webui/common/resources:i18n_behavior", - "//ash/webui/common/resources/bluetooth:bluetooth_utils", - "//ash/webui/common/resources/bluetooth:cros_bluetooth_config", - "//chromeos/ash/services/bluetooth_config/public/mojom:mojom_webui_js", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -} - -js_library("os_bluetooth_pairing_dialog") { - deps = [ - "//ash/webui/common/resources/bluetooth:bluetooth_metrics_utils", - "//ash/webui/common/resources/bluetooth:bluetooth_pairing_ui", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] - externs_list = - [ "//ui/webui/resources/cr_elements/cr_dialog/cr_dialog_externs.js" ] -} - js_library("os_remove_saved_device_dialog") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", @@ -175,14 +131,6 @@ js_library("os_remove_saved_device_dialog") { [ "//ui/webui/resources/cr_elements/cr_dialog/cr_dialog_externs.js" ] } -js_library("os_bluetooth_forget_device_dialog") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] - externs_list = - [ "//ui/webui/resources/cr_elements/cr_dialog/cr_dialog_externs.js" ] -} - js_library("settings_fast_pair_constants") { } @@ -214,23 +162,3 @@ js_library("os_saved_devices_list_item") { "//ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu_externs.js", ] } - -html_to_js("web_components") { - js_files = [ - "os_paired_bluetooth_list_item.js", - "os_remove_saved_device_dialog.js", - "os_bluetooth_forget_device_dialog.js", - "os_paired_bluetooth_list.js", - "os_saved_devices_list_item.js", - "os_saved_devices_list.js", - "os_bluetooth_devices_subpage.js", - "os_bluetooth_saved_devices_subpage.js", - "os_bluetooth_page.js", - "os_bluetooth_summary.js", - "os_bluetooth_device_detail_subpage.js", - "os_bluetooth_true_wireless_images.js", - "os_bluetooth_change_device_name_dialog.js", - "os_bluetooth_pairing_dialog.js", - "settings_fast_pair_toggle.js", - ] -} diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.html b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.html index 0fc23191f7685..2567b1710f5f2 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.html +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.html @@ -54,9 +54,9 @@ invalid="[[isInputInvalid_]]" label="$i18n{bluetoothDeviceDetailChangeNameDialogNewName}" aria-description="[[i18n('bluetoothChangeNameDialogInputA11yLabel', - MAX_INPUT_LENGTH)]]" + maxInputLength)]]" error-message="[[i18n('bluetoothChangeNameDialogInputA11yLabel', - MAX_INPUT_LENGTH)]]"> + maxInputLength)]]"> - \ No newline at end of file + diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.ts similarity index 65% rename from chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.js rename to chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.ts index 6b527faf89ea7..058b06cdbc58f 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.ts @@ -9,59 +9,55 @@ import '../../settings_shared.css.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {getDeviceName} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; import {getBluetoothConfig} from 'chrome://resources/ash/common/bluetooth/cros_bluetooth_config.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -/** @type {number} */ -const MAX_INPUT_LENGTH = 32; +import {getTemplate} from './os_bluetooth_change_device_name_dialog.html.js'; + +const MAX_INPUT_LENGTH: number = 32; + +interface SettingsBluetoothChangeDeviceNameDialogElement { + $: {dialog: CrDialogElement}; +} -/** - * @constructor - * @extends {PolymerElement} - * @implements {I18nBehaviorInterface} - */ const SettingsBluetoothChangeDeviceNameDialogElementBase = - mixinBehaviors([I18nBehavior], PolymerElement); + I18nMixin(PolymerElement); -/** @polymer */ class SettingsBluetoothChangeDeviceNameDialogElement extends SettingsBluetoothChangeDeviceNameDialogElementBase { static get is() { - return 'os-settings-bluetooth-change-device-name-dialog'; + return 'os-settings-bluetooth-change-device-name-dialog' as const; } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { return { - /** - * @private {!PairedBluetoothDeviceProperties} - */ device: { type: Object, observer: 'onDeviceChanged_', }, - /** Used to reference the MAX_INPUT_LENGTH constant in HTML. */ - MAX_INPUT_LENGTH: { + /** Used to reference the maxInputLength constant in HTML. */ + maxInputLength: { type: Number, value: MAX_INPUT_LENGTH, }, - /** @private */ deviceName_: { type: String, value: '', observer: 'onDeviceNameChanged_', }, - /** @private */ isInputInvalid_: { type: Boolean, value: false, @@ -69,19 +65,20 @@ class SettingsBluetoothChangeDeviceNameDialogElement extends }, }; } + private device: PairedBluetoothDeviceProperties; + private maxInputLength: number; + private deviceName_: string; + private isInputInvalid_: boolean; - /** @private */ - onDeviceChanged_() { + private onDeviceChanged_(): void { this.deviceName_ = getDeviceName(this.device); } - /** @private */ - onCancelClick_(event) { + private onCancelClick_(): void { this.$.dialog.close(); } - /** @private */ - onDoneClick_() { + private onDoneClick_(): void { getBluetoothConfig().setDeviceNickname( this.device.deviceProperties.id, this.deviceName_); this.$.dialog.close(); @@ -90,11 +87,8 @@ class SettingsBluetoothChangeDeviceNameDialogElement extends /** * Returns a formatted string containing the current number of characters * entered in the input compared to the maximum number of characters allowed. - * @param {string} deviceName - * @return {string} - * @private */ - getInputCountString_(deviceName) { + private getInputCountString_(deviceName: string): string { // minimumIntegerDigits is 2 because we want to show a leading zero if // length is less than 10. return this.i18n( @@ -106,15 +100,12 @@ class SettingsBluetoothChangeDeviceNameDialogElement extends /** * Observer for deviceName_ that sanitizes its value by truncating it to - * MAX_INPUT_LENGTH. This method will be recursively called until deviceName_ + * maxInputLength. This method will be recursively called until deviceName_ * is fully sanitized. - * @param {string} newValue - * @param {string} oldValue - * @private */ - onDeviceNameChanged_(newValue, oldValue) { + private onDeviceNameChanged_(_newValue: string, oldValue: string): void { if (oldValue) { - // If oldValue.length > MAX_INPUT_LENGTH, the user attempted to + // If oldValue.length > maxInputLength, the user attempted to // enter more than the max limit, this method was called and it was // truncated, and then this method was called one more time. this.isInputInvalid_ = oldValue.length > MAX_INPUT_LENGTH; @@ -122,15 +113,11 @@ class SettingsBluetoothChangeDeviceNameDialogElement extends this.isInputInvalid_ = false; } - // Truncate the name to MAX_INPUT_LENGTH. + // Truncate the name to maxInputLength. this.deviceName_ = this.deviceName_.substring(0, MAX_INPUT_LENGTH); } - /** - * @return {boolean} - * @private - */ - isDoneDisabled_() { + private isDoneDisabled_(): boolean { if (this.deviceName_ === getDeviceName(this.device)) { return true; } @@ -143,6 +130,13 @@ class SettingsBluetoothChangeDeviceNameDialogElement extends } } +declare global { + interface HTMLElementTagNameMap { + [SettingsBluetoothChangeDeviceNameDialogElement.is]: + SettingsBluetoothChangeDeviceNameDialogElement; + } +} + customElements.define( SettingsBluetoothChangeDeviceNameDialogElement.is, SettingsBluetoothChangeDeviceNameDialogElement); diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.ts similarity index 73% rename from chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js rename to chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.ts index fa0e25f18c939..c351a777ecccd 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.ts @@ -19,67 +19,47 @@ import {BluetoothUiSurface, recordBluetoothUiSurfaceMetrics} from 'chrome://reso import {BatteryType} from 'chrome://resources/ash/common/bluetooth/bluetooth_types.js'; import {getBatteryPercentage, getDeviceName, hasAnyDetailedBatteryInfo, hasDefaultImage, hasTrueWirelessImages} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; import {getBluetoothConfig} from 'chrome://resources/ash/common/bluetooth/cros_bluetooth_config.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; -import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; -import {assertNotReached} from 'chrome://resources/ash/common/assert.js'; -import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; +import {WebUiListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js'; +import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; import {AudioOutputCapability, BluetoothSystemProperties, DeviceConnectionState, DeviceType, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {Route, Router} from '../router.js'; import {routes} from '../os_route.js'; -import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; -import {RouteOriginBehavior, RouteOriginBehaviorInterface} from '../route_origin_behavior.js'; - -/** @enum {number} */ -const PageState = { - DISCONNECTED: 1, - DISCONNECTING: 2, - CONNECTING: 3, - CONNECTED: 4, - CONNECTION_FAILED: 5, -}; +import {OsSettingsSubpageElement} from '../os_settings_page/os_settings_subpage.js'; +import {RouteOriginMixin} from '../route_origin_mixin.js'; +import {Route, Router} from '../router.js'; + +import {getTemplate} from './os_bluetooth_device_detail_subpage.html.js'; + +enum PageState { + DISCONNECTED = 1, + DISCONNECTING = 2, + CONNECTING = 3, + CONNECTED = 4, + CONNECTION_FAILED = 5 +} + +const SettingsBluetoothDeviceDetailSubpageElementBase = + RouteOriginMixin(WebUiListenerMixin(I18nMixin((PolymerElement)))); -/** - * @constructor - * @extends {PolymerElement} - * @implements {RouteObserverBehaviorInterface} - * @implements {RouteOriginBehaviorInterface} - * @implements {I18nBehaviorInterface} - * @implements {WebUIListenerBehaviorInterface} - */ -const SettingsBluetoothDeviceDetailSubpageElementBase = mixinBehaviors( - [ - RouteObserverBehavior, - RouteOriginBehavior, - I18nBehavior, - WebUIListenerBehavior, - ], - PolymerElement); - -/** @polymer */ class SettingsBluetoothDeviceDetailSubpageElement extends SettingsBluetoothDeviceDetailSubpageElementBase { static get is() { - return 'os-settings-bluetooth-device-detail-subpage'; + return 'os-settings-bluetooth-device-detail-subpage' as const; } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { return { - /** - * @type {!BluetoothSystemProperties} - */ systemProperties: { type: Object, }, - /** - * @private {?PairedBluetoothDeviceProperties} - */ device_: { type: Object, observer: 'onDeviceChanged_', @@ -88,33 +68,28 @@ class SettingsBluetoothDeviceDetailSubpageElement extends /** * Id of the currently paired device. This is set from the route query * parameters. - * @private */ deviceId_: { type: String, value: '', }, - /** @private */ isDeviceConnected_: { reflectToAttribute: true, type: Boolean, computed: 'computeIsDeviceConnected_(device_.*)', }, - /** @private */ shouldShowChangeDeviceNameDialog_: { type: Boolean, value: false, }, - /** @private {!PageState} */ pageState_: { type: Object, value: PageState.DISCONNECTED, }, - /** @protected */ shouldShowForgetDeviceDialog_: { type: Boolean, value: false, @@ -128,6 +103,16 @@ class SettingsBluetoothDeviceDetailSubpageElement extends ]; } + systemProperties: BluetoothSystemProperties; + + private deviceId_: string; + private device_: PairedBluetoothDeviceProperties|null; + private isDeviceConnected_: boolean; + private pageState_: PageState; + private route_: Route; + private shouldShowChangeDeviceNameDialog_: boolean; + private shouldShowForgetDeviceDialog_: boolean; + constructor() { super(); @@ -135,8 +120,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends this.route_ = routes.BLUETOOTH_DEVICE_DETAIL; } - /** @override */ - ready() { + override ready(): void { super.ready(); this.addEventListener( @@ -146,13 +130,8 @@ class SettingsBluetoothDeviceDetailSubpageElement extends this.addFocusConfig(routes.KEYBOARD, '#changeKeyboardSettings'); } - /** - * RouteObserverBehaviorInterface override - * @param {!Route} route - * @param {!Route=} opt_oldRoute - */ - currentRouteChanged(route, opt_oldRoute) { - super.currentRouteChanged(route, opt_oldRoute); + override currentRouteChanged(route: Route, oldRoute?: Route): void { + super.currentRouteChanged(route, oldRoute); if (route !== this.route_) { return; @@ -173,8 +152,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends BluetoothUiSurface.SETTINGS_DEVICE_DETAIL_SUBPAGE); } - /** @private */ - onSystemPropertiesOrDeviceIdChanged_() { + private onSystemPropertiesOrDeviceIdChanged_(): void { if (!this.systemProperties || !this.deviceId_) { return; } @@ -195,11 +173,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends Router.getInstance().navigateToPreviousRoute(); } - /** - * @return {boolean} - * @private - */ - computeIsDeviceConnected_() { + private computeIsDeviceConnected_(): boolean { if (!this.device_) { return false; } @@ -207,29 +181,17 @@ class SettingsBluetoothDeviceDetailSubpageElement extends DeviceConnectionState.kConnected; } - /** - * @return {string} - * @private - */ - getBluetoothStateIcon_() { + private getBluetoothStateIcon_(): string { return this.isDeviceConnected_ ? 'os-settings:bluetooth-connected' : 'os-settings:bluetooth-disabled'; } - /** - * @return {string} - * @private - */ - getBluetoothConnectDisconnectBtnLabel_() { + private getBluetoothConnectDisconnectBtnLabel_(): string { return this.isDeviceConnected_ ? this.i18n('bluetoothDisconnect') : this.i18n('bluetoothConnect'); } - /** - * @return {string} - * @private - */ - getBluetoothStateTextLabel_() { + private getBluetoothStateTextLabel_(): string { if (this.pageState_ === PageState.CONNECTING) { return this.i18n('bluetoothConnecting'); } @@ -239,22 +201,14 @@ class SettingsBluetoothDeviceDetailSubpageElement extends this.i18n('bluetoothDeviceDetailDisconnected'); } - /** - * @return {string} - * @private - */ - getDeviceName_() { + private getDeviceName_(): string { if (!this.device_) { return ''; } return getDeviceName(this.device_); } - /** - * @return {boolean} - * @private - */ - shouldShowConnectDisconnectBtn_() { + private shouldShowConnectDisconnectBtn_(): boolean { if (!this.device_) { return false; } @@ -262,20 +216,16 @@ class SettingsBluetoothDeviceDetailSubpageElement extends AudioOutputCapability.kCapableOfAudioOutput; } - /** - * @return {boolean} - * @private - */ - shouldShowForgetBtn_() { + private shouldShowForgetBtn_(): boolean { return !!this.device_; } - /** @private */ - onDeviceChanged_() { + private onDeviceChanged_(): void { if (!this.device_) { return; } - this.parentNode.pageTitle = getDeviceName(this.device_); + (this.parentNode as OsSettingsSubpageElement).pageTitle = + getDeviceName(this.device_); // Special case a where user is still on detail page and has // tried to connect to device but failed. The current |pageState_| @@ -302,11 +252,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends } } - /** - * @return {boolean} - * @private - */ - shouldShowNonAudioOutputDeviceMessage_() { + private shouldShowNonAudioOutputDeviceMessage_(): boolean { if (!this.device_) { return false; } @@ -316,10 +262,8 @@ class SettingsBluetoothDeviceDetailSubpageElement extends /** * Message displayed for devices that are human interactive. - * @return {string} - * @private */ - getNonAudioOutputDeviceMessage_() { + private getNonAudioOutputDeviceMessage_(): string { if (!this.device_) { return ''; } @@ -332,21 +276,15 @@ class SettingsBluetoothDeviceDetailSubpageElement extends return this.i18n('bluetoothDeviceDetailHIDMessageDisconnected'); } - /** @private */ - onChangeNameClick_() { + private onChangeNameClick_() { this.shouldShowChangeDeviceNameDialog_ = true; } - /** @private */ - onCloseChangeDeviceNameDialog_() { + private onCloseChangeDeviceNameDialog_() { this.shouldShowChangeDeviceNameDialog_ = false; } - /** - * @return {string} - * @private - */ - getChangeDeviceNameBtnA11yLabel_() { + private getChangeDeviceNameBtnA11yLabel_(): string { if (!this.device_) { return ''; } @@ -356,11 +294,8 @@ class SettingsBluetoothDeviceDetailSubpageElement extends this.getDeviceName_()); } - /** - * @return {string} - * @private - */ - getMultipleBatteryInfoA11yLabel_() { + private getMultipleBatteryInfoA11yLabel_(): string { + assert(this.device_); let label = ''; const leftBudBatteryPercentage = getBatteryPercentage( @@ -393,11 +328,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends return label; } - /** - * @return {string} - * @private - */ - getBatteryInfoA11yLabel_() { + private getBatteryInfoA11yLabel_(): string { if (!this.device_) { return ''; } @@ -415,11 +346,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends 'bluetoothDeviceDetailBatteryPercentageA11yLabel', batteryPercentage); } - /** - * @return {string} - * @private - */ - getDeviceStatusA11yLabel_() { + private getDeviceStatusA11yLabel_(): string { if (!this.device_) { return ''; } @@ -445,11 +372,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends } } - /** - * @return {boolean} - * @private - */ - shouldShowChangeMouseDeviceSettings_() { + private shouldShowChangeMouseDeviceSettings_(): boolean { if (!this.device_ || !this.isDeviceConnected_) { return false; } @@ -458,11 +381,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends DeviceType.kKeyboardMouseCombo; } - /** - * @return {boolean} - * @private - */ - shouldShowChangeKeyboardDeviceSettings_() { + private shouldShowChangeKeyboardDeviceSettings_(): boolean { if (!this.device_ || !this.isDeviceConnected_) { return false; } @@ -471,11 +390,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends DeviceType.kKeyboardMouseCombo; } - /** - * @return {boolean} - * @private - */ - shouldShowBlockedByPolicyIcon_() { + private shouldShowBlockedByPolicyIcon_(): boolean { if (!this.device_) { return false; } @@ -483,11 +398,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends return this.device_.deviceProperties.isBlockedByPolicy; } - /** - * @return {boolean} - * @private - */ - shouldShowBatteryInfo_() { + private shouldShowBatteryInfo_(): boolean { if (!this.device_ || this.pageState_ === PageState.CONNECTING || this.pageState_ === PageState.CONNECTION_FAILED) { return false; @@ -507,11 +418,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends return hasAnyDetailedBatteryInfo(this.device_.deviceProperties); } - /** - * @return {boolean} - * @private - */ - shouldShowTrueWirelessImages_() { + private shouldShowTrueWirelessImages_(): boolean { if (!this.device_) { return false; } @@ -537,11 +444,7 @@ class SettingsBluetoothDeviceDetailSubpageElement extends hasAnyDetailedBatteryInfo(this.device_.deviceProperties); } - /** - * @param {!Event} event - * @private - */ - onConnectDisconnectBtnClick_(event) { + private onConnectDisconnectBtnClick_(event: Event): void { event.stopPropagation(); if (this.pageState_ === PageState.DISCONNECTED || this.pageState_ === PageState.CONNECTION_FAILED) { @@ -551,98 +454,66 @@ class SettingsBluetoothDeviceDetailSubpageElement extends this.disconnectDevice_(); } - /** @private */ - connectDevice_() { + private connectDevice_(): void { this.pageState_ = PageState.CONNECTING; getBluetoothConfig().connect(this.deviceId_).then(response => { this.handleConnectResult_(response.success); }); } - /** - * @param {boolean} success - * @private - */ - handleConnectResult_(success) { + private handleConnectResult_(success: boolean): void { this.pageState_ = success ? PageState.CONNECTED : PageState.CONNECTION_FAILED; } - /** @private */ - disconnectDevice_() { + private disconnectDevice_(): void { this.pageState_ = PageState.DISCONNECTING; getBluetoothConfig().disconnect(this.deviceId_).then(response => { this.handleDisconnectResult_(response.success); }); } - /** - * @param {boolean} success - * @private - */ - handleDisconnectResult_(success) { + private handleDisconnectResult_(success: boolean): void { if (success) { this.pageState_ = PageState.DISCONNECTED; } } - /** - * @return {boolean} - * @private - */ - isConnectDisconnectBtnDisabled() { + private isConnectDisconnectBtnDisabled(): boolean { return this.pageState_ === PageState.CONNECTING || this.pageState_ === PageState.DISCONNECTING; } - /** - * @return {boolean} - * @private - */ - shouldShowErrorMessage_() { + private shouldShowErrorMessage_(): boolean { return this.pageState_ === PageState.CONNECTION_FAILED; } - /** - * @return {?PairedBluetoothDeviceProperties} - */ - getDeviceForTest() { + getDeviceForTest(): PairedBluetoothDeviceProperties|null { return this.device_; } - /** - * @return {string} - */ - getDeviceIdForTest() { + getDeviceIdForTest(): string { return this.deviceId_; } - /** @return {boolean} */ - getIsDeviceConnectedForTest() { + getIsDeviceConnectedForTest(): boolean { return this.isDeviceConnected_; } - /** @private */ - onMouseRowClick_() { + private onMouseRowClick_(): void { Router.getInstance().navigateTo(routes.POINTERS); } - /** @private */ - onKeyboardRowClick_() { + private onKeyboardRowClick_(): void { Router.getInstance().navigateTo(routes.KEYBOARD); } - /** - * @return {string} - * @private - */ - getForgetA11yLabel_() { + private getForgetA11yLabel_(): string { return this.i18n( 'bluetoothDeviceDetailForgetA11yLabel', this.getDeviceName_()); } - /** @private */ - onForgetButtonClicked_() { + private onForgetButtonClicked_(): void { if (loadTimeData.getBoolean('enableFastPairFlag')) { this.shouldShowForgetDeviceDialog_ = true; } else { @@ -650,17 +521,25 @@ class SettingsBluetoothDeviceDetailSubpageElement extends } } - /** @private */ - onCloseForgetDeviceDialog_() { + private onCloseForgetDeviceDialog_(): void { this.shouldShowForgetDeviceDialog_ = false; } - /** @private */ - forgetDeviceConfirmed_() { + private forgetDeviceConfirmed_(): void { getBluetoothConfig().forget(this.deviceId_); } } +declare global { + interface HTMLElementTagNameMap { + [SettingsBluetoothDeviceDetailSubpageElement.is]: + SettingsBluetoothDeviceDetailSubpageElement; + } + interface HTMLElementEventMap { + 'forget-bluetooth-device': Event; + } +} + customElements.define( SettingsBluetoothDeviceDetailSubpageElement.is, SettingsBluetoothDeviceDetailSubpageElement); diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js index 3dd58b4dcd282..91d819ca405ce 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js @@ -13,19 +13,20 @@ import './settings_fast_pair_toggle.js'; import {BluetoothUiSurface, recordBluetoothUiSurfaceMetrics} from 'chrome://resources/ash/common/bluetooth/bluetooth_metrics_utils.js'; import {getBluetoothConfig} from 'chrome://resources/ash/common/bluetooth/cros_bluetooth_config.js'; -import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; +import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {BluetoothSystemProperties, BluetoothSystemState, DeviceConnectionState, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; -import {Route, Router} from '../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; +import {Route, Router} from '../router.js'; +import {getTemplate} from './os_bluetooth_devices_subpage.html.js'; import {OsBluetoothDevicesSubpageBrowserProxy, OsBluetoothDevicesSubpageBrowserProxyImpl} from './os_bluetooth_devices_subpage_browser_proxy.js'; /** @@ -53,7 +54,7 @@ class SettingsBluetoothDevicesSubpageElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.ts similarity index 60% rename from chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.js rename to chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.ts index db08ad7dcea97..55573fe738f6f 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.ts @@ -8,62 +8,54 @@ */ import '../../settings_shared.css.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {getDeviceName} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; -/** - * @constructor - * @extends {PolymerElement} - * @implements {I18nBehaviorInterface} - */ +import {getTemplate} from './os_bluetooth_forget_device_dialog.html.js'; + +interface SettingsBluetoothForgetDeviceDialogElement { + $: {dialog: CrDialogElement}; +} + const SettingsBluetoothForgetDeviceDialogElementBase = - mixinBehaviors([I18nBehavior], PolymerElement); -/** @polymer */ + I18nMixin(PolymerElement); + class SettingsBluetoothForgetDeviceDialogElement extends SettingsBluetoothForgetDeviceDialogElementBase { static get is() { - return 'os-settings-bluetooth-forget-device-dialog'; + return 'os-settings-bluetooth-forget-device-dialog' as const; } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { return { - /** - * @private {!PairedBluetoothDeviceProperties} - */ device_: { type: Object, }, }; } - /** - * @private - */ - getForgetDeviceDialogBodyText_() { + + private device_: PairedBluetoothDeviceProperties; + + private getForgetDeviceDialogBodyText_(): string { return this.i18n( 'bluetoothDevicesDialogLabel', this.getDeviceName_(), loadTimeData.getString('primaryUserEmail')); } - /** - * @return {string} - * @private - */ - getDeviceName_() { + private getDeviceName_(): string { return getDeviceName(this.device_); } - /** - * @param {!Event} event - * @private - */ - onForgetTap_(event) { + private onForgetTap_(event: Event): void { const fireEvent = new CustomEvent( 'forget-bluetooth-device', {bubbles: true, composed: true}); this.dispatchEvent(fireEvent); @@ -71,11 +63,18 @@ class SettingsBluetoothForgetDeviceDialogElement extends event.stopPropagation(); } - /** @private */ - onCancelClick_(event) { + private onCancelClick_(): void { this.$.dialog.close(); } } + +declare global { + interface HTMLElementTagNameMap { + [SettingsBluetoothForgetDeviceDialogElement.is]: + SettingsBluetoothForgetDeviceDialogElement; + } +} + customElements.define( SettingsBluetoothForgetDeviceDialogElement.is, SettingsBluetoothForgetDeviceDialogElement); diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_page.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_page.js index efb322bcfdf09..66cbe73dd71c4 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_page.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_page.js @@ -20,7 +20,9 @@ import './os_bluetooth_pairing_dialog.js'; import {getBluetoothConfig} from 'chrome://resources/ash/common/bluetooth/cros_bluetooth_config.js'; import {I18nBehavior} from 'chrome://resources/ash/common/i18n_behavior.js'; import {BluetoothSystemProperties, BluetoothSystemState, SystemPropertiesObserverInterface, SystemPropertiesObserverReceiver} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './os_bluetooth_page.html.js'; /** * @constructor @@ -36,7 +38,7 @@ class SettingsBluetoothPageElement extends SettingsBluetoothPageElementBase { } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.ts similarity index 54% rename from chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.js rename to chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.ts index 6c86c7f2048ab..8ac8bf649585b 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.ts @@ -7,36 +7,45 @@ * UI element for displaying Bluetooth pairing dialog. */ import 'chrome://resources/ash/common/bluetooth/bluetooth_pairing_ui.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {BluetoothUiSurface, recordBluetoothUiSurfaceMetrics} from 'chrome://resources/ash/common/bluetooth/bluetooth_metrics_utils.js'; -import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './os_bluetooth_pairing_dialog.html.js'; + +interface SettingsBluetoothPairingDialogElement { + $: {dialog: CrDialogElement}; +} -/** @polymer */ class SettingsBluetoothPairingDialogElement extends PolymerElement { static get is() { - return 'os-settings-bluetooth-pairing-dialog'; + return 'os-settings-bluetooth-pairing-dialog' as const; } static get template() { - return html`{__html_template__}`; + return getTemplate(); } - /** @override */ - connectedCallback() { + override connectedCallback(): void { super.connectedCallback(); recordBluetoothUiSurfaceMetrics(BluetoothUiSurface.SETTINGS_PAIRING_DIALOG); } - /** - * @param {!Event} e - * @private - */ - closeDialog_(e) { + private closeDialog_(e: Event): void { this.$.dialog.close(); e.stopPropagation(); } } +declare global { + interface HTMLElementTagNameMap { + [SettingsBluetoothPairingDialogElement.is]: + SettingsBluetoothPairingDialogElement; + } +} + customElements.define( SettingsBluetoothPairingDialogElement.is, SettingsBluetoothPairingDialogElement); diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js index 1879f6b14eb71..00deeeb4c952e 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js @@ -10,18 +10,19 @@ import '../../settings_shared.css.js'; import './os_saved_devices_list.js'; -import {FastPairSavedDevicesUiEvent, recordSavedDevicesUiEventMetrics} from 'chrome://resources/ash/common/bluetooth/bluetooth_metrics_utils.js'; import {assertNotReached} from 'chrome://resources/ash/common/assert.js'; +import {FastPairSavedDevicesUiEvent, recordSavedDevicesUiEventMetrics} from 'chrome://resources/ash/common/bluetooth/bluetooth_metrics_utils.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {Route, Router} from '../router.js'; import {routes} from '../os_route.js'; import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; +import {Route, Router} from '../router.js'; import {OsBluetoothDevicesSubpageBrowserProxy, OsBluetoothDevicesSubpageBrowserProxyImpl} from './os_bluetooth_devices_subpage_browser_proxy.js'; +import {getTemplate} from './os_bluetooth_saved_devices_subpage.html.js'; import {FastPairSavedDevice, FastPairSavedDevicesOptInStatus} from './settings_fast_pair_constants.js'; /** @@ -47,7 +48,7 @@ class SettingsBluetoothSavedDevicesSubpageElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_summary.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_summary.js index ea6dd463d2b12..fa69b9afb300f 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_summary.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_summary.js @@ -14,16 +14,18 @@ import 'chrome://resources/cr_elements/icons.html.js'; import {getDeviceName} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; import {getBluetoothConfig} from 'chrome://resources/ash/common/bluetooth/cros_bluetooth_config.js'; -import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; +import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {BluetoothSystemProperties, BluetoothSystemState, DeviceConnectionState, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; -import {Router} from '../router.js'; import {routes} from '../os_route.js'; import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; import {RouteOriginBehavior, RouteOriginBehaviorInterface} from '../route_origin_behavior.js'; +import {Router} from '../router.js'; + +import {getTemplate} from './os_bluetooth_summary.html.js'; /** * Refers to Bluetooth secondary text label, used to distinguish between @@ -53,7 +55,7 @@ class SettingsBluetoothSummaryElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js index 52b138cdc0416..99f52f07d25cb 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js @@ -11,12 +11,14 @@ import '../../settings_shared.css.js'; import 'chrome://resources/ash/common/bluetooth/bluetooth_battery_icon_percentage.js'; +import {assertNotReached} from 'chrome://resources/ash/common/assert.js'; import {BatteryType} from 'chrome://resources/ash/common/bluetooth/bluetooth_types.js'; import {getBatteryPercentage, hasAnyDetailedBatteryInfo, hasDefaultImage, hasTrueWirelessImages} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; -import {assertNotReached} from 'chrome://resources/ash/common/assert.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {BluetoothDeviceProperties, DeviceConnectionState} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './os_bluetooth_true_wireless_images.html.js'; /** * @constructor @@ -34,7 +36,7 @@ export class SettingsBluetoothTrueWirelessImagesElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list.js index 2ee011b55e171..620148d5f1f98 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list.js @@ -13,8 +13,9 @@ import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import {CrScrollableBehavior, CrScrollableBehaviorInterface} from 'chrome://resources/ash/common/cr_scrollable_behavior.js'; import {PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {getTemplate} from './os_paired_bluetooth_list.html.js'; /** * @constructor * @extends {PolymerElement} @@ -31,7 +32,7 @@ class SettingsPairedBluetoothListElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js index cc6feb2302a6c..9bca56f0c7870 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js @@ -15,16 +15,18 @@ import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/ash/common/bluetooth/bluetooth_icon.js'; import 'chrome://resources/ash/common/bluetooth/bluetooth_device_battery_info.js'; +import {assert, assertNotReached} from 'chrome://resources/ash/common/assert.js'; import {BatteryType} from 'chrome://resources/ash/common/bluetooth/bluetooth_types.js'; import {getBatteryPercentage, getDeviceName, hasAnyDetailedBatteryInfo} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; import {FocusRowBehavior, FocusRowBehaviorInterface} from 'chrome://resources/ash/common/focus_row_behavior.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; -import {assert, assertNotReached} from 'chrome://resources/ash/common/assert.js'; import {DeviceConnectionState, DeviceType, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {Router} from '../router.js'; import {routes} from '../os_route.js'; +import {Router} from '../router.js'; + +import {getTemplate} from './os_paired_bluetooth_list_item.html.js'; /** * @constructor @@ -43,7 +45,7 @@ class SettingsPairedBluetoothListItemElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js index 549c077979cdd..2ac6203d7dbdf 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js @@ -11,13 +11,13 @@ import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import {FastPairSavedDevicesUiEvent, recordSavedDevicesUiEventMetrics} from 'chrome://resources/ash/common/bluetooth/bluetooth_metrics_utils.js'; import {getDeviceName} from 'chrome://resources/ash/common/bluetooth/bluetooth_utils.js'; -import {addWebUIListener, removeWebUIListener, WebUIListener} from 'chrome://resources/ash/common/cr.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {getTemplate} from './os_remove_saved_device_dialog.html.js'; import {FastPairSavedDevice} from './settings_fast_pair_constants.js'; /** @@ -36,7 +36,7 @@ class SettingsBluetoothRemoveSavedDeviceDialogElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list.js index 1eaa7742af261..4bf2946caca77 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list.js @@ -14,9 +14,10 @@ import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import {CrScrollableBehavior, CrScrollableBehaviorInterface} from 'chrome://resources/ash/common/cr_scrollable_behavior.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {OsBluetoothDevicesSubpageBrowserProxy, OsBluetoothDevicesSubpageBrowserProxyImpl} from './os_bluetooth_devices_subpage_browser_proxy.js'; +import {getTemplate} from './os_saved_devices_list.html.js'; import {FastPairSavedDevice} from './settings_fast_pair_constants.js'; /** @@ -38,7 +39,7 @@ class SettingsSavedDevicesListElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list_item.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list_item.js index f528a6bf226f1..9dd71320fbe96 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list_item.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_saved_devices_list_item.js @@ -17,9 +17,9 @@ import {FastPairSavedDevicesUiEvent, recordSavedDevicesUiEventMetrics} from 'chr import {FocusRowBehavior, FocusRowBehaviorInterface} from 'chrome://resources/ash/common/focus_row_behavior.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/ash/common/web_ui_listener_behavior.js'; -import {addWebUIListener, removeWebUIListener, WebUIListener} from 'chrome://resources/ash/common/cr.m.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {getTemplate} from './os_saved_devices_list_item.html.js'; import {FastPairSavedDevice} from './settings_fast_pair_constants.js'; /** @@ -40,7 +40,7 @@ class SettingsSavedDevicesListItemElement extends } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/settings_fast_pair_toggle.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/settings_fast_pair_toggle.js index 57eaaff18267c..f643749ef50ab 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/settings_fast_pair_toggle.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/settings_fast_pair_toggle.js @@ -9,7 +9,9 @@ import '../../controls/settings_toggle_button.js'; -import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './settings_fast_pair_toggle.html.js'; /** @polymer */ class SettingsFastPairToggleElement extends PolymerElement { @@ -18,7 +20,7 @@ class SettingsFastPairToggleElement extends PolymerElement { } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { diff --git a/chrome/browser/resources/settings/chromeos/os_settings.gni b/chrome/browser/resources/settings/chromeos/os_settings.gni index ab98e3dff4a8e..3e138f4fee723 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings.gni +++ b/chrome/browser/resources/settings/chromeos/os_settings.gni @@ -113,6 +113,21 @@ web_component_files = [ "chromeos/os_apps_page/app_notifications_page/app_notification_row.ts", "chromeos/os_apps_page/app_notifications_page/app_notifications_subpage.ts", "chromeos/os_apps_page/os_apps_page.ts", + "chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.ts", + "chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.ts", + "chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.ts", + "chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.ts", + "chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js", + "chromeos/os_bluetooth_page/os_bluetooth_page.js", + "chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js", + "chromeos/os_bluetooth_page/os_bluetooth_summary.js", + "chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js", + "chromeos/os_bluetooth_page/os_paired_bluetooth_list.js", + "chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js", + "chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js", + "chromeos/os_bluetooth_page/os_saved_devices_list.js", + "chromeos/os_bluetooth_page/os_saved_devices_list_item.js", + "chromeos/os_bluetooth_page/settings_fast_pair_toggle.js", "chromeos/os_files_page/os_files_page.ts", "chromeos/os_files_page/smb_shares_page.ts", "chromeos/os_languages_page/add_input_methods_dialog.js", @@ -383,21 +398,6 @@ generated_web_component_files = [ "chromeos/nearby_share_page/nearby_share_receive_dialog.js", "chromeos/nearby_share_page/nearby_share_subpage.js", "chromeos/os_a11y_page/manage_a11y_page.js", - "chromeos/os_bluetooth_page/os_bluetooth_change_device_name_dialog.js", - "chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js", - "chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js", - "chromeos/os_bluetooth_page/os_bluetooth_forget_device_dialog.js", - "chromeos/os_bluetooth_page/os_bluetooth_page.js", - "chromeos/os_bluetooth_page/os_bluetooth_pairing_dialog.js", - "chromeos/os_bluetooth_page/os_bluetooth_saved_devices_subpage.js", - "chromeos/os_bluetooth_page/os_bluetooth_summary.js", - "chromeos/os_bluetooth_page/os_bluetooth_true_wireless_images.js", - "chromeos/os_bluetooth_page/os_paired_bluetooth_list.js", - "chromeos/os_bluetooth_page/os_paired_bluetooth_list_item.js", - "chromeos/os_bluetooth_page/os_remove_saved_device_dialog.js", - "chromeos/os_bluetooth_page/os_saved_devices_list.js", - "chromeos/os_bluetooth_page/os_saved_devices_list_item.js", - "chromeos/os_bluetooth_page/settings_fast_pair_toggle.js", "chromeos/os_people_page/account_manager.js", "chromeos/os_people_page/fingerprint_list.js", "chromeos/os_people_page/local_data_recovery_dialog.js",