-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Settings Split: Add Routes for keyboard remapping page
- Add routes for keyboard remapping subpage. - Implement remap keys button click function redirecting to a subpage. - Pass keyboardId to the subpage using url query. Screenshot: click remap button under fake keyboard id 0: https://screenshot.googleplex.com/8nRofHktb2MZusr click remap button under fake keyboard id 8: https://screenshot.googleplex.com/8xwHHvjmQHdgFgR Bug: b/241965700 Test: browser_tests OSSettingsPerDeviceKeyboardSubsectionV3Test Change-Id: Ia631ea21dc74a2e376ac12a2dd0991382bd46cb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4230954 Commit-Queue: Yuhan Yang <yyhyyh@google.com> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org> Reviewed-by: David Padlipsky <dpad@google.com> Cr-Commit-Position: refs/heads/main@{#1104730}
- Loading branch information
Showing
14 changed files
with
175 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
chrome/browser/resources/settings/chromeos/device_page/per_device_keyboard_remap_keys.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h2>{{keyboardId}}</h2> |
84 changes: 84 additions & 0 deletions
84
chrome/browser/resources/settings/chromeos/device_page/per_device_keyboard_remap_keys.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/** | ||
* @fileoverview | ||
* 'per-device-keyboard-settings-remap-keys' displays the remapped keys and | ||
* allow users to configure their keyboard remapped keys for each keyboard. | ||
*/ | ||
|
||
import '../../icons.html.js'; | ||
import '../../settings_shared.css.js'; | ||
|
||
import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js'; | ||
import {assert} from 'chrome://resources/js/assert_ts.js'; | ||
import {PolymerElementProperties} from 'chrome://resources/polymer/v3_0/polymer/interfaces.js'; | ||
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; | ||
|
||
import {routes} from '../os_route.js'; | ||
import {RouteObserverMixin, RouteObserverMixinInterface} from '../route_observer_mixin.js'; | ||
import {Route, Router} from '../router.js'; | ||
|
||
import {Keyboard} from './input_device_settings_types.js'; | ||
import {getTemplate} from './per_device_keyboard_remap_keys.html.js'; | ||
|
||
const SettingsPerDeviceKeyboardRemapKeysElementBase = | ||
RouteObserverMixin(I18nMixin(PolymerElement)) as { | ||
new (): PolymerElement & I18nMixinInterface & RouteObserverMixinInterface, | ||
}; | ||
|
||
export class SettingsPerDeviceKeyboardRemapKeysElement extends | ||
SettingsPerDeviceKeyboardRemapKeysElementBase { | ||
static get is(): string { | ||
return 'settings-per-device-keyboard-remap-keys'; | ||
} | ||
|
||
static get template(): HTMLTemplateElement { | ||
return getTemplate(); | ||
} | ||
|
||
static get properties(): PolymerElementProperties { | ||
return { | ||
keyboardId: String, | ||
|
||
keyboard: { | ||
type: Object, | ||
}, | ||
}; | ||
} | ||
|
||
protected keyboard: Keyboard; | ||
// This variable is temporary and only to verify the remapping subpage has | ||
// receive the correct keyboardId. Will remove it from properties after | ||
// implementing getKeyboard() method. | ||
private keyboardId: string; | ||
|
||
override currentRouteChanged(route: Route): void { | ||
// Does not apply to this page. | ||
if (route !== routes.PER_DEVICE_KEYBOARD_REMAP_KEYS) { | ||
return; | ||
} | ||
this.getKeyboard(); | ||
} | ||
|
||
private getKeyboard(): void { | ||
const keyboardId = | ||
Router.getInstance().getQueryParameters().get('keyboardId'); | ||
assert(keyboardId); | ||
this.keyboardId = keyboardId; | ||
// TODO(yyhyyh@): Get the keyboard object using keyboardId and remove | ||
// variable "this.keyboardId". | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'settings-per-device-keyboard-remap-keys': | ||
SettingsPerDeviceKeyboardRemapKeysElement; | ||
} | ||
} | ||
|
||
customElements.define( | ||
SettingsPerDeviceKeyboardRemapKeysElement.is, | ||
SettingsPerDeviceKeyboardRemapKeysElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters