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

Unified Diff: chrome/browser/resources/print_preview/print_header.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/print_header.js
diff --git a/chrome/browser/resources/print_preview/print_header.js b/chrome/browser/resources/print_preview/print_header.js
index fdeea113c3d9598411e8e01f5863a090d08be497..7c0107d81c65bc344ae9de6a335763aa9cabea82 100644
--- a/chrome/browser/resources/print_preview/print_header.js
+++ b/chrome/browser/resources/print_preview/print_header.js
@@ -132,6 +132,7 @@ cr.define('print_preview', function() {
*/
updatePrintButtonEnabledState_: function() {
this.getChildElement('button.print').disabled =
+ this.destinationStore_.selectedDestination == null ||
!this.isEnabled_ ||
!this.isPrintButtonEnabled_ ||
!this.printTicketStore_.isTicketValid();
@@ -222,14 +223,16 @@ cr.define('print_preview', function() {
* @private
*/
onDestinationSelect_: function() {
- var isSaveLabel = this.destinationStore_.selectedDestination.id ==
- print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
- this.destinationStore_.selectedDestination.id ==
- print_preview.Destination.GooglePromotedId.DOCS;
- this.getChildElement('button.print').textContent = isSaveLabel ?
- localStrings.getString('saveButton') :
- localStrings.getString('printButton');
- this.getChildElement('button.print').focus();
+ var isSaveLabel = this.destinationStore_.selectedDestination &&
+ (this.destinationStore_.selectedDestination.id ==
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
+ this.destinationStore_.selectedDestination.id ==
+ print_preview.Destination.GooglePromotedId.DOCS);
+ this.getChildElement('button.print').textContent =
+ localStrings.getString(isSaveLabel ? 'saveButton' : 'printButton');
+ if (this.destinationStore_.selectedDestination) {
+ this.getChildElement('button.print').focus();
+ }
},
/**
« no previous file with comments | « chrome/browser/resources/print_preview/data/user_info.js ('k') | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698