| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Overrided metadata worker's path. | 6 * Overrided metadata worker's path. |
| 7 * @type {string} | 7 * @type {string} |
| 8 */ | 8 */ |
| 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; | 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; |
| 10 | 10 |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 this.updateSelectionAndState_(); | 734 this.updateSelectionAndState_(); |
| 735 }; | 735 }; |
| 736 | 736 |
| 737 /** | 737 /** |
| 738 * Keydown handler. | 738 * Keydown handler. |
| 739 * | 739 * |
| 740 * @param {!Event} event | 740 * @param {!Event} event |
| 741 * @private | 741 * @private |
| 742 */ | 742 */ |
| 743 Gallery.prototype.onKeyDown_ = function(event) { | 743 Gallery.prototype.onKeyDown_ = function(event) { |
| 744 var keyString = util.getKeyModifiers(event) + event.keyIdentifier; | 744 var keyString = util.getKeyModifiers(event) + event.key; |
| 745 | 745 |
| 746 // Handle debug shortcut keys. | 746 // Handle debug shortcut keys. |
| 747 switch (keyString) { | 747 switch (keyString) { |
| 748 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I | 748 case 'Ctrl-Shift-I': // Ctrl+Shift+I |
| 749 chrome.fileManagerPrivate.openInspector('normal'); | 749 chrome.fileManagerPrivate.openInspector('normal'); |
| 750 break; | 750 break; |
| 751 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J | 751 case 'Ctrl-Shift-J': // Ctrl+Shift+J |
| 752 chrome.fileManagerPrivate.openInspector('console'); | 752 chrome.fileManagerPrivate.openInspector('console'); |
| 753 break; | 753 break; |
| 754 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C | 754 case 'Ctrl-Shift-C': // Ctrl+Shift+C |
| 755 chrome.fileManagerPrivate.openInspector('element'); | 755 chrome.fileManagerPrivate.openInspector('element'); |
| 756 break; | 756 break; |
| 757 case 'Ctrl-Shift-U+0042': // Ctrl+Shift+B | 757 case 'Ctrl-Shift-B': // Ctrl+Shift+B |
| 758 chrome.fileManagerPrivate.openInspector('background'); | 758 chrome.fileManagerPrivate.openInspector('background'); |
| 759 break; | 759 break; |
| 760 } | 760 } |
| 761 | 761 |
| 762 // Do not capture keys when share dialog is shown. | 762 // Do not capture keys when share dialog is shown. |
| 763 if (this.shareDialog_.isShowing()) | 763 if (this.shareDialog_.isShowing()) |
| 764 return; | 764 return; |
| 765 | 765 |
| 766 // Show UIs when user types any key. | 766 // Show UIs when user types any key. |
| 767 this.dimmableUIController_.kick(); | 767 this.dimmableUIController_.kick(); |
| 768 | 768 |
| 769 // Handle mode specific shortcut keys. | 769 // Handle mode specific shortcut keys. |
| 770 if (this.currentMode_.onKeyDown(event)) { | 770 if (this.currentMode_.onKeyDown(event)) { |
| 771 event.preventDefault(); | 771 event.preventDefault(); |
| 772 return; | 772 return; |
| 773 } | 773 } |
| 774 | 774 |
| 775 // Handle application wide shortcut keys. | 775 // Handle application wide shortcut keys. |
| 776 switch (keyString) { | 776 switch (keyString) { |
| 777 case 'U+0008': // Backspace. | 777 case 'Backspace': |
| 778 // The default handler would call history.back and close the Gallery. | 778 // The default handler would call history.back and close the Gallery. |
| 779 event.preventDefault(); | 779 event.preventDefault(); |
| 780 break; | 780 break; |
| 781 | 781 |
| 782 case 'U+004D': // 'm' switches between Slide and Mosaic mode. | 782 case 'm': // 'm' switches between Slide and Mosaic mode. |
| 783 if (!this.modeSwitchButton_.disabled) | 783 if (!this.modeSwitchButton_.disabled) |
| 784 this.toggleMode_(undefined, event); | 784 this.toggleMode_(undefined, event); |
| 785 break; | 785 break; |
| 786 | 786 |
| 787 case 'U+0056': // 'v' | 787 case 'v': |
| 788 case 'MediaPlayPause': | 788 case 'MediaPlayPause': |
| 789 if (!this.slideshowButton_.disabled) { | 789 if (!this.slideshowButton_.disabled) { |
| 790 this.slideMode_.startSlideshow( | 790 this.slideMode_.startSlideshow( |
| 791 SlideMode.SLIDESHOW_INTERVAL_FIRST, event); | 791 SlideMode.SLIDESHOW_INTERVAL_FIRST, event); |
| 792 } | 792 } |
| 793 break; | 793 break; |
| 794 | 794 |
| 795 case 'U+007F': // Delete | 795 case 'Delete': |
| 796 case 'Shift-U+0033': // Shift+'3' (Delete key might be missing). | 796 case 'Shift-3': // Shift+'3' (Delete key might be missing). |
| 797 case 'U+0044': // 'd' | 797 case 'd': |
| 798 if (!this.deleteButton_.disabled) | 798 if (!this.deleteButton_.disabled) |
| 799 this.delete_(); | 799 this.delete_(); |
| 800 break; | 800 break; |
| 801 | 801 |
| 802 case 'U+001B': // Escape | 802 case 'Escape': |
| 803 window.close(); | 803 window.close(); |
| 804 break; | 804 break; |
| 805 } | 805 } |
| 806 }; | 806 }; |
| 807 | 807 |
| 808 // Name box and rename support. | 808 // Name box and rename support. |
| 809 | 809 |
| 810 /** | 810 /** |
| 811 * Updates the UI related to the selected item and the persistent state. | 811 * Updates the UI related to the selected item and the persistent state. |
| 812 * | 812 * |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 */ | 1060 */ |
| 1061 var initializePromise = | 1061 var initializePromise = |
| 1062 Promise.all([loadTimeDataPromise, volumeManagerPromise]). | 1062 Promise.all([loadTimeDataPromise, volumeManagerPromise]). |
| 1063 then(function(args) { | 1063 then(function(args) { |
| 1064 var volumeManager = args[1]; | 1064 var volumeManager = args[1]; |
| 1065 gallery = new Gallery(volumeManager); | 1065 gallery = new Gallery(volumeManager); |
| 1066 }); | 1066 }); |
| 1067 | 1067 |
| 1068 // Loads entries. | 1068 // Loads entries. |
| 1069 initializePromise.then(reload); | 1069 initializePromise.then(reload); |
| OLD | NEW |