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 <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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 /** | 121 /** |
122 * Returns shortcut data. | 122 * Returns shortcut data. |
123 * @return {Object} Keyboard shortcut data. | 123 * @return {Object} Keyboard shortcut data. |
124 */ | 124 */ |
125 function getShortcutData() { | 125 function getShortcutData() { |
126 if (shortcutDataCache) | 126 if (shortcutDataCache) |
127 return shortcutDataCache; | 127 return shortcutDataCache; |
128 | 128 |
129 shortcutDataCache = keyboardOverlayData['shortcut']; | 129 shortcutDataCache = keyboardOverlayData['shortcut']; |
130 | 130 |
| 131 if (!isDisplayRotationEnabled()) { |
| 132 // Rotate screen |
| 133 delete shortcutDataCache['reload<>CTRL<>SHIFT']; |
| 134 } |
| 135 if (!isDisplayUIScalingEnabled()) { |
| 136 // Scale up UI |
| 137 delete shortcutDataCache['back<>CTRL<>SHIFT']; |
| 138 // Scale down UI |
| 139 delete shortcutDataCache['forward<>CTRL<>SHIFT']; |
| 140 } |
| 141 |
131 // TODO(mazda): Clean this up and move these out to the data js. | 142 // TODO(mazda): Clean this up and move these out to the data js. |
132 var searchModifierAddShortcuts = { | 143 var searchModifierAddShortcuts = { |
133 '1<>SEARCH': 'keyboardOverlayF1', | 144 '1<>SEARCH': 'keyboardOverlayF1', |
134 '2<>SEARCH': 'keyboardOverlayF2', | 145 '2<>SEARCH': 'keyboardOverlayF2', |
135 '3<>SEARCH': 'keyboardOverlayF3', | 146 '3<>SEARCH': 'keyboardOverlayF3', |
136 '4<>SEARCH': 'keyboardOverlayF4', | 147 '4<>SEARCH': 'keyboardOverlayF4', |
137 '5<>SEARCH': 'keyboardOverlayF5', | 148 '5<>SEARCH': 'keyboardOverlayF5', |
138 '6<>SEARCH': 'keyboardOverlayF6', | 149 '6<>SEARCH': 'keyboardOverlayF6', |
139 '7<>SEARCH': 'keyboardOverlayF7', | 150 '7<>SEARCH': 'keyboardOverlayF7', |
140 '8<>SEARCH': 'keyboardOverlayF8', | 151 '8<>SEARCH': 'keyboardOverlayF8', |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 /** | 612 /** |
602 * Returns true if the device has a diamond key. | 613 * Returns true if the device has a diamond key. |
603 * @return {boolean} Returns true if the device has a diamond key. | 614 * @return {boolean} Returns true if the device has a diamond key. |
604 */ | 615 */ |
605 function hasDiamondKey() { | 616 function hasDiamondKey() { |
606 return (loadTimeData.getString('keyboardOverlayHasChromeOSDiamondKey') == | 617 return (loadTimeData.getString('keyboardOverlayHasChromeOSDiamondKey') == |
607 'true'); | 618 'true'); |
608 } | 619 } |
609 | 620 |
610 /** | 621 /** |
| 622 * Returns true if display rotation feature is enabled. |
| 623 * @return {boolean} True if display rotation feature is enabled. |
| 624 */ |
| 625 function isDisplayRotationEnabled() { |
| 626 return (loadTimeData.getString('keyboardOverlayIsDisplayRotationEnabled') == |
| 627 'true'); |
| 628 } |
| 629 |
| 630 /** |
| 631 * Returns true if display scaling feature is enabled. |
| 632 * @return {boolean} True if display scaling feature is enabled. |
| 633 */ |
| 634 function isDisplayUIScalingEnabled() { |
| 635 return (loadTimeData.getString('keyboardOverlayIsDisplayUIScalingEnabled') == |
| 636 'true'); |
| 637 } |
| 638 |
| 639 /** |
611 * Initializes the layout and the key labels for the keyboard that has a diamond | 640 * Initializes the layout and the key labels for the keyboard that has a diamond |
612 * key. | 641 * key. |
613 */ | 642 */ |
614 function initDiamondKey() { | 643 function initDiamondKey() { |
615 var newLayoutData = { | 644 var newLayoutData = { |
616 '1D': [65.0, 287.0, 60.0, 60.0], // left Ctrl | 645 '1D': [65.0, 287.0, 60.0, 60.0], // left Ctrl |
617 '38': [185.0, 287.0, 60.0, 60.0], // left Alt | 646 '38': [185.0, 287.0, 60.0, 60.0], // left Alt |
618 'E0 5B': [125.0, 287.0, 60.0, 60.0], // search | 647 'E0 5B': [125.0, 287.0, 60.0, 60.0], // search |
619 '3A': [5.0, 167.0, 105.0, 60.0], // caps lock | 648 '3A': [5.0, 167.0, 105.0, 60.0], // caps lock |
620 '5B': [803.0, 6.0, 72.0, 35.0], // lock key | 649 '5B': [803.0, 6.0, 72.0, 35.0], // lock key |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 * Handles click events of the learn more link. | 744 * Handles click events of the learn more link. |
716 * @param {Event} e Mouse click event. | 745 * @param {Event} e Mouse click event. |
717 */ | 746 */ |
718 function learnMoreClicked(e) { | 747 function learnMoreClicked(e) { |
719 chrome.send('openLearnMorePage'); | 748 chrome.send('openLearnMorePage'); |
720 chrome.send('DialogClose'); | 749 chrome.send('DialogClose'); |
721 e.preventDefault(); | 750 e.preventDefault(); |
722 } | 751 } |
723 | 752 |
724 document.addEventListener('DOMContentLoaded', init); | 753 document.addEventListener('DOMContentLoaded', init); |
OLD | NEW |