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

Side by Side Diff: chrome/browser/resources/chromeos/keyboard_overlay.js

Issue 11578044: Enable Search-key modifiers for extended key shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="keyboard_overlay_data.js"/> 5 <include src="keyboard_overlay_data.js"/>
6 <include src="keyboard_overlay_accessibility_helper.js"/> 6 <include src="keyboard_overlay_accessibility_helper.js"/>
7 7
8 var BASE_KEYBOARD = { 8 var BASE_KEYBOARD = {
9 top: 0, 9 top: 0,
10 left: 0, 10 left: 0,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 /** 124 /**
125 * Returns shortcut data. 125 * Returns shortcut data.
126 * @return {Object} Keyboard shortcut data. 126 * @return {Object} Keyboard shortcut data.
127 */ 127 */
128 function getShortcutData() { 128 function getShortcutData() {
129 if (shortcutDataCache) 129 if (shortcutDataCache)
130 return shortcutDataCache; 130 return shortcutDataCache;
131 131
132 shortcutDataCache = keyboardOverlayData['shortcut']; 132 shortcutDataCache = keyboardOverlayData['shortcut'];
133 133
134 var searchKeyIsModifier = 134 // TODO(mazda): Clean this up and move these out to the data js.
135 loadTimeData.getString('keyboardSearchKeyActsAsFunctionKey') == 'true'; 135 var searchModifierAddShortcuts = {
136 if (searchKeyIsModifier) { 136 '1<>SEARCH': 'keyboardOverlayF1',
137 // TODO(mazda): Clean this up and move these out to the data js. 137 '2<>SEARCH': 'keyboardOverlayF2',
138 var searchModifierRemoveShortcuts = { 138 '3<>SEARCH': 'keyboardOverlayF3',
139 'backspace<>ALT': 'keyboardOverlayDelete', 139 '4<>SEARCH': 'keyboardOverlayF4',
140 'down<>ALT': 'keyboardOverlayPageDown', 140 '5<>SEARCH': 'keyboardOverlayF5',
141 'down<>ALT<>CTRL': 'keyboardOverlayEnd', 141 '6<>SEARCH': 'keyboardOverlayF6',
142 'up<>ALT': 'keyboardOverlayPageUp', 142 '7<>SEARCH': 'keyboardOverlayF7',
143 'up<>ALT<>CTRL': 'keyboardOverlayHome' 143 '8<>SEARCH': 'keyboardOverlayF8',
144 }; 144 '9<>SEARCH': 'keyboardOverlayF9',
145 var searchModifierAddShortcuts = { 145 '0<>SEARCH': 'keyboardOverlayF10',
146 '1<>SEARCH': 'keyboardOverlayF1', 146 '-<>SEARCH': 'keyboardOverlayF11',
147 '2<>SEARCH': 'keyboardOverlayF2', 147 '=<>SEARCH': 'keyboardOverlayF12',
148 '3<>SEARCH': 'keyboardOverlayF3', 148 'F1<>SEARCH': 'keyboardOverlayF1',
149 '4<>SEARCH': 'keyboardOverlayF4', 149 'F2<>SEARCH': 'keyboardOverlayF2',
150 '5<>SEARCH': 'keyboardOverlayF5', 150 'F3<>SEARCH': 'keyboardOverlayF3',
151 '6<>SEARCH': 'keyboardOverlayF6', 151 'F4<>SEARCH': 'keyboardOverlayF4',
152 '7<>SEARCH': 'keyboardOverlayF7', 152 'F5<>SEARCH': 'keyboardOverlayF5',
153 '8<>SEARCH': 'keyboardOverlayF8', 153 'F6<>SEARCH': 'keyboardOverlayF6',
154 '9<>SEARCH': 'keyboardOverlayF9', 154 'F7<>SEARCH': 'keyboardOverlayF7',
155 '0<>SEARCH': 'keyboardOverlayF10', 155 'F8<>SEARCH': 'keyboardOverlayF8',
156 '-<>SEARCH': 'keyboardOverlayF11', 156 'F9<>SEARCH': 'keyboardOverlayF9',
157 '=<>SEARCH': 'keyboardOverlayF12', 157 'F10<>SEARCH': 'keyboardOverlayF10',
158 'F1<>SEARCH': 'keyboardOverlayF1', 158 'F11<>SEARCH': 'keyboardOverlayF11',
159 'F2<>SEARCH': 'keyboardOverlayF2', 159 'F12<>SEARCH': 'keyboardOverlayF12',
160 'F3<>SEARCH': 'keyboardOverlayF3', 160 'back<>SEARCH': 'keyboardOverlayF1',
161 'F4<>SEARCH': 'keyboardOverlayF4', 161 'forward<>SEARCH': 'keyboardOverlayF2',
162 'F5<>SEARCH': 'keyboardOverlayF5', 162 'reload<>SEARCH': 'keyboardOverlayF3',
163 'F6<>SEARCH': 'keyboardOverlayF6', 163 'maximize<>SEARCH': 'keyboardOverlayF4',
164 'F7<>SEARCH': 'keyboardOverlayF7', 164 'switch window<>SEARCH': 'keyboardOverlayF5',
165 'F8<>SEARCH': 'keyboardOverlayF8', 165 'bright down<>SEARCH': 'keyboardOverlayF6',
166 'F9<>SEARCH': 'keyboardOverlayF9', 166 'bright up<>SEARCH': 'keyboardOverlayF7',
167 'F10<>SEARCH': 'keyboardOverlayF10', 167 'mute<>SEARCH': 'keyboardOverlayF8',
168 'F11<>SEARCH': 'keyboardOverlayF11', 168 'vol. down<>SEARCH': 'keyboardOverlayF9',
169 'F12<>SEARCH': 'keyboardOverlayF12', 169 'vol. up<>SEARCH': 'keyboardOverlayF10',
170 'back<>SEARCH': 'keyboardOverlayF1', 170 'backspace<>SEARCH': 'keyboardOverlayDelete',
171 'forward<>SEARCH': 'keyboardOverlayF2', 171 'down<>SEARCH': 'keyboardOverlayPageDown',
172 'reload<>SEARCH': 'keyboardOverlayF3', 172 'right<>SEARCH': 'keyboardOverlayEnd',
173 'maximize<>SEARCH': 'keyboardOverlayF4', 173 'up<>SEARCH': 'keyboardOverlayPageUp',
174 'switch window<>SEARCH': 'keyboardOverlayF5', 174 'left<>SEARCH': 'keyboardOverlayHome',
175 'bright down<>SEARCH': 'keyboardOverlayF6', 175 '.<>SEARCH': 'keyboardOverlayInsert'
176 'bright up<>SEARCH': 'keyboardOverlayF7', 176 };
177 'mute<>SEARCH': 'keyboardOverlayF8', 177 for (var key in searchModifierAddShortcuts)
178 'vol. down<>SEARCH': 'keyboardOverlayF9', 178 shortcutDataCache[key] = searchModifierAddShortcuts[key];
179 'vol. up<>SEARCH': 'keyboardOverlayF10',
180 'backspace<>SEARCH': 'keyboardOverlayDelete',
181 'down<>SEARCH': 'keyboardOverlayPageDown',
182 'right<>SEARCH': 'keyboardOverlayEnd',
183 'up<>SEARCH': 'keyboardOverlayPageUp',
184 'left<>SEARCH': 'keyboardOverlayHome',
185 '.<>SEARCH': 'keyboardOverlayInsert'
186 };
187
188 for (var key in searchModifierRemoveShortcuts)
189 delete shortcutDataCache[key];
190 for (var key in searchModifierAddShortcuts)
191 shortcutDataCache[key] = searchModifierAddShortcuts[key];
192 }
193
194 return shortcutDataCache; 179 return shortcutDataCache;
195 } 180 }
196 181
197 /** 182 /**
198 * Returns the keyboard overlay ID. 183 * Returns the keyboard overlay ID.
199 * @return {string} Keyboard overlay ID. 184 * @return {string} Keyboard overlay ID.
200 */ 185 */
201 function getKeyboardOverlayId() { 186 function getKeyboardOverlayId() {
202 return keyboardOverlayId; 187 return keyboardOverlayId;
203 } 188 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) * 571 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) *
587 height / BASE_KEYBOARD.height + minY) + 'px'; 572 height / BASE_KEYBOARD.height + minY) + 'px';
588 instructions.style.width = (width * BASE_INSTRUCTIONS.width / 573 instructions.style.width = (width * BASE_INSTRUCTIONS.width /
589 BASE_KEYBOARD.width) + 'px'; 574 BASE_KEYBOARD.width) + 'px';
590 instructions.style.height = (height * BASE_INSTRUCTIONS.height / 575 instructions.style.height = (height * BASE_INSTRUCTIONS.height /
591 BASE_KEYBOARD.height) + 'px'; 576 BASE_KEYBOARD.height) + 'px';
592 577
593 var instructionsText = document.createElement('div'); 578 var instructionsText = document.createElement('div');
594 instructionsText.id = 'instructions-text'; 579 instructionsText.id = 'instructions-text';
595 instructionsText.className = 'keyboard-overlay-instructions-text'; 580 instructionsText.className = 'keyboard-overlay-instructions-text';
596 var searchKeyIsModifier = 581 instructionsText.innerHTML =
597 loadTimeData.getString('keyboardSearchKeyActsAsFunctionKey') == 'true'; 582 loadTimeData.getString('keyboardOverlayInstructions');
598 if (searchKeyIsModifier) {
599 instructionsText.innerHTML =
600 loadTimeData.getString('keyboardOverlayInstructionsWithSearch');
601 } else {
602 instructionsText.innerHTML =
603 loadTimeData.getString('keyboardOverlayInstructions');
604 }
605 instructions.appendChild(instructionsText); 583 instructions.appendChild(instructionsText);
606 var instructionsHideText = document.createElement('div'); 584 var instructionsHideText = document.createElement('div');
607 instructionsHideText.id = 'instructions-hide-text'; 585 instructionsHideText.id = 'instructions-hide-text';
608 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text'; 586 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text';
609 instructionsHideText.innerHTML = 587 instructionsHideText.innerHTML =
610 loadTimeData.getString('keyboardOverlayInstructionsHide'); 588 loadTimeData.getString('keyboardOverlayInstructionsHide');
611 instructions.appendChild(instructionsHideText); 589 instructions.appendChild(instructionsHideText);
612 var learnMoreLinkText = document.createElement('div'); 590 var learnMoreLinkText = document.createElement('div');
613 learnMoreLinkText.id = 'learn-more-text'; 591 learnMoreLinkText.id = 'learn-more-text';
614 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text'; 592 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text';
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 * Handles click events of the learn more link. 662 * Handles click events of the learn more link.
685 * @param {Event} e Mouse click event. 663 * @param {Event} e Mouse click event.
686 */ 664 */
687 function learnMoreClicked(e) { 665 function learnMoreClicked(e) {
688 chrome.send('openLearnMorePage'); 666 chrome.send('openLearnMorePage');
689 chrome.send('DialogClose'); 667 chrome.send('DialogClose');
690 e.preventDefault(); 668 e.preventDefault();
691 } 669 }
692 670
693 document.addEventListener('DOMContentLoaded', init); 671 document.addEventListener('DOMContentLoaded', init);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/ui/ash/chrome_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698