| 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 93b272cd37ee83e77a0d9df73622abee480670e7..cb99a8022b3301f6f186bcccfa069b54bcfc9a0a 100644
|
| --- a/chrome/browser/resources/print_preview/print_preview.js
|
| +++ b/chrome/browser/resources/print_preview/print_preview.js
|
| @@ -4,8 +4,8 @@
|
|
|
| // TODO(rltoscano): Move data/* into print_preview.data namespace
|
|
|
| -<include src="component.js">
|
| -<include src="print_preview_focus_manager.js">
|
| +// <include src="component.js">
|
| +// <include src="print_preview_focus_manager.js">
|
|
|
| cr.define('print_preview', function() {
|
| 'use strict';
|
| @@ -99,8 +99,8 @@ cr.define('print_preview', function() {
|
| * @type {!print_preview.DestinationSettings}
|
| * @private
|
| */
|
| - this.destinationSettings_ = new print_preview.DestinationSettings(
|
| - this.destinationStore_);
|
| + this.destinationSettings_ =
|
| + new print_preview.DestinationSettings(this.destinationStore_);
|
| this.addChild(this.destinationSettings_);
|
|
|
| /**
|
| @@ -108,8 +108,8 @@ cr.define('print_preview', function() {
|
| * @type {!print_preview.PageSettings}
|
| * @private
|
| */
|
| - this.pageSettings_ = new print_preview.PageSettings(
|
| - this.printTicketStore_.pageRange);
|
| + this.pageSettings_ =
|
| + new print_preview.PageSettings(this.printTicketStore_.pageRange);
|
| this.addChild(this.pageSettings_);
|
|
|
| /**
|
| @@ -139,11 +139,11 @@ cr.define('print_preview', function() {
|
| new print_preview.ColorSettings(this.printTicketStore_.color);
|
| this.addChild(this.colorSettings_);
|
|
|
| - /**
|
| - * Component that renders the media size settings.
|
| - * @type {!print_preview.MediaSizeSettings}
|
| - * @private
|
| - */
|
| + /**
|
| + * Component that renders the media size settings.
|
| + * @type {!print_preview.MediaSizeSettings}
|
| + * @private
|
| + */
|
| this.mediaSizeSettings_ =
|
| new print_preview.MediaSizeSettings(this.printTicketStore_.mediaSize);
|
| this.addChild(this.mediaSizeSettings_);
|
| @@ -172,9 +172,8 @@ cr.define('print_preview', function() {
|
| * @type {!print_preview.ScalingSettings}
|
| * @private
|
| */
|
| - this.scalingSettings_ =
|
| - new print_preview.ScalingSettings(this.printTicketStore_.scaling,
|
| - this.printTicketStore_.fitToPage);
|
| + this.scalingSettings_ = new print_preview.ScalingSettings(
|
| + this.printTicketStore_.scaling, this.printTicketStore_.fitToPage);
|
| this.addChild(this.scalingSettings_);
|
| }
|
|
|
| @@ -184,12 +183,10 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings(
|
| - this.printTicketStore_.duplex,
|
| - this.printTicketStore_.fitToPage,
|
| + this.printTicketStore_.duplex, this.printTicketStore_.fitToPage,
|
| this.printTicketStore_.cssBackground,
|
| this.printTicketStore_.selectionOnly,
|
| - this.printTicketStore_.headerFooter,
|
| - this.printTicketStore_.rasterize);
|
| + this.printTicketStore_.headerFooter, this.printTicketStore_.rasterize);
|
| this.addChild(this.otherOptionsSettings_);
|
|
|
| /**
|
| @@ -206,21 +203,16 @@ cr.define('print_preview', function() {
|
| * @type {!print_preview.AdvancedSettings}
|
| * @private
|
| */
|
| - this.advancedSettings_ = new print_preview.AdvancedSettings(
|
| - this.printTicketStore_);
|
| + this.advancedSettings_ =
|
| + new print_preview.AdvancedSettings(this.printTicketStore_);
|
| this.addChild(this.advancedSettings_);
|
|
|
| var settingsSections = [
|
| - this.destinationSettings_,
|
| - this.pageSettings_,
|
| - this.copiesSettings_,
|
| - this.mediaSizeSettings_,
|
| - this.layoutSettings_,
|
| - this.marginSettings_,
|
| - this.colorSettings_,
|
| - this.dpiSettings_,
|
| - this.otherOptionsSettings_,
|
| - this.advancedOptionsSettings_];
|
| + this.destinationSettings_, this.pageSettings_, this.copiesSettings_,
|
| + this.mediaSizeSettings_, this.layoutSettings_, this.marginSettings_,
|
| + this.colorSettings_, this.dpiSettings_, this.otherOptionsSettings_,
|
| + this.advancedOptionsSettings_
|
| + ];
|
| if (this.scalingEnabled_) {
|
| settingsSections.splice(8, 0, this.scalingSettings_);
|
| }
|
| @@ -239,10 +231,9 @@ cr.define('print_preview', function() {
|
| * @type {!print_preview.PreviewArea}
|
| * @private
|
| */
|
| - this.previewArea_ = new print_preview.PreviewArea(this.destinationStore_,
|
| - this.printTicketStore_,
|
| - this.nativeLayer_,
|
| - this.documentInfo_);
|
| + this.previewArea_ = new print_preview.PreviewArea(
|
| + this.destinationStore_, this.printTicketStore_, this.nativeLayer_,
|
| + this.documentInfo_);
|
| this.addChild(this.previewArea_);
|
|
|
| /**
|
| @@ -354,8 +345,7 @@ cr.define('print_preview', function() {
|
| print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE,
|
| this.onCloudPrintEnable_.bind(this));
|
| this.tracker.add(
|
| - this.nativeLayer_,
|
| - print_preview.NativeLayer.EventType.PRINT_TO_CLOUD,
|
| + this.nativeLayer_, print_preview.NativeLayer.EventType.PRINT_TO_CLOUD,
|
| this.onPrintToCloud_.bind(this));
|
| this.tracker.add(
|
| this.nativeLayer_,
|
| @@ -390,14 +380,12 @@ cr.define('print_preview', function() {
|
|
|
| if ($('system-dialog-link')) {
|
| this.tracker.add(
|
| - $('system-dialog-link'),
|
| - 'click',
|
| + $('system-dialog-link'), 'click',
|
| this.openSystemPrintDialog_.bind(this));
|
| }
|
| if ($('open-pdf-in-preview-link')) {
|
| this.tracker.add(
|
| - $('open-pdf-in-preview-link'),
|
| - 'click',
|
| + $('open-pdf-in-preview-link'), 'click',
|
| this.onOpenPdfInPreviewLinkClick_.bind(this));
|
| }
|
|
|
| @@ -419,9 +407,8 @@ cr.define('print_preview', function() {
|
| this.openSystemPrintDialog_.bind(this));
|
|
|
| this.tracker.add(
|
| - this.destinationStore_,
|
| - print_preview.DestinationStore.EventType.
|
| - SELECTED_DESTINATION_CAPABILITIES_READY,
|
| + this.destinationStore_, print_preview.DestinationStore.EventType
|
| + .SELECTED_DESTINATION_CAPABILITIES_READY,
|
| this.printIfReady_.bind(this));
|
| this.tracker.add(
|
| this.destinationStore_,
|
| @@ -478,17 +465,14 @@ cr.define('print_preview', function() {
|
| // TODO(rltoscano): Move no-destinations-promo into its own component
|
| // instead being part of PrintPreview.
|
| this.tracker.add(
|
| - this.getChildElement('#no-destinations-promo .close-button'),
|
| - 'click',
|
| + this.getChildElement('#no-destinations-promo .close-button'), 'click',
|
| this.onNoDestinationsPromoClose_.bind(this));
|
| this.tracker.add(
|
| this.getChildElement('#no-destinations-promo .not-now-button'),
|
| - 'click',
|
| - this.onNoDestinationsPromoClose_.bind(this));
|
| + 'click', this.onNoDestinationsPromoClose_.bind(this));
|
| this.tracker.add(
|
| this.getChildElement('#no-destinations-promo .add-printer-button'),
|
| - 'click',
|
| - this.onNoDestinationsPromoClick_.bind(this));
|
| + 'click', this.onNoDestinationsPromoClick_.bind(this));
|
| },
|
|
|
| /** @override */
|
| @@ -533,7 +517,7 @@ cr.define('print_preview', function() {
|
| this.marginSettings_.isEnabled = isEnabled;
|
| this.dpiSettings_.isEnabled = isEnabled;
|
| if (this.scalingEnabled_)
|
| - this.scalingSettings_.isEnabled = isEnabled;
|
| + this.scalingSettings_.isEnabled = isEnabled;
|
| this.otherOptionsSettings_.isEnabled = isEnabled;
|
| this.advancedOptionsSettings_.isEnabled = isEnabled;
|
| },
|
| @@ -544,12 +528,14 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| printDocumentOrOpenPdfPreview_: function(isPdfPreview) {
|
| - assert(this.uiState_ == PrintPreview.UiState_.READY,
|
| - 'Print document request received when not in ready state: ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.READY,
|
| + 'Print document request received when not in ready state: ' +
|
| + this.uiState_);
|
| if (isPdfPreview) {
|
| this.uiState_ = PrintPreview.UiState_.OPENING_PDF_PREVIEW;
|
| - } else if (this.destinationStore_.selectedDestination.id ==
|
| + } else if (
|
| + this.destinationStore_.selectedDestination.id ==
|
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) {
|
| this.uiState_ = PrintPreview.UiState_.FILE_SELECTION;
|
| } else {
|
| @@ -566,7 +552,7 @@ cr.define('print_preview', function() {
|
| !this.destinationStore_.selectedDestination.isExtension &&
|
| this.destinationStore_.selectedDestination.id !=
|
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) ||
|
| - this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW) {
|
| + this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW) {
|
| // Hide the dialog for now. The actual print command will be issued
|
| // when the preview generation is done.
|
| this.nativeLayer_.startHideDialog();
|
| @@ -593,21 +579,20 @@ cr.define('print_preview', function() {
|
| if (this.isPreviewGenerationInProgress_) {
|
| return PrintPreview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW;
|
| }
|
| - assert(this.printTicketStore_.isTicketValid(),
|
| + assert(
|
| + this.printTicketStore_.isTicketValid(),
|
| 'Trying to print with invalid ticket');
|
| if (getIsVisible(this.moreSettings_.getElement())) {
|
| new print_preview.PrintSettingsUiMetricsContext().record(
|
| this.moreSettings_.isExpanded ?
|
| - print_preview.Metrics.PrintSettingsUiBucket.
|
| - PRINT_WITH_SETTINGS_EXPANDED :
|
| - print_preview.Metrics.PrintSettingsUiBucket.
|
| - PRINT_WITH_SETTINGS_COLLAPSED);
|
| + print_preview.Metrics.PrintSettingsUiBucket
|
| + .PRINT_WITH_SETTINGS_EXPANDED :
|
| + print_preview.Metrics.PrintSettingsUiBucket
|
| + .PRINT_WITH_SETTINGS_COLLAPSED);
|
| }
|
| this.nativeLayer_.startPrint(
|
| - this.destinationStore_.selectedDestination,
|
| - this.printTicketStore_,
|
| - this.cloudPrintInterface_,
|
| - this.documentInfo_,
|
| + this.destinationStore_.selectedDestination, this.printTicketStore_,
|
| + this.cloudPrintInterface_, this.documentInfo_,
|
| this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW,
|
| this.showSystemDialogBeforeNextPrint_);
|
| this.showSystemDialogBeforeNextPrint_ = false;
|
| @@ -653,9 +638,10 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onInitialSettingsSet_: function(event) {
|
| - assert(this.uiState_ == PrintPreview.UiState_.INITIALIZING,
|
| - 'Updating initial settings when not in initializing state: ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.INITIALIZING,
|
| + 'Updating initial settings when not in initializing state: ' +
|
| + this.uiState_);
|
| this.uiState_ = PrintPreview.UiState_.READY;
|
|
|
| var settings = event.initialSettings;
|
| @@ -665,25 +651,21 @@ cr.define('print_preview', function() {
|
| // The following components must be initialized in this order.
|
| this.appState_.init(settings.serializedAppStateStr);
|
| this.documentInfo_.init(
|
| - settings.isDocumentModifiable,
|
| - settings.documentTitle,
|
| + settings.isDocumentModifiable, settings.documentTitle,
|
| settings.documentHasSelection);
|
| this.printTicketStore_.init(
|
| - settings.thousandsDelimeter,
|
| - settings.decimalDelimeter,
|
| - settings.unitType,
|
| - settings.selectionOnly);
|
| + settings.thousandsDelimeter, settings.decimalDelimeter,
|
| + settings.unitType, settings.selectionOnly);
|
| this.destinationStore_.init(
|
| - settings.isInAppKioskMode,
|
| - settings.systemDefaultDestinationId,
|
| + settings.isInAppKioskMode, settings.systemDefaultDestinationId,
|
| settings.serializedDefaultDestinationSelectionRulesStr);
|
| this.appState_.setInitialized();
|
|
|
| $('document-title').innerText = settings.documentTitle;
|
| this.hideSystemDialogLink_ = settings.isInAppKioskMode;
|
| if ($('system-dialog-link')) {
|
| - setIsVisible($('system-dialog-link'),
|
| - this.shouldShowSystemDialogLink_());
|
| + setIsVisible(
|
| + $('system-dialog-link'), this.shouldShowSystemDialogLink_());
|
| }
|
| },
|
|
|
| @@ -696,9 +678,7 @@ cr.define('print_preview', function() {
|
| */
|
| onCloudPrintEnable_: function(event) {
|
| this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface(
|
| - event.baseCloudPrintUrl,
|
| - this.nativeLayer_,
|
| - this.userInfo_,
|
| + event.baseCloudPrintUrl, this.nativeLayer_, this.userInfo_,
|
| event.appKioskMode);
|
| this.tracker.add(
|
| this.cloudPrintInterface_,
|
| @@ -717,9 +697,8 @@ cr.define('print_preview', function() {
|
| cloudprint.CloudPrintInterface.EventType.PRINTER_FAILED,
|
| this.onCloudPrintError_.bind(this));
|
| this.tracker.add(
|
| - this.cloudPrintInterface_,
|
| - cloudprint.CloudPrintInterface.EventType.
|
| - UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED,
|
| + this.cloudPrintInterface_, cloudprint.CloudPrintInterface.EventType
|
| + .UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED,
|
| this.onCloudPrintError_.bind(this));
|
|
|
| this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_);
|
| @@ -736,16 +715,16 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onPrintToCloud_: function(event) {
|
| - assert(this.uiState_ == PrintPreview.UiState_.PRINTING,
|
| - 'Document ready to be sent to the cloud when not in printing ' +
|
| - 'state: ' + this.uiState_);
|
| - assert(this.cloudPrintInterface_ != null,
|
| - 'Google Cloud Print is not enabled');
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.PRINTING,
|
| + 'Document ready to be sent to the cloud when not in printing ' +
|
| + 'state: ' + this.uiState_);
|
| + assert(
|
| + this.cloudPrintInterface_ != null,
|
| + 'Google Cloud Print is not enabled');
|
| this.cloudPrintInterface_.submit(
|
| - this.destinationStore_.selectedDestination,
|
| - this.printTicketStore_,
|
| - this.documentInfo_,
|
| - event.data);
|
| + this.destinationStore_.selectedDestination, this.printTicketStore_,
|
| + this.documentInfo_, event.data);
|
| },
|
|
|
| /**
|
| @@ -754,9 +733,10 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onFileSelectionCancel_: function() {
|
| - assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION,
|
| - 'File selection cancelled when not in file-selection state: ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.FILE_SELECTION,
|
| + 'File selection cancelled when not in file-selection state: ' +
|
| + this.uiState_);
|
| this.setIsEnabled_(true);
|
| this.uiState_ = PrintPreview.UiState_.READY;
|
| },
|
| @@ -766,9 +746,10 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onFileSelectionComplete_: function() {
|
| - assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION,
|
| - 'File selection completed when not in file-selection state: ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.FILE_SELECTION,
|
| + 'File selection completed when not in file-selection state: ' +
|
| + this.uiState_);
|
| this.previewArea_.showCustomMessage(
|
| loadTimeData.getString('printingToPDFInProgress'));
|
| this.uiState_ = PrintPreview.UiState_.PRINTING;
|
| @@ -780,11 +761,12 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onCloudPrintSubmitDone_: function(event) {
|
| - assert(this.uiState_ == PrintPreview.UiState_.PRINTING,
|
| - 'Submited job to Google Cloud Print but not in printing state ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.PRINTING,
|
| + 'Submited job to Google Cloud Print but not in printing state ' +
|
| + this.uiState_);
|
| if (this.destinationStore_.selectedDestination.id ==
|
| - print_preview.Destination.GooglePromotedId.FEDEX) {
|
| + print_preview.Destination.GooglePromotedId.FEDEX) {
|
| this.nativeLayer_.startForceOpenNewTab(
|
| 'https://www.google.com/cloudprint/fedexcode.html?jobid=' +
|
| event.jobId);
|
| @@ -804,13 +786,14 @@ cr.define('print_preview', function() {
|
| this.destinationSearch_.showCloudPrintPromo();
|
| }
|
| } else if (event.status == 0) {
|
| - return; // Ignore, the system does not have internet connectivity.
|
| + return; // Ignore, the system does not have internet connectivity.
|
| } else {
|
| this.printHeader_.setErrorMessage(event.message);
|
| }
|
| if (event.status == 200) {
|
| - console.error('Google Cloud Print Error: (' + event.errorCode + ') ' +
|
| - event.message);
|
| + console.error(
|
| + 'Google Cloud Print Error: (' + event.errorCode + ') ' +
|
| + event.message);
|
| } else {
|
| console.error('Google Cloud Print Error: HTTP status ' + event.status);
|
| }
|
| @@ -854,9 +837,10 @@ cr.define('print_preview', function() {
|
| onOpenPdfInPreviewLinkClick_: function() {
|
| if ($('open-pdf-in-preview-link').classList.contains('disabled'))
|
| return;
|
| - assert(this.uiState_ == PrintPreview.UiState_.READY,
|
| - 'Trying to open pdf in preview when not in ready state: ' +
|
| - this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.READY,
|
| + 'Trying to open pdf in preview when not in ready state: ' +
|
| + this.uiState_);
|
| setIsVisible(getRequiredElement('open-preview-app-throbber'), true);
|
| this.previewArea_.showCustomMessage(
|
| loadTimeData.getString('openingPDFInPreview'));
|
| @@ -869,8 +853,9 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onPrintButtonClick_: function() {
|
| - assert(this.uiState_ == PrintPreview.UiState_.READY,
|
| - 'Trying to print when not in ready state: ' + this.uiState_);
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.READY,
|
| + 'Trying to print when not in ready state: ' + this.uiState_);
|
| this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/);
|
| },
|
|
|
| @@ -887,11 +872,11 @@ cr.define('print_preview', function() {
|
| * Called when the register promo for Cloud Print is clicked.
|
| * @private
|
| */
|
| - onCloudPrintRegisterPromoClick_: function(e) {
|
| - var devicesUrl = 'chrome://devices/register?id=' + e.destination.id;
|
| - this.nativeLayer_.startForceOpenNewTab(devicesUrl);
|
| - this.destinationStore_.waitForRegister(e.destination.id);
|
| - },
|
| + onCloudPrintRegisterPromoClick_: function(e) {
|
| + var devicesUrl = 'chrome://devices/register?id=' + e.destination.id;
|
| + this.nativeLayer_.startForceOpenNewTab(devicesUrl);
|
| + this.destinationStore_.waitForRegister(e.destination.id);
|
| + },
|
|
|
| /**
|
| * Consume escape key presses and ctrl + shift + p. Delegate everything else
|
| @@ -936,7 +921,8 @@ cr.define('print_preview', function() {
|
| this.destinationStore_.selectedDestination &&
|
| this.printTicketStore_.isTicketValid() &&
|
| this.printHeader_.isPrintButtonEnabled) {
|
| - assert(this.uiState_ == PrintPreview.UiState_.READY,
|
| + assert(
|
| + this.uiState_ == PrintPreview.UiState_.READY,
|
| 'Trying to print when not in ready state: ' + this.uiState_);
|
| var activeElementTag = document.activeElement.tagName.toUpperCase();
|
| if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT' &&
|
| @@ -1041,8 +1027,7 @@ cr.define('print_preview', function() {
|
| */
|
| onPageCountReady_: function(event) {
|
| if (event.fitToPageScaling >= 0) {
|
| - this.scalingSettings_.updateFitToPageScaling(
|
| - event.fitToPageScaling);
|
| + this.scalingSettings_.updateFitToPageScaling(event.fitToPageScaling);
|
| }
|
| },
|
|
|
| @@ -1052,8 +1037,8 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onPrivetPrintFailed_: function(event) {
|
| - console.error('Privet printing failed with error code ' +
|
| - event.httpError);
|
| + console.error(
|
| + 'Privet printing failed with error code ' + event.httpError);
|
| this.printHeader_.setErrorMessage(
|
| loadTimeData.getString('couldNotPrint'));
|
| },
|
| @@ -1066,7 +1051,7 @@ cr.define('print_preview', function() {
|
| */
|
| onManipulateSettingsForTest_: function(event) {
|
| var settings =
|
| - /** @type {print_preview.PreviewSettings} */(event.settings);
|
| + /** @type {print_preview.PreviewSettings} */ (event.settings);
|
| if ('selectSaveAsPdfDestination' in settings) {
|
| this.saveAsPdfForTest_(); // No parameters.
|
| } else if ('layoutSettings' in settings) {
|
| @@ -1091,7 +1076,7 @@ cr.define('print_preview', function() {
|
| saveAsPdfForTest_: function() {
|
| if (this.destinationStore_.selectedDestination &&
|
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ==
|
| - this.destinationStore_.selectedDestination.id) {
|
| + this.destinationStore_.selectedDestination.id) {
|
| this.nativeLayer_.previewReadyForTest();
|
| return;
|
| }
|
| @@ -1207,9 +1192,9 @@ cr.define('print_preview', function() {
|
| return true;
|
| var selectedDest = this.destinationStore_.selectedDestination;
|
| return !!selectedDest &&
|
| - selectedDest.origin == print_preview.Destination.Origin.LOCAL &&
|
| - selectedDest.id !=
|
| - print_preview.Destination.GooglePromotedId.SAVE_AS_PDF;
|
| + selectedDest.origin == print_preview.Destination.Origin.LOCAL &&
|
| + selectedDest.id !=
|
| + print_preview.Destination.GooglePromotedId.SAVE_AS_PDF;
|
| },
|
|
|
| /**
|
| @@ -1219,8 +1204,8 @@ cr.define('print_preview', function() {
|
| */
|
| onDestinationSelect_: function() {
|
| if ($('system-dialog-link')) {
|
| - setIsVisible($('system-dialog-link'),
|
| - this.shouldShowSystemDialogLink_());
|
| + setIsVisible(
|
| + $('system-dialog-link'), this.shouldShowSystemDialogLink_());
|
| }
|
| if (this.destinationStore_.selectedDestination &&
|
| this.isInKioskAutoPrintMode_) {
|
| @@ -1235,15 +1220,13 @@ cr.define('print_preview', function() {
|
| * @private
|
| */
|
| onDestinationSearchDone_: function() {
|
| - var isPromoVisible = cr.isChromeOS &&
|
| - this.cloudPrintInterface_ &&
|
| - this.userInfo_.activeUser &&
|
| - !this.appState_.isGcpPromoDismissed &&
|
| + var isPromoVisible = cr.isChromeOS && this.cloudPrintInterface_ &&
|
| + this.userInfo_.activeUser && !this.appState_.isGcpPromoDismissed &&
|
| !this.destinationStore_.isLocalDestinationSearchInProgress &&
|
| !this.destinationStore_.isCloudDestinationSearchInProgress &&
|
| this.destinationStore_.hasOnlyDefaultCloudDestinations();
|
| - setIsVisible(this.getChildElement('#no-destinations-promo'),
|
| - isPromoVisible);
|
| + setIsVisible(
|
| + this.getChildElement('#no-destinations-promo'), isPromoVisible);
|
| if (isPromoVisible) {
|
| new print_preview.GcpPromoMetricsContext().record(
|
| print_preview.Metrics.GcpPromoBucket.PROMO_SHOWN);
|
| @@ -1271,98 +1254,97 @@ cr.define('print_preview', function() {
|
| new print_preview.GcpPromoMetricsContext().record(
|
| print_preview.Metrics.GcpPromoBucket.PROMO_CLICKED);
|
| this.appState_.persistIsGcpPromoDismissed(true);
|
| - window.open(this.cloudPrintInterface_.baseUrl + '?user=' +
|
| - this.userInfo_.activeUser + '#printers');
|
| + window.open(
|
| + this.cloudPrintInterface_.baseUrl + '?user=' +
|
| + this.userInfo_.activeUser + '#printers');
|
| this.close_();
|
| }
|
| };
|
|
|
| // Export
|
| - return {
|
| - PrintPreview: PrintPreview
|
| - };
|
| + return {PrintPreview: PrintPreview};
|
| });
|
|
|
| // Pull in all other scripts in a single shot.
|
| -<include src="common/overlay.js">
|
| -<include src="common/search_box.js">
|
| -<include src="common/search_bubble.js">
|
| -
|
| -<include src="data/page_number_set.js">
|
| -<include src="data/destination.js">
|
| -<include src="data/local_parsers.js">
|
| -<include src="data/cloud_parsers.js">
|
| -<include src="data/destination_store.js">
|
| -<include src="data/invitation.js">
|
| -<include src="data/invitation_store.js">
|
| -<include src="data/margins.js">
|
| -<include src="data/document_info.js">
|
| -<include src="data/printable_area.js">
|
| -<include src="data/measurement_system.js">
|
| -<include src="data/print_ticket_store.js">
|
| -<include src="data/coordinate2d.js">
|
| -<include src="data/size.js">
|
| -<include src="data/capabilities_holder.js">
|
| -<include src="data/user_info.js">
|
| -<include src="data/app_state.js">
|
| -
|
| -<include src="data/ticket_items/ticket_item.js">
|
| -
|
| -<include src="data/ticket_items/custom_margins.js">
|
| -<include src="data/ticket_items/collate.js">
|
| -<include src="data/ticket_items/color.js">
|
| -<include src="data/ticket_items/copies.js">
|
| -<include src="data/ticket_items/dpi.js">
|
| -<include src="data/ticket_items/duplex.js">
|
| -<include src="data/ticket_items/header_footer.js">
|
| -<include src="data/ticket_items/media_size.js">
|
| -<include src="data/ticket_items/scaling.js">
|
| -<include src="data/ticket_items/landscape.js">
|
| -<include src="data/ticket_items/margins_type.js">
|
| -<include src="data/ticket_items/page_range.js">
|
| -<include src="data/ticket_items/fit_to_page.js">
|
| -<include src="data/ticket_items/css_background.js">
|
| -<include src="data/ticket_items/selection_only.js">
|
| -<include src="data/ticket_items/rasterize.js">
|
| -<include src="data/ticket_items/vendor_items.js">
|
| -
|
| -<include src="native_layer.js">
|
| -<include src="print_preview_animations.js">
|
| -<include src="cloud_print_interface.js">
|
| -<include src="print_preview_utils.js">
|
| -<include src="print_header.js">
|
| -<include src="metrics.js">
|
| -
|
| -<include src="settings/settings_section.js">
|
| -<include src="settings/settings_section_select.js">
|
| -<include src="settings/destination_settings.js">
|
| -<include src="settings/page_settings.js">
|
| -<include src="settings/copies_settings.js">
|
| -<include src="settings/layout_settings.js">
|
| -<include src="settings/color_settings.js">
|
| -<include src="settings/media_size_settings.js">
|
| -<include src="settings/margin_settings.js">
|
| -<include src="settings/dpi_settings.js">
|
| -<include src="settings/scaling_settings.js">
|
| -<include src="settings/other_options_settings.js">
|
| -<include src="settings/advanced_options_settings.js">
|
| -<include src="settings/advanced_settings/advanced_settings.js">
|
| -<include src="settings/advanced_settings/advanced_settings_item.js">
|
| -<include src="settings/more_settings.js">
|
| -
|
| -<include src="previewarea/margin_control.js">
|
| -<include src="previewarea/margin_control_container.js">
|
| -<include src="../pdf/pdf_scripting_api.js">
|
| -<include src="previewarea/preview_area.js">
|
| -<include src="preview_generator.js">
|
| -
|
| -<include src="search/destination_list.js">
|
| -<include src="search/cloud_destination_list.js">
|
| -<include src="search/recent_destination_list.js">
|
| -<include src="search/destination_list_item.js">
|
| -<include src="search/destination_search.js">
|
| -<include src="search/fedex_tos.js">
|
| -<include src="search/provisional_destination_resolver.js">
|
| +// <include src="common/overlay.js">
|
| +// <include src="common/search_box.js">
|
| +// <include src="common/search_bubble.js">
|
| +
|
| +// <include src="data/page_number_set.js">
|
| +// <include src="data/destination.js">
|
| +// <include src="data/local_parsers.js">
|
| +// <include src="data/cloud_parsers.js">
|
| +// <include src="data/destination_store.js">
|
| +// <include src="data/invitation.js">
|
| +// <include src="data/invitation_store.js">
|
| +// <include src="data/margins.js">
|
| +// <include src="data/document_info.js">
|
| +// <include src="data/printable_area.js">
|
| +// <include src="data/measurement_system.js">
|
| +// <include src="data/print_ticket_store.js">
|
| +// <include src="data/coordinate2d.js">
|
| +// <include src="data/size.js">
|
| +// <include src="data/capabilities_holder.js">
|
| +// <include src="data/user_info.js">
|
| +// <include src="data/app_state.js">
|
| +
|
| +// <include src="data/ticket_items/ticket_item.js">
|
| +
|
| +// <include src="data/ticket_items/custom_margins.js">
|
| +// <include src="data/ticket_items/collate.js">
|
| +// <include src="data/ticket_items/color.js">
|
| +// <include src="data/ticket_items/copies.js">
|
| +// <include src="data/ticket_items/dpi.js">
|
| +// <include src="data/ticket_items/duplex.js">
|
| +// <include src="data/ticket_items/header_footer.js">
|
| +// <include src="data/ticket_items/media_size.js">
|
| +// <include src="data/ticket_items/scaling.js">
|
| +// <include src="data/ticket_items/landscape.js">
|
| +// <include src="data/ticket_items/margins_type.js">
|
| +// <include src="data/ticket_items/page_range.js">
|
| +// <include src="data/ticket_items/fit_to_page.js">
|
| +// <include src="data/ticket_items/css_background.js">
|
| +// <include src="data/ticket_items/selection_only.js">
|
| +// <include src="data/ticket_items/rasterize.js">
|
| +// <include src="data/ticket_items/vendor_items.js">
|
| +
|
| +// <include src="native_layer.js">
|
| +// <include src="print_preview_animations.js">
|
| +// <include src="cloud_print_interface.js">
|
| +// <include src="print_preview_utils.js">
|
| +// <include src="print_header.js">
|
| +// <include src="metrics.js">
|
| +
|
| +// <include src="settings/settings_section.js">
|
| +// <include src="settings/settings_section_select.js">
|
| +// <include src="settings/destination_settings.js">
|
| +// <include src="settings/page_settings.js">
|
| +// <include src="settings/copies_settings.js">
|
| +// <include src="settings/layout_settings.js">
|
| +// <include src="settings/color_settings.js">
|
| +// <include src="settings/media_size_settings.js">
|
| +// <include src="settings/margin_settings.js">
|
| +// <include src="settings/dpi_settings.js">
|
| +// <include src="settings/scaling_settings.js">
|
| +// <include src="settings/other_options_settings.js">
|
| +// <include src="settings/advanced_options_settings.js">
|
| +// <include src="settings/advanced_settings/advanced_settings.js">
|
| +// <include src="settings/advanced_settings/advanced_settings_item.js">
|
| +// <include src="settings/more_settings.js">
|
| +
|
| +// <include src="previewarea/margin_control.js">
|
| +// <include src="previewarea/margin_control_container.js">
|
| +// <include src="../pdf/pdf_scripting_api.js">
|
| +// <include src="previewarea/preview_area.js">
|
| +// <include src="preview_generator.js">
|
| +
|
| +// <include src="search/destination_list.js">
|
| +// <include src="search/cloud_destination_list.js">
|
| +// <include src="search/recent_destination_list.js">
|
| +// <include src="search/destination_list_item.js">
|
| +// <include src="search/destination_search.js">
|
| +// <include src="search/fedex_tos.js">
|
| +// <include src="search/provisional_destination_resolver.js">
|
|
|
| window.addEventListener('DOMContentLoaded', function() {
|
| printPreview = new print_preview.PrintPreview();
|
|
|