| Index: chrome/browser/resources/print_preview/print_preview.js
|
| diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
|
| index e7cc3f4a099c5fc44337bd64a28036845c9087ce..6eb199fa9de3b36b1a0c91e9ec2762bc2bab8c33 100644
|
| --- a/chrome/browser/resources/print_preview/print_preview.js
|
| +++ b/chrome/browser/resources/print_preview/print_preview.js
|
| @@ -269,23 +269,6 @@ cr.define('print_preview', function() {
|
| };
|
|
|
| /**
|
| - * States of the print preview.
|
| - * @enum {string}
|
| - * @private
|
| - */
|
| - PrintPreview.UiState_ = {
|
| - INITIALIZING: 'initializing',
|
| - READY: 'ready',
|
| - OPENING_PDF_PREVIEW: 'opening-pdf-preview',
|
| - OPENING_CLOUD_PRINT_DIALOG: 'opening-cloud-print-dialog',
|
| - OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog',
|
| - PRINTING: 'printing',
|
| - FILE_SELECTION: 'file-selection',
|
| - CLOSING: 'closing',
|
| - ERROR: 'error'
|
| - };
|
| -
|
| - /**
|
| * What can happen when print preview tries to print.
|
| * @enum {string}
|
| * @private
|
| @@ -850,6 +833,9 @@ cr.define('print_preview', function() {
|
| * to the preview area.
|
| * @param {KeyboardEvent} e The keyboard event.
|
| * @private
|
| + * @suppress {uselessCode}
|
| + * Current compiler preprocessor leaves all the code inside all the <if>s,
|
| + * so the compiler claims that code after first return is unreachable.
|
| */
|
| onKeyDown_: function(e) {
|
| // Escape key closes the dialog.
|
| @@ -930,7 +916,7 @@ cr.define('print_preview', function() {
|
| */
|
| onAdvancedOptionsButtonActivated_: function() {
|
| this.advancedSettings_.showForDestination(
|
| - this.destinationStore_.selectedDestination);
|
| + assert(this.destinationStore_.selectedDestination));
|
| },
|
|
|
| /**
|
| @@ -991,6 +977,8 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onManipulateSettingsForTest_: function(event) {
|
| + event.settings =
|
| + /** @type {print_preview.PreviewSettings} */(event.settings);
|
| if ('selectSaveAsPdfDestination' in event.settings) {
|
| this.saveAsPdfForTest_(); // No parameters.
|
| } else if ('layoutSettings' in event.settings) {
|
| @@ -1130,7 +1118,7 @@ cr.define('print_preview', function() {
|
| if (!cr.isWindows)
|
| return true;
|
| var selectedDest = this.destinationStore_.selectedDestination;
|
| - return selectedDest &&
|
| + return !!selectedDest &&
|
| selectedDest.origin == print_preview.Destination.Origin.LOCAL &&
|
| selectedDest.id !=
|
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF;
|
| @@ -1160,7 +1148,7 @@ cr.define('print_preview', function() {
|
| var selectedDest = this.destinationStore_.selectedDestination;
|
| setIsVisible(
|
| getRequiredElement('cloud-print-dialog-link'),
|
| - selectedDest && !cr.isChromeOS && !selectedDest.isLocal);
|
| + !!selectedDest && !cr.isChromeOS && !selectedDest.isLocal);
|
| setIsVisible(
|
| getRequiredElement('system-dialog-link'),
|
| this.shouldShowSystemDialogLink_());
|
| @@ -1180,8 +1168,8 @@ cr.define('print_preview', function() {
|
| this.cloudPrintInterface_ &&
|
| this.userInfo_.activeUser &&
|
| !this.appState_.isGcpPromoDismissed &&
|
| - !this.destinationStore_.isLocalDestinationsSearchInProgress &&
|
| - !this.destinationStore_.isCloudDestinationsSearchInProgress &&
|
| + !this.destinationStore_.isLocalDestinationSearchInProgress &&
|
| + !this.destinationStore_.isCloudDestinationSearchInProgress &&
|
| this.destinationStore_.hasOnlyDefaultCloudDestinations();
|
| setIsVisible(this.getChildElement('#no-destinations-promo'),
|
| isPromoVisible);
|
| @@ -1224,6 +1212,23 @@ cr.define('print_preview', function() {
|
| };
|
| });
|
|
|
| +/**
|
| + * States of the print preview.
|
| + * @enum {string}
|
| + * @private
|
| + */
|
| +print_preview.PrintPreview.UiState_ = {
|
| + INITIALIZING: 'initializing',
|
| + READY: 'ready',
|
| + OPENING_PDF_PREVIEW: 'opening-pdf-preview',
|
| + OPENING_CLOUD_PRINT_DIALOG: 'opening-cloud-print-dialog',
|
| + OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog',
|
| + PRINTING: 'printing',
|
| + FILE_SELECTION: 'file-selection',
|
| + CLOSING: 'closing',
|
| + ERROR: 'error'
|
| +};
|
| +
|
| // Pull in all other scripts in a single shot.
|
| <include src="common/overlay.js">
|
| <include src="common/search_box.js">
|
|
|