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

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

Issue 10796094: Merge 147143 - Makes dialog print on ENTER key press. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview.js » ('j') | 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a PrintHeader object. This object encapsulates all the elements 9 * Creates a PrintHeader object. This object encapsulates all the elements
10 * and logic related to the top part of the left pane in print_preview.html. 10 * and logic related to the top part of the left pane in print_preview.html.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 PrintHeader.prototype = { 63 PrintHeader.prototype = {
64 __proto__: print_preview.Component.prototype, 64 __proto__: print_preview.Component.prototype,
65 65
66 set isEnabled(isEnabled) { 66 set isEnabled(isEnabled) {
67 this.isEnabled_ = isEnabled; 67 this.isEnabled_ = isEnabled;
68 this.printButton_.disabled = !isEnabled; 68 this.printButton_.disabled = !isEnabled;
69 this.cancelButton_.disabled = !isEnabled; 69 this.cancelButton_.disabled = !isEnabled;
70 }, 70 },
71 71
72 /** @param {string} message Error message to display in the print header. */
72 setErrorMessage: function(message) { 73 setErrorMessage: function(message) {
73 var summaryEl = this.getElement().getElementsByClassName( 74 var summaryEl = this.getElement().getElementsByClassName(
74 PrintHeader.Classes_.SUMMARY)[0]; 75 PrintHeader.Classes_.SUMMARY)[0];
75 summaryEl.innerHTML = ''; 76 summaryEl.innerHTML = '';
76 summaryEl.textContent = message; 77 summaryEl.textContent = message;
77 }, 78 },
78 79
79 /** @override */ 80 /** @override */
80 enterDocument: function() { 81 enterDocument: function() {
81 print_preview.Component.prototype.enterDocument.call(this); 82 print_preview.Component.prototype.enterDocument.call(this);
82 this.printButton_.focus();
83 83
84 // User events 84 // User events
85 this.tracker.add( 85 this.tracker.add(
86 this.cancelButton_, 'click', this.onCancelButtonClick_.bind(this)); 86 this.cancelButton_, 'click', this.onCancelButtonClick_.bind(this));
87 this.tracker.add( 87 this.tracker.add(
88 this.printButton_, 'click', this.onPrintButtonClick_.bind(this)); 88 this.printButton_, 'click', this.onPrintButtonClick_.bind(this));
89 89
90 // Data events. 90 // Data events.
91 this.tracker.add( 91 this.tracker.add(
92 this.printTicketStore_, 92 this.printTicketStore_,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 */ 213 */
214 onDestinationSelect_: function() { 214 onDestinationSelect_: function() {
215 if (this.destinationStore_.selectedDestination.id == 215 if (this.destinationStore_.selectedDestination.id ==
216 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF || 216 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
217 this.destinationStore_.selectedDestination.id == 217 this.destinationStore_.selectedDestination.id ==
218 print_preview.Destination.GooglePromotedId.DOCS) { 218 print_preview.Destination.GooglePromotedId.DOCS) {
219 this.printButton_.textContent = localStrings.getString('saveButton'); 219 this.printButton_.textContent = localStrings.getString('saveButton');
220 } else { 220 } else {
221 this.printButton_.textContent = localStrings.getString('printButton'); 221 this.printButton_.textContent = localStrings.getString('printButton');
222 } 222 }
223 this.printButton_.focus();
223 }, 224 },
224 225
225 /** 226 /**
226 * Called when the print ticket has changed. Disables the print button if 227 * Called when the print ticket has changed. Disables the print button if
227 * any of the settings are invalid. 228 * any of the settings are invalid.
228 * @private 229 * @private
229 */ 230 */
230 onTicketChange_: function() { 231 onTicketChange_: function() {
231 this.printButton_.disabled = 232 this.printButton_.disabled =
232 !this.printTicketStore_.isTicketValid() || 233 !this.printTicketStore_.isTicketValid() ||
233 !this.isEnabled_; 234 !this.isEnabled_;
234 this.updateSummary_(); 235 this.updateSummary_();
236 if (document.activeElement == null ||
237 document.activeElement == document.body) {
238 this.printButton_.focus();
239 }
235 } 240 }
236 }; 241 };
237 242
238 // Export 243 // Export
239 return { 244 return {
240 PrintHeader: PrintHeader 245 PrintHeader: PrintHeader
241 }; 246 };
242 }); 247 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698