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

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

Issue 10778041: Makes dialog print on ENTER key press. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
« no previous file with comments | « chrome/browser/resources/print_preview/print_header.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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): 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
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
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 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/print_header.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698