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 // TODO(rltoscano): Move data/* into print_preview.data namespace | 5 // TODO(rltoscano): Move data/* into print_preview.data namespace |
6 | 6 |
7 var localStrings = new LocalStrings(templateData); | 7 var localStrings = new LocalStrings(templateData); |
8 | 8 |
9 <include src="component.js"/> | 9 <include src="component.js"/> |
10 | 10 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // Ctrl + Shift + p / Mac equivalent. | 650 // Ctrl + Shift + p / Mac equivalent. |
651 if (e.keyCode == 80) { | 651 if (e.keyCode == 80) { |
652 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || | 652 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || |
653 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { | 653 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { |
654 this.openSystemPrintDialog_(); | 654 this.openSystemPrintDialog_(); |
655 e.preventDefault(); | 655 e.preventDefault(); |
656 return; | 656 return; |
657 } | 657 } |
658 } | 658 } |
659 | 659 |
| 660 if (e.keyCode == 13 /*enter*/ && this.printTicketStore_.isTicketValid()) { |
| 661 assert(this.uiState_ == PrintPreview.UiState_.READY, |
| 662 'Trying to print when not in ready state: ' + this.uiState_); |
| 663 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); |
| 664 e.preventDefault(); |
| 665 return; |
| 666 } |
| 667 |
660 // Pass certain directional keyboard events to the PDF viewer. | 668 // Pass certain directional keyboard events to the PDF viewer. |
661 this.previewArea_.handleDirectionalKeyEvent(e); | 669 this.previewArea_.handleDirectionalKeyEvent(e); |
662 }, | 670 }, |
663 | 671 |
664 /** | 672 /** |
665 * Called when native layer receives invalid settings for a print request. | 673 * Called when native layer receives invalid settings for a print request. |
666 * @private | 674 * @private |
667 */ | 675 */ |
668 onSettingsInvalid_: function() { | 676 onSettingsInvalid_: function() { |
669 this.uiState_ = PrintPreview.UiState_.ERROR; | 677 this.uiState_ = PrintPreview.UiState_.ERROR; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 <include src="search/recent_destination_list.js"/> | 816 <include src="search/recent_destination_list.js"/> |
809 <include src="search/destination_list_item.js"/> | 817 <include src="search/destination_list_item.js"/> |
810 <include src="search/destination_search.js"/> | 818 <include src="search/destination_search.js"/> |
811 <include src="search/search_box.js"/> | 819 <include src="search/search_box.js"/> |
812 <include src="search/fedex_tos.js"/> | 820 <include src="search/fedex_tos.js"/> |
813 | 821 |
814 window.addEventListener('DOMContentLoaded', function() { | 822 window.addEventListener('DOMContentLoaded', function() { |
815 printPreview = new print_preview.PrintPreview(); | 823 printPreview = new print_preview.PrintPreview(); |
816 printPreview.initialize(); | 824 printPreview.initialize(); |
817 }); | 825 }); |
OLD | NEW |