Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: chrome/browser/resources/settings/device_page/keyboard.js

Issue 1753653002: MD Settings: First half of Device > Keyboard sub-page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed one Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * 'settings-keyboard' is the settings subpage with keyboard settings.
8 *
9 * @group Chrome Settings Elements
10 */
11
12 // TODO(michaelpg): The docs below are duplicates of settings_dropdown_menu,
13 // because we can't depend on settings_dropdown_menu in compiled_resources2.gyp
14 // withhout first converting settings_dropdown_menu to compiled_resources2.gyp.
15 // After the conversion, we should remove these.
16 /** @typedef {{name: string, value: (number|string)}} */
17 var DropdownMenuOption;
18 /** @typedef {!Array<!DropdownMenuOption>} */
19 var DropdownMenuOptionList;
20
21 Polymer({
22 is: 'settings-keyboard',
23
24 behaviors: [
25 I18nBehavior,
26 ],
27
28 properties: {
29 /** Preferences state. */
30 prefs: {
31 type: Object,
32 notify: true,
33 },
34
35 /** @private Whether to show Caps Lock options. */
36 showCapsLock_: Boolean,
37
38 /** @private Whether to show diamond key options. */
39 showDiamondKey_: Boolean,
40
41 /** @private {!DropdownMenuOptionList} Menu items for key mapping. */
42 keyMapTargets_: Object,
43
44 /**
45 * @private {!DropdownMenuOptionList} Menu items for key mapping, including
46 * Caps Lock.
47 */
48 keyMapTargetsWithCapsLock_: Object,
49 },
50
51 /** @override */
52 ready: function() {
53 cr.addWebUIListener('show-keys-changed', this.onShowKeysChange_.bind(this));
54 chrome.send('initializeKeyboardSettings');
55 this.setUpKeyMapTargets_();
56 },
57
58 /**
59 * Initializes the dropdown menu options for remapping keys.
60 * @private
61 */
62 setUpKeyMapTargets_: function() {
63 this.keyMapTargets_ = [
64 {value: 0, name: loadTimeData.getString('keyboardKeySearch')},
65 {value: 1, name: loadTimeData.getString('keyboardKeyCtrl')},
66 {value: 2, name: loadTimeData.getString('keyboardKeyAlt')},
67 {value: 3, name: loadTimeData.getString('keyboardKeyDisabled')},
68 {value: 5, name: loadTimeData.getString('keyboardKeyEscape')},
69 ];
70
71 var keyMapTargetsWithCapsLock = this.keyMapTargets_.slice();
72 // Add Caps Lock, for keys allowed to be mapped to Caps Lock.
73 keyMapTargetsWithCapsLock.splice(4, 0, {
74 value: 4, name: loadTimeData.getString('keyboardKeyCapsLock'),
75 });
76 this.keyMapTargetsWithCapsLock_ = keyMapTargetsWithCapsLock;
77 },
78
79 /**
80 * Handler for updating which keys to show.
81 * @param {boolean} showCapsLock
82 * @param {boolean} showDiamondKey
83 * @private
84 */
85 onShowKeysChange_: function(showCapsLock, showDiamondKey) {
86 this.showCapsLock_ = showCapsLock;
87 this.showDiamondKey_ = showDiamondKey;
88 },
89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698