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

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

Issue 12617019: Add display scaling and rotation shortcuts to keyboard overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change strings Created 7 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 | 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Zoom screen in
137 delete shortcutDataCache['+<>CTRL<>SHIFT'];
138 // Zoom screen out
139 delete shortcutDataCache['-<>CTRL<>SHIFT'];
140 // Reset screen zoom
141 delete shortcutDataCache['0<>CTRL<>SHIFT'];
142 }
143
131 // TODO(mazda): Clean this up and move these out to the data js. 144 // TODO(mazda): Clean this up and move these out to the data js.
132 var searchModifierAddShortcuts = { 145 var searchModifierAddShortcuts = {
133 '1<>SEARCH': 'keyboardOverlayF1', 146 '1<>SEARCH': 'keyboardOverlayF1',
134 '2<>SEARCH': 'keyboardOverlayF2', 147 '2<>SEARCH': 'keyboardOverlayF2',
135 '3<>SEARCH': 'keyboardOverlayF3', 148 '3<>SEARCH': 'keyboardOverlayF3',
136 '4<>SEARCH': 'keyboardOverlayF4', 149 '4<>SEARCH': 'keyboardOverlayF4',
137 '5<>SEARCH': 'keyboardOverlayF5', 150 '5<>SEARCH': 'keyboardOverlayF5',
138 '6<>SEARCH': 'keyboardOverlayF6', 151 '6<>SEARCH': 'keyboardOverlayF6',
139 '7<>SEARCH': 'keyboardOverlayF7', 152 '7<>SEARCH': 'keyboardOverlayF7',
140 '8<>SEARCH': 'keyboardOverlayF8', 153 '8<>SEARCH': 'keyboardOverlayF8',
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 learnMoreLinkText.appendChild(learnMoreLinkAnchor); 609 learnMoreLinkText.appendChild(learnMoreLinkAnchor);
597 instructions.appendChild(learnMoreLinkText); 610 instructions.appendChild(learnMoreLinkText);
598 keyboard.appendChild(instructions); 611 keyboard.appendChild(instructions);
599 } 612 }
600 613
601 /** 614 /**
602 * Returns true if the device has a diamond key. 615 * Returns true if the device has a diamond key.
603 * @return {boolean} Returns true if the device has a diamond key. 616 * @return {boolean} Returns true if the device has a diamond key.
604 */ 617 */
605 function hasDiamondKey() { 618 function hasDiamondKey() {
606 return (loadTimeData.getString('keyboardOverlayHasChromeOSDiamondKey') == 619 return loadTimeData.getBoolean('keyboardOverlayHasChromeOSDiamondKey');
607 'true');
608 } 620 }
609 621
610 /** 622 /**
623 * Returns true if display rotation feature is enabled.
624 * @return {boolean} True if display rotation feature is enabled.
625 */
626 function isDisplayRotationEnabled() {
627 return loadTimeData.getBoolean('keyboardOverlayIsDisplayRotationEnabled');
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.getBoolean('keyboardOverlayIsDisplayUIScalingEnabled');
636 }
637
638 /**
611 * Initializes the layout and the key labels for the keyboard that has a diamond 639 * Initializes the layout and the key labels for the keyboard that has a diamond
612 * key. 640 * key.
613 */ 641 */
614 function initDiamondKey() { 642 function initDiamondKey() {
615 var newLayoutData = { 643 var newLayoutData = {
616 '1D': [65.0, 287.0, 60.0, 60.0], // left Ctrl 644 '1D': [65.0, 287.0, 60.0, 60.0], // left Ctrl
617 '38': [185.0, 287.0, 60.0, 60.0], // left Alt 645 '38': [185.0, 287.0, 60.0, 60.0], // left Alt
618 'E0 5B': [125.0, 287.0, 60.0, 60.0], // search 646 'E0 5B': [125.0, 287.0, 60.0, 60.0], // search
619 '3A': [5.0, 167.0, 105.0, 60.0], // caps lock 647 '3A': [5.0, 167.0, 105.0, 60.0], // caps lock
620 '5B': [803.0, 6.0, 72.0, 35.0], // lock key 648 '5B': [803.0, 6.0, 72.0, 35.0], // lock key
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 * Handles click events of the learn more link. 743 * Handles click events of the learn more link.
716 * @param {Event} e Mouse click event. 744 * @param {Event} e Mouse click event.
717 */ 745 */
718 function learnMoreClicked(e) { 746 function learnMoreClicked(e) {
719 chrome.send('openLearnMorePage'); 747 chrome.send('openLearnMorePage');
720 chrome.send('DialogClose'); 748 chrome.send('DialogClose');
721 e.preventDefault(); 749 e.preventDefault();
722 } 750 }
723 751
724 document.addEventListener('DOMContentLoaded', init); 752 document.addEventListener('DOMContentLoaded', init);
OLDNEW
« no previous file with comments | « chrome/app/chromeos_strings.grdp ('k') | chrome/browser/resources/chromeos/keyboard_overlay_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698