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

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

Issue 1961133004: MD Settings: Add remaining buttons to keyboard subpage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: closure Created 4 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-keyboard' is the settings subpage with keyboard settings. 7 * 'settings-keyboard' is the settings subpage with keyboard settings.
8 */ 8 */
9 9
10 // TODO(michaelpg): The docs below are duplicates of settings_dropdown_menu, 10 // TODO(michaelpg): The docs below are duplicates of settings_dropdown_menu,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 PrefsBehavior, 46 PrefsBehavior,
47 ], 47 ],
48 48
49 properties: { 49 properties: {
50 /** Preferences state. */ 50 /** Preferences state. */
51 prefs: { 51 prefs: {
52 type: Object, 52 type: Object,
53 notify: true, 53 notify: true,
54 }, 54 },
55 55
56 /** The current active route. */
57 currentRoute: {
58 type: Object,
59 notify: true,
60 },
61
56 /** @private Whether to show Caps Lock options. */ 62 /** @private Whether to show Caps Lock options. */
57 showCapsLock_: Boolean, 63 showCapsLock_: Boolean,
58 64
59 /** @private Whether to show diamond key options. */ 65 /** @private Whether to show diamond key options. */
60 showDiamondKey_: Boolean, 66 showDiamondKey_: Boolean,
61 67
62 /** @private {!DropdownMenuOptionList} Menu items for key mapping. */ 68 /** @private {!DropdownMenuOptionList} Menu items for key mapping. */
63 keyMapTargets_: Object, 69 keyMapTargets_: Object,
64 70
65 /** 71 /**
66 * @private {!DropdownMenuOptionList} Menu items for key mapping, including 72 * @private {!DropdownMenuOptionList} Menu items for key mapping, including
67 * Caps Lock. 73 * Caps Lock.
68 */ 74 */
69 keyMapTargetsWithCapsLock_: Object, 75 keyMapTargetsWithCapsLock_: Object,
70 }, 76 },
71 77
72 observers: [ 78 observers: [
73 'autoRepeatDelayPrefChanged_(' + 79 'autoRepeatDelayPrefChanged_(' +
74 'prefs.' + AUTO_REPEAT_DELAY_PREF + '.*)', 80 'prefs.' + AUTO_REPEAT_DELAY_PREF + '.*)',
75 'autoRepeatIntervalPrefChanged_(' + 81 'autoRepeatIntervalPrefChanged_(' +
76 'prefs.' + AUTO_REPEAT_INTERVAL_PREF + '.*)', 82 'prefs.' + AUTO_REPEAT_INTERVAL_PREF + '.*)',
77 ], 83 ],
78 84
79 /** @override */ 85 /** @override */
80 ready: function() { 86 ready: function() {
81 cr.addWebUIListener('show-keys-changed', this.onShowKeysChange_.bind(this)); 87 cr.addWebUIListener('show-keys-changed', this.onShowKeysChange_.bind(this));
82 chrome.send('initializeKeyboardSettings'); 88 settings.DevicePageBrowserProxyImpl.getInstance().initializeKeyboard();
83 this.setUpKeyMapTargets_(); 89 this.setUpKeyMapTargets_();
84 }, 90 },
85 91
86 /** 92 /**
87 * Initializes the dropdown menu options for remapping keys. 93 * Initializes the dropdown menu options for remapping keys.
88 * @private 94 * @private
89 */ 95 */
90 setUpKeyMapTargets_: function() { 96 setUpKeyMapTargets_: function() {
91 this.keyMapTargets_ = [ 97 this.keyMapTargets_ = [
92 {value: 0, name: loadTimeData.getString('keyboardKeySearch')}, 98 {value: 0, name: loadTimeData.getString('keyboardKeySearch')},
(...skipping 15 matching lines...) Expand all
108 * Handler for updating which keys to show. 114 * Handler for updating which keys to show.
109 * @param {boolean} showCapsLock 115 * @param {boolean} showCapsLock
110 * @param {boolean} showDiamondKey 116 * @param {boolean} showDiamondKey
111 * @private 117 * @private
112 */ 118 */
113 onShowKeysChange_: function(showCapsLock, showDiamondKey) { 119 onShowKeysChange_: function(showCapsLock, showDiamondKey) {
114 this.showCapsLock_ = showCapsLock; 120 this.showCapsLock_ = showCapsLock;
115 this.showDiamondKey_ = showDiamondKey; 121 this.showDiamondKey_ = showDiamondKey;
116 }, 122 },
117 123
124 onShowKeyboardShortcutsOverlayTap_: function() {
125 settings.DevicePageBrowserProxyImpl.getInstance()
126 .showKeyboardShortcutsOverlay();
127 },
128
129 onShowLanguageInputTap_: function() {
130 this.currentRoute = {
131 page: 'advanced',
132 section: 'languages',
133 subpage: [],
134 };
135 },
136
118 /** @private */ 137 /** @private */
119 autoRepeatDelayPrefChanged_: function() { 138 autoRepeatDelayPrefChanged_: function() {
120 var delay = /** @type number */(this.getPref(AUTO_REPEAT_DELAY_PREF).value); 139 var delay = /** @type number */(this.getPref(AUTO_REPEAT_DELAY_PREF).value);
121 this.$.delaySlider.value = 140 this.$.delaySlider.value =
122 this.findNearestIndex_(AUTO_REPEAT_DELAYS, delay); 141 this.findNearestIndex_(AUTO_REPEAT_DELAYS, delay);
123 }, 142 },
124 143
125 /** @private */ 144 /** @private */
126 autoRepeatIntervalPrefChanged_: function() { 145 autoRepeatIntervalPrefChanged_: function() {
127 var interval = /** @type number */( 146 var interval = /** @type number */(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 var difference = Math.abs(arr[i] - value); 201 var difference = Math.abs(arr[i] - value);
183 if (difference < minDifference) { 202 if (difference < minDifference) {
184 closestIndex = i; 203 closestIndex = i;
185 minDifference = difference; 204 minDifference = difference;
186 } 205 }
187 } 206 }
188 207
189 return closestIndex; 208 return closestIndex;
190 }, 209 },
191 }); 210 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698