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

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

Issue 233623003: Remember and restore the account last used destination is registered for. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust PrintPreview unit test. Created 6 years, 8 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): 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || 778 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) ||
779 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { 779 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) {
780 this.openSystemPrintDialog_(); 780 this.openSystemPrintDialog_();
781 e.preventDefault(); 781 e.preventDefault();
782 return; 782 return;
783 } 783 }
784 } 784 }
785 785
786 if (e.keyCode == 13 /*enter*/ && 786 if (e.keyCode == 13 /*enter*/ &&
787 !this.destinationSearch_.getIsVisible() && 787 !this.destinationSearch_.getIsVisible() &&
788 this.destinationStore_.selectedDestination &&
788 this.printTicketStore_.isTicketValid()) { 789 this.printTicketStore_.isTicketValid()) {
789 assert(this.uiState_ == PrintPreview.UiState_.READY, 790 assert(this.uiState_ == PrintPreview.UiState_.READY,
790 'Trying to print when not in ready state: ' + this.uiState_); 791 'Trying to print when not in ready state: ' + this.uiState_);
791 var activeElementTag = document.activeElement ? 792 var activeElementTag = document.activeElement ?
792 document.activeElement.tagName.toUpperCase() : ''; 793 document.activeElement.tagName.toUpperCase() : '';
793 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') { 794 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') {
794 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); 795 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/);
795 e.preventDefault(); 796 e.preventDefault();
796 } 797 }
797 return; 798 return;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 this.printIfReady_(); 893 this.printIfReady_();
893 }, 894 },
894 895
895 /** 896 /**
896 * Called when a print destination is selected. Shows/hides the "Print with 897 * Called when a print destination is selected. Shows/hides the "Print with
897 * Cloud Print" link in the navbar. 898 * Cloud Print" link in the navbar.
898 * @private 899 * @private
899 */ 900 */
900 onDestinationSelect_: function() { 901 onDestinationSelect_: function() {
901 var selectedDest = this.destinationStore_.selectedDestination; 902 var selectedDest = this.destinationStore_.selectedDestination;
902 setIsVisible($('cloud-print-dialog-link'), 903 setIsVisible(
903 !cr.isChromeOS && !selectedDest.isLocal); 904 $('cloud-print-dialog-link'),
904 if (this.isInKioskAutoPrintMode_) { 905 selectedDest && !cr.isChromeOS && !selectedDest.isLocal);
906 if (selectedDest && this.isInKioskAutoPrintMode_) {
905 this.onPrintButtonClick_(); 907 this.onPrintButtonClick_();
906 } 908 }
907 }, 909 },
908 910
909 /** 911 /**
910 * Called when the destination store loads a group of destinations. Shows 912 * Called when the destination store loads a group of destinations. Shows
911 * a promo on Chrome OS if the user has no print destinations promoting 913 * a promo on Chrome OS if the user has no print destinations promoting
912 * Google Cloud Print. 914 * Google Cloud Print.
913 * @private 915 * @private
914 */ 916 */
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 <include src="search/recent_destination_list.js"/> 1020 <include src="search/recent_destination_list.js"/>
1019 <include src="search/destination_list_item.js"/> 1021 <include src="search/destination_list_item.js"/>
1020 <include src="search/destination_search.js"/> 1022 <include src="search/destination_search.js"/>
1021 <include src="search/search_box.js"/> 1023 <include src="search/search_box.js"/>
1022 <include src="search/fedex_tos.js"/> 1024 <include src="search/fedex_tos.js"/>
1023 1025
1024 window.addEventListener('DOMContentLoaded', function() { 1026 window.addEventListener('DOMContentLoaded', function() {
1025 printPreview = new print_preview.PrintPreview(); 1027 printPreview = new print_preview.PrintPreview();
1026 printPreview.initialize(); 1028 printPreview.initialize();
1027 }); 1029 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698