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

Side by Side Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 10446076: Handle Escape key on constrained window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 // TODO(rltoscano): Might be a problem where might be in fetching destinations 5 // TODO(rltoscano): Might be a problem where might be in fetching destinations
6 // state, then to file selection state, then cancel, which results in the 6 // state, then to file selection state, then cancel, which results in the
7 // fetching destinations state being lost. 7 // fetching destinations state being lost.
8 8
9 // TODO(rltoscano): Move data/* into print_preview.data namespace 9 // TODO(rltoscano): Move data/* into print_preview.data namespace
10 10
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 this.close_(); 797 this.close_();
798 }, 798 },
799 799
800 /** 800 /**
801 * Consume escape key presses and ctrl + shift + p. Delegate everything else 801 * Consume escape key presses and ctrl + shift + p. Delegate everything else
802 * to the preview area. 802 * to the preview area.
803 * @param {KeyboardEvent} e The keyboard event. 803 * @param {KeyboardEvent} e The keyboard event.
804 * @private 804 * @private
805 */ 805 */
806 onKeyDown_: function(e) { 806 onKeyDown_: function(e) {
807 // Escape key closes the dialog.
808 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey &&
809 !e.metaKey) {
810 this.close_();
811 e.preventDefault();
812 return;
813 }
814
815 // Ctrl + Shift + p / Mac equivalent. 807 // Ctrl + Shift + p / Mac equivalent.
816 if (e.keyCode == 80) { 808 if (e.keyCode == 80) {
817 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || 809 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) ||
818 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { 810 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) {
819 this.openSystemPrintDialog_(); 811 this.openSystemPrintDialog_();
820 e.preventDefault(); 812 e.preventDefault();
821 return; 813 return;
822 } 814 }
823 } 815 }
824 816
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 <include src="settings/margin_settings.js"/> 900 <include src="settings/margin_settings.js"/>
909 <include src="settings/destination_settings.js"/> 901 <include src="settings/destination_settings.js"/>
910 <include src="settings/other_options_settings.js"/> 902 <include src="settings/other_options_settings.js"/>
911 903
912 <include src="previewarea/margin_control.js"/> 904 <include src="previewarea/margin_control.js"/>
913 <include src="previewarea/margin_control_container.js"/> 905 <include src="previewarea/margin_control_container.js"/>
914 <include src="previewarea/preview_area.js"/> 906 <include src="previewarea/preview_area.js"/>
915 <include src="preview_generator.js"/> 907 <include src="preview_generator.js"/>
916 908
917 var printPreview = new print_preview.PrintPreview(); 909 var printPreview = new print_preview.PrintPreview();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698