| OLD | NEW |
| 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 | 6 |
| 7 var BASE_KEYBOARD = { | 7 var BASE_KEYBOARD = { |
| 8 top: 0, | 8 top: 0, |
| 9 left: 0, | 9 left: 0, |
| 10 width: 1237, | 10 width: 1237, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 if (!isDisplayUIScalingEnabled()) { | 206 if (!isDisplayUIScalingEnabled()) { |
| 207 // Zoom screen in | 207 // Zoom screen in |
| 208 delete shortcutDataCache['+<>CTRL<>SHIFT']; | 208 delete shortcutDataCache['+<>CTRL<>SHIFT']; |
| 209 // Zoom screen out | 209 // Zoom screen out |
| 210 delete shortcutDataCache['-<>CTRL<>SHIFT']; | 210 delete shortcutDataCache['-<>CTRL<>SHIFT']; |
| 211 // Reset screen zoom | 211 // Reset screen zoom |
| 212 delete shortcutDataCache['0<>CTRL<>SHIFT']; | 212 delete shortcutDataCache['0<>CTRL<>SHIFT']; |
| 213 } | 213 } |
| 214 | 214 |
| 215 if (!loadTimeData.getBoolean('backspaceGoesBackFeatureEnabled')) { |
| 216 // If the "backspace key goes back" experiment is not enabled, then we |
| 217 // clear the shortcuts for Backspace and Shift+Backspace to go back or |
| 218 // forward respectively. |
| 219 delete shortcutDataCache['backspace']; |
| 220 delete shortcutDataCache['backspace<>SHIFT']; |
| 221 } |
| 222 |
| 215 return shortcutDataCache; | 223 return shortcutDataCache; |
| 216 } | 224 } |
| 217 | 225 |
| 218 /** | 226 /** |
| 219 * Returns the keyboard overlay ID. | 227 * Returns the keyboard overlay ID. |
| 220 * @return {string} Keyboard overlay ID. | 228 * @return {string} Keyboard overlay ID. |
| 221 */ | 229 */ |
| 222 function getKeyboardOverlayId() { | 230 function getKeyboardOverlayId() { |
| 223 return keyboardOverlayId; | 231 return keyboardOverlayId; |
| 224 } | 232 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 var shortcutId = shortcutData[getAction(keyLabel, normModifiers)]; | 556 var shortcutId = shortcutData[getAction(keyLabel, normModifiers)]; |
| 549 if (modifiers.length == 0 && | 557 if (modifiers.length == 0 && |
| 550 (identifier == '2A' || identifier == '36')) { | 558 (identifier == '2A' || identifier == '36')) { |
| 551 // Either the right or left shift keys are used to disable the caps lock | 559 // Either the right or left shift keys are used to disable the caps lock |
| 552 // if it was enabled. To fix crbug.com/453623. | 560 // if it was enabled. To fix crbug.com/453623. |
| 553 shortcutId = 'keyboardOverlayDisableCapsLock'; | 561 shortcutId = 'keyboardOverlayDisableCapsLock'; |
| 554 } | 562 } |
| 555 | 563 |
| 556 classes.push('keyboard-overlay-key-background'); | 564 classes.push('keyboard-overlay-key-background'); |
| 557 | 565 |
| 558 if ((shortcutId == 'keyboardOverlayGoBack' || | |
| 559 shortcutId == 'keyboardOverlayGoForward') && | |
| 560 !loadTimeData.getBoolean('backspaceGoesBackFeatureEnabled')) { | |
| 561 // If the "backspace key goes back" experiment is not enabled, then we | |
| 562 // clear the shortcuts for Backspace and Shift+Backspace to go back or | |
| 563 // forward respectively. | |
| 564 shortcutId = null; | |
| 565 } | |
| 566 | |
| 567 if (shortcutId) { | 566 if (shortcutId) { |
| 568 classes.push('is-shortcut'); | 567 classes.push('is-shortcut'); |
| 569 classes.push('keyboard-overlay-shortcut-key-background'); | 568 classes.push('keyboard-overlay-shortcut-key-background'); |
| 570 } | 569 } |
| 571 | 570 |
| 572 var key = $(keyId(identifier, i)); | 571 var key = $(keyId(identifier, i)); |
| 573 key.className = classes.join(' '); | 572 key.className = classes.join(' '); |
| 574 | 573 |
| 575 if (!keyData) { | 574 if (!keyData) { |
| 576 continue; | 575 continue; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 function onWidgetShown() { | 937 function onWidgetShown() { |
| 939 setTimeout(function() { | 938 setTimeout(function() { |
| 940 // Show and focus the instructions div after a delay so that chrome vox | 939 // Show and focus the instructions div after a delay so that chrome vox |
| 941 // speaks it correctly. | 940 // speaks it correctly. |
| 942 $('instructions').style.visibility = 'visible'; | 941 $('instructions').style.visibility = 'visible'; |
| 943 $('instructions').focus(); | 942 $('instructions').focus(); |
| 944 }, 500); | 943 }, 500); |
| 945 } | 944 } |
| 946 | 945 |
| 947 document.addEventListener('DOMContentLoaded', init); | 946 document.addEventListener('DOMContentLoaded', init); |
| OLD | NEW |