| OLD | NEW |
| 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 <include src="component.js"> | 7 // <include src="component.js"> |
| 8 <include src="print_preview_focus_manager.js"> | 8 // <include src="print_preview_focus_manager.js"> |
| 9 | 9 |
| 10 cr.define('print_preview', function() { | 10 cr.define('print_preview', function() { |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Container class for Chromium's print preview. | 14 * Container class for Chromium's print preview. |
| 15 * @constructor | 15 * @constructor |
| 16 * @extends {print_preview.Component} | 16 * @extends {print_preview.Component} |
| 17 */ | 17 */ |
| 18 function PrintPreview() { | 18 function PrintPreview() { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 */ | 92 */ |
| 93 this.destinationSearch_ = new print_preview.DestinationSearch( | 93 this.destinationSearch_ = new print_preview.DestinationSearch( |
| 94 this.destinationStore_, this.invitationStore_, this.userInfo_); | 94 this.destinationStore_, this.invitationStore_, this.userInfo_); |
| 95 this.addChild(this.destinationSearch_); | 95 this.addChild(this.destinationSearch_); |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Component that renders the print destination. | 98 * Component that renders the print destination. |
| 99 * @type {!print_preview.DestinationSettings} | 99 * @type {!print_preview.DestinationSettings} |
| 100 * @private | 100 * @private |
| 101 */ | 101 */ |
| 102 this.destinationSettings_ = new print_preview.DestinationSettings( | 102 this.destinationSettings_ = |
| 103 this.destinationStore_); | 103 new print_preview.DestinationSettings(this.destinationStore_); |
| 104 this.addChild(this.destinationSettings_); | 104 this.addChild(this.destinationSettings_); |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Component that renders UI for entering in page range. | 107 * Component that renders UI for entering in page range. |
| 108 * @type {!print_preview.PageSettings} | 108 * @type {!print_preview.PageSettings} |
| 109 * @private | 109 * @private |
| 110 */ | 110 */ |
| 111 this.pageSettings_ = new print_preview.PageSettings( | 111 this.pageSettings_ = |
| 112 this.printTicketStore_.pageRange); | 112 new print_preview.PageSettings(this.printTicketStore_.pageRange); |
| 113 this.addChild(this.pageSettings_); | 113 this.addChild(this.pageSettings_); |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Component that renders the copies settings. | 116 * Component that renders the copies settings. |
| 117 * @type {!print_preview.CopiesSettings} | 117 * @type {!print_preview.CopiesSettings} |
| 118 * @private | 118 * @private |
| 119 */ | 119 */ |
| 120 this.copiesSettings_ = new print_preview.CopiesSettings( | 120 this.copiesSettings_ = new print_preview.CopiesSettings( |
| 121 this.printTicketStore_.copies, this.printTicketStore_.collate); | 121 this.printTicketStore_.copies, this.printTicketStore_.collate); |
| 122 this.addChild(this.copiesSettings_); | 122 this.addChild(this.copiesSettings_); |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Component that renders the layout settings. | 125 * Component that renders the layout settings. |
| 126 * @type {!print_preview.LayoutSettings} | 126 * @type {!print_preview.LayoutSettings} |
| 127 * @private | 127 * @private |
| 128 */ | 128 */ |
| 129 this.layoutSettings_ = | 129 this.layoutSettings_ = |
| 130 new print_preview.LayoutSettings(this.printTicketStore_.landscape); | 130 new print_preview.LayoutSettings(this.printTicketStore_.landscape); |
| 131 this.addChild(this.layoutSettings_); | 131 this.addChild(this.layoutSettings_); |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * Component that renders the color options. | 134 * Component that renders the color options. |
| 135 * @type {!print_preview.ColorSettings} | 135 * @type {!print_preview.ColorSettings} |
| 136 * @private | 136 * @private |
| 137 */ | 137 */ |
| 138 this.colorSettings_ = | 138 this.colorSettings_ = |
| 139 new print_preview.ColorSettings(this.printTicketStore_.color); | 139 new print_preview.ColorSettings(this.printTicketStore_.color); |
| 140 this.addChild(this.colorSettings_); | 140 this.addChild(this.colorSettings_); |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * Component that renders the media size settings. | 143 * Component that renders the media size settings. |
| 144 * @type {!print_preview.MediaSizeSettings} | 144 * @type {!print_preview.MediaSizeSettings} |
| 145 * @private | 145 * @private |
| 146 */ | 146 */ |
| 147 this.mediaSizeSettings_ = | 147 this.mediaSizeSettings_ = |
| 148 new print_preview.MediaSizeSettings(this.printTicketStore_.mediaSize); | 148 new print_preview.MediaSizeSettings(this.printTicketStore_.mediaSize); |
| 149 this.addChild(this.mediaSizeSettings_); | 149 this.addChild(this.mediaSizeSettings_); |
| 150 | 150 |
| 151 /** | 151 /** |
| 152 * Component that renders a select box for choosing margin settings. | 152 * Component that renders a select box for choosing margin settings. |
| 153 * @type {!print_preview.MarginSettings} | 153 * @type {!print_preview.MarginSettings} |
| 154 * @private | 154 * @private |
| 155 */ | 155 */ |
| 156 this.marginSettings_ = | 156 this.marginSettings_ = |
| 157 new print_preview.MarginSettings(this.printTicketStore_.marginsType); | 157 new print_preview.MarginSettings(this.printTicketStore_.marginsType); |
| 158 this.addChild(this.marginSettings_); | 158 this.addChild(this.marginSettings_); |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Component that renders the DPI settings. | 161 * Component that renders the DPI settings. |
| 162 * @type {!print_preview.DpiSettings} | 162 * @type {!print_preview.DpiSettings} |
| 163 * @private | 163 * @private |
| 164 */ | 164 */ |
| 165 this.dpiSettings_ = | 165 this.dpiSettings_ = |
| 166 new print_preview.DpiSettings(this.printTicketStore_.dpi); | 166 new print_preview.DpiSettings(this.printTicketStore_.dpi); |
| 167 this.addChild(this.dpiSettings_); | 167 this.addChild(this.dpiSettings_); |
| 168 | 168 |
| 169 if (this.scalingEnabled_) { | 169 if (this.scalingEnabled_) { |
| 170 /** | 170 /** |
| 171 * Component that renders the scaling settings. | 171 * Component that renders the scaling settings. |
| 172 * @type {!print_preview.ScalingSettings} | 172 * @type {!print_preview.ScalingSettings} |
| 173 * @private | 173 * @private |
| 174 */ | 174 */ |
| 175 this.scalingSettings_ = | 175 this.scalingSettings_ = new print_preview.ScalingSettings( |
| 176 new print_preview.ScalingSettings(this.printTicketStore_.scaling, | 176 this.printTicketStore_.scaling, this.printTicketStore_.fitToPage); |
| 177 this.printTicketStore_.fitToPage); | |
| 178 this.addChild(this.scalingSettings_); | 177 this.addChild(this.scalingSettings_); |
| 179 } | 178 } |
| 180 | 179 |
| 181 /** | 180 /** |
| 182 * Component that renders miscellaneous print options. | 181 * Component that renders miscellaneous print options. |
| 183 * @type {!print_preview.OtherOptionsSettings} | 182 * @type {!print_preview.OtherOptionsSettings} |
| 184 * @private | 183 * @private |
| 185 */ | 184 */ |
| 186 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings( | 185 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings( |
| 187 this.printTicketStore_.duplex, | 186 this.printTicketStore_.duplex, this.printTicketStore_.fitToPage, |
| 188 this.printTicketStore_.fitToPage, | |
| 189 this.printTicketStore_.cssBackground, | 187 this.printTicketStore_.cssBackground, |
| 190 this.printTicketStore_.selectionOnly, | 188 this.printTicketStore_.selectionOnly, |
| 191 this.printTicketStore_.headerFooter, | 189 this.printTicketStore_.headerFooter, this.printTicketStore_.rasterize); |
| 192 this.printTicketStore_.rasterize); | |
| 193 this.addChild(this.otherOptionsSettings_); | 190 this.addChild(this.otherOptionsSettings_); |
| 194 | 191 |
| 195 /** | 192 /** |
| 196 * Component that renders the advanced options button. | 193 * Component that renders the advanced options button. |
| 197 * @type {!print_preview.AdvancedOptionsSettings} | 194 * @type {!print_preview.AdvancedOptionsSettings} |
| 198 * @private | 195 * @private |
| 199 */ | 196 */ |
| 200 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( | 197 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( |
| 201 this.printTicketStore_.vendorItems, this.destinationStore_); | 198 this.printTicketStore_.vendorItems, this.destinationStore_); |
| 202 this.addChild(this.advancedOptionsSettings_); | 199 this.addChild(this.advancedOptionsSettings_); |
| 203 | 200 |
| 204 /** | 201 /** |
| 205 * Component used to search for print destinations. | 202 * Component used to search for print destinations. |
| 206 * @type {!print_preview.AdvancedSettings} | 203 * @type {!print_preview.AdvancedSettings} |
| 207 * @private | 204 * @private |
| 208 */ | 205 */ |
| 209 this.advancedSettings_ = new print_preview.AdvancedSettings( | 206 this.advancedSettings_ = |
| 210 this.printTicketStore_); | 207 new print_preview.AdvancedSettings(this.printTicketStore_); |
| 211 this.addChild(this.advancedSettings_); | 208 this.addChild(this.advancedSettings_); |
| 212 | 209 |
| 213 var settingsSections = [ | 210 var settingsSections = [ |
| 214 this.destinationSettings_, | 211 this.destinationSettings_, this.pageSettings_, this.copiesSettings_, |
| 215 this.pageSettings_, | 212 this.mediaSizeSettings_, this.layoutSettings_, this.marginSettings_, |
| 216 this.copiesSettings_, | 213 this.colorSettings_, this.dpiSettings_, this.otherOptionsSettings_, |
| 217 this.mediaSizeSettings_, | 214 this.advancedOptionsSettings_ |
| 218 this.layoutSettings_, | 215 ]; |
| 219 this.marginSettings_, | |
| 220 this.colorSettings_, | |
| 221 this.dpiSettings_, | |
| 222 this.otherOptionsSettings_, | |
| 223 this.advancedOptionsSettings_]; | |
| 224 if (this.scalingEnabled_) { | 216 if (this.scalingEnabled_) { |
| 225 settingsSections.splice(8, 0, this.scalingSettings_); | 217 settingsSections.splice(8, 0, this.scalingSettings_); |
| 226 } | 218 } |
| 227 | 219 |
| 228 /** | 220 /** |
| 229 * Component representing more/less settings button. | 221 * Component representing more/less settings button. |
| 230 * @type {!print_preview.MoreSettings} | 222 * @type {!print_preview.MoreSettings} |
| 231 * @private | 223 * @private |
| 232 */ | 224 */ |
| 233 this.moreSettings_ = new print_preview.MoreSettings( | 225 this.moreSettings_ = new print_preview.MoreSettings( |
| 234 this.destinationStore_, settingsSections); | 226 this.destinationStore_, settingsSections); |
| 235 this.addChild(this.moreSettings_); | 227 this.addChild(this.moreSettings_); |
| 236 | 228 |
| 237 /** | 229 /** |
| 238 * Area of the UI that holds the print preview. | 230 * Area of the UI that holds the print preview. |
| 239 * @type {!print_preview.PreviewArea} | 231 * @type {!print_preview.PreviewArea} |
| 240 * @private | 232 * @private |
| 241 */ | 233 */ |
| 242 this.previewArea_ = new print_preview.PreviewArea(this.destinationStore_, | 234 this.previewArea_ = new print_preview.PreviewArea( |
| 243 this.printTicketStore_, | 235 this.destinationStore_, this.printTicketStore_, this.nativeLayer_, |
| 244 this.nativeLayer_, | 236 this.documentInfo_); |
| 245 this.documentInfo_); | |
| 246 this.addChild(this.previewArea_); | 237 this.addChild(this.previewArea_); |
| 247 | 238 |
| 248 /** | 239 /** |
| 249 * Interface to the Google Cloud Print API. Null if Google Cloud Print | 240 * Interface to the Google Cloud Print API. Null if Google Cloud Print |
| 250 * integration is disabled. | 241 * integration is disabled. |
| 251 * @type {cloudprint.CloudPrintInterface} | 242 * @type {cloudprint.CloudPrintInterface} |
| 252 * @private | 243 * @private |
| 253 */ | 244 */ |
| 254 this.cloudPrintInterface_ = null; | 245 this.cloudPrintInterface_ = null; |
| 255 | 246 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Native layer events. | 338 // Native layer events. |
| 348 this.tracker.add( | 339 this.tracker.add( |
| 349 this.nativeLayer_, | 340 this.nativeLayer_, |
| 350 print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET, | 341 print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET, |
| 351 this.onInitialSettingsSet_.bind(this)); | 342 this.onInitialSettingsSet_.bind(this)); |
| 352 this.tracker.add( | 343 this.tracker.add( |
| 353 this.nativeLayer_, | 344 this.nativeLayer_, |
| 354 print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE, | 345 print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE, |
| 355 this.onCloudPrintEnable_.bind(this)); | 346 this.onCloudPrintEnable_.bind(this)); |
| 356 this.tracker.add( | 347 this.tracker.add( |
| 357 this.nativeLayer_, | 348 this.nativeLayer_, print_preview.NativeLayer.EventType.PRINT_TO_CLOUD, |
| 358 print_preview.NativeLayer.EventType.PRINT_TO_CLOUD, | |
| 359 this.onPrintToCloud_.bind(this)); | 349 this.onPrintToCloud_.bind(this)); |
| 360 this.tracker.add( | 350 this.tracker.add( |
| 361 this.nativeLayer_, | 351 this.nativeLayer_, |
| 362 print_preview.NativeLayer.EventType.FILE_SELECTION_CANCEL, | 352 print_preview.NativeLayer.EventType.FILE_SELECTION_CANCEL, |
| 363 this.onFileSelectionCancel_.bind(this)); | 353 this.onFileSelectionCancel_.bind(this)); |
| 364 this.tracker.add( | 354 this.tracker.add( |
| 365 this.nativeLayer_, | 355 this.nativeLayer_, |
| 366 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, | 356 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, |
| 367 this.onFileSelectionComplete_.bind(this)); | 357 this.onFileSelectionComplete_.bind(this)); |
| 368 this.tracker.add( | 358 this.tracker.add( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 383 this.nativeLayer_, | 373 this.nativeLayer_, |
| 384 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, | 374 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, |
| 385 this.onPrivetPrintFailed_.bind(this)); | 375 this.onPrivetPrintFailed_.bind(this)); |
| 386 this.tracker.add( | 376 this.tracker.add( |
| 387 this.nativeLayer_, | 377 this.nativeLayer_, |
| 388 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 378 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
| 389 this.onManipulateSettingsForTest_.bind(this)); | 379 this.onManipulateSettingsForTest_.bind(this)); |
| 390 | 380 |
| 391 if ($('system-dialog-link')) { | 381 if ($('system-dialog-link')) { |
| 392 this.tracker.add( | 382 this.tracker.add( |
| 393 $('system-dialog-link'), | 383 $('system-dialog-link'), 'click', |
| 394 'click', | |
| 395 this.openSystemPrintDialog_.bind(this)); | 384 this.openSystemPrintDialog_.bind(this)); |
| 396 } | 385 } |
| 397 if ($('open-pdf-in-preview-link')) { | 386 if ($('open-pdf-in-preview-link')) { |
| 398 this.tracker.add( | 387 this.tracker.add( |
| 399 $('open-pdf-in-preview-link'), | 388 $('open-pdf-in-preview-link'), 'click', |
| 400 'click', | |
| 401 this.onOpenPdfInPreviewLinkClick_.bind(this)); | 389 this.onOpenPdfInPreviewLinkClick_.bind(this)); |
| 402 } | 390 } |
| 403 | 391 |
| 404 this.tracker.add( | 392 this.tracker.add( |
| 405 this.previewArea_, | 393 this.previewArea_, |
| 406 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_IN_PROGRESS, | 394 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_IN_PROGRESS, |
| 407 this.onPreviewGenerationInProgress_.bind(this)); | 395 this.onPreviewGenerationInProgress_.bind(this)); |
| 408 this.tracker.add( | 396 this.tracker.add( |
| 409 this.previewArea_, | 397 this.previewArea_, |
| 410 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE, | 398 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE, |
| 411 this.onPreviewGenerationDone_.bind(this)); | 399 this.onPreviewGenerationDone_.bind(this)); |
| 412 this.tracker.add( | 400 this.tracker.add( |
| 413 this.previewArea_, | 401 this.previewArea_, |
| 414 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, | 402 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, |
| 415 this.onPreviewGenerationFail_.bind(this)); | 403 this.onPreviewGenerationFail_.bind(this)); |
| 416 this.tracker.add( | 404 this.tracker.add( |
| 417 this.previewArea_, | 405 this.previewArea_, |
| 418 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, | 406 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, |
| 419 this.openSystemPrintDialog_.bind(this)); | 407 this.openSystemPrintDialog_.bind(this)); |
| 420 | 408 |
| 421 this.tracker.add( | 409 this.tracker.add( |
| 422 this.destinationStore_, | 410 this.destinationStore_, print_preview.DestinationStore.EventType |
| 423 print_preview.DestinationStore.EventType. | 411 .SELECTED_DESTINATION_CAPABILITIES_READY, |
| 424 SELECTED_DESTINATION_CAPABILITIES_READY, | |
| 425 this.printIfReady_.bind(this)); | 412 this.printIfReady_.bind(this)); |
| 426 this.tracker.add( | 413 this.tracker.add( |
| 427 this.destinationStore_, | 414 this.destinationStore_, |
| 428 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 415 print_preview.DestinationStore.EventType.DESTINATION_SELECT, |
| 429 this.onDestinationSelect_.bind(this)); | 416 this.onDestinationSelect_.bind(this)); |
| 430 this.tracker.add( | 417 this.tracker.add( |
| 431 this.destinationStore_, | 418 this.destinationStore_, |
| 432 print_preview.DestinationStore.EventType.DESTINATION_SEARCH_DONE, | 419 print_preview.DestinationStore.EventType.DESTINATION_SEARCH_DONE, |
| 433 this.onDestinationSearchDone_.bind(this)); | 420 this.onDestinationSearchDone_.bind(this)); |
| 434 | 421 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 this.onCloudPrintRegisterPromoClick_.bind(this)); | 458 this.onCloudPrintRegisterPromoClick_.bind(this)); |
| 472 | 459 |
| 473 this.tracker.add( | 460 this.tracker.add( |
| 474 this.advancedOptionsSettings_, | 461 this.advancedOptionsSettings_, |
| 475 print_preview.AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED, | 462 print_preview.AdvancedOptionsSettings.EventType.BUTTON_ACTIVATED, |
| 476 this.onAdvancedOptionsButtonActivated_.bind(this)); | 463 this.onAdvancedOptionsButtonActivated_.bind(this)); |
| 477 | 464 |
| 478 // TODO(rltoscano): Move no-destinations-promo into its own component | 465 // TODO(rltoscano): Move no-destinations-promo into its own component |
| 479 // instead being part of PrintPreview. | 466 // instead being part of PrintPreview. |
| 480 this.tracker.add( | 467 this.tracker.add( |
| 481 this.getChildElement('#no-destinations-promo .close-button'), | 468 this.getChildElement('#no-destinations-promo .close-button'), 'click', |
| 482 'click', | |
| 483 this.onNoDestinationsPromoClose_.bind(this)); | 469 this.onNoDestinationsPromoClose_.bind(this)); |
| 484 this.tracker.add( | 470 this.tracker.add( |
| 485 this.getChildElement('#no-destinations-promo .not-now-button'), | 471 this.getChildElement('#no-destinations-promo .not-now-button'), |
| 486 'click', | 472 'click', this.onNoDestinationsPromoClose_.bind(this)); |
| 487 this.onNoDestinationsPromoClose_.bind(this)); | |
| 488 this.tracker.add( | 473 this.tracker.add( |
| 489 this.getChildElement('#no-destinations-promo .add-printer-button'), | 474 this.getChildElement('#no-destinations-promo .add-printer-button'), |
| 490 'click', | 475 'click', this.onNoDestinationsPromoClick_.bind(this)); |
| 491 this.onNoDestinationsPromoClick_.bind(this)); | |
| 492 }, | 476 }, |
| 493 | 477 |
| 494 /** @override */ | 478 /** @override */ |
| 495 decorateInternal: function() { | 479 decorateInternal: function() { |
| 496 this.printHeader_.decorate($('print-header')); | 480 this.printHeader_.decorate($('print-header')); |
| 497 this.destinationSearch_.decorate($('destination-search')); | 481 this.destinationSearch_.decorate($('destination-search')); |
| 498 this.destinationSettings_.decorate($('destination-settings')); | 482 this.destinationSettings_.decorate($('destination-settings')); |
| 499 this.pageSettings_.decorate($('page-settings')); | 483 this.pageSettings_.decorate($('page-settings')); |
| 500 this.copiesSettings_.decorate($('copies-settings')); | 484 this.copiesSettings_.decorate($('copies-settings')); |
| 501 this.layoutSettings_.decorate($('layout-settings')); | 485 this.layoutSettings_.decorate($('layout-settings')); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 526 this.printHeader_.isEnabled = isEnabled; | 510 this.printHeader_.isEnabled = isEnabled; |
| 527 this.destinationSettings_.isEnabled = isEnabled; | 511 this.destinationSettings_.isEnabled = isEnabled; |
| 528 this.pageSettings_.isEnabled = isEnabled; | 512 this.pageSettings_.isEnabled = isEnabled; |
| 529 this.copiesSettings_.isEnabled = isEnabled; | 513 this.copiesSettings_.isEnabled = isEnabled; |
| 530 this.layoutSettings_.isEnabled = isEnabled; | 514 this.layoutSettings_.isEnabled = isEnabled; |
| 531 this.colorSettings_.isEnabled = isEnabled; | 515 this.colorSettings_.isEnabled = isEnabled; |
| 532 this.mediaSizeSettings_.isEnabled = isEnabled; | 516 this.mediaSizeSettings_.isEnabled = isEnabled; |
| 533 this.marginSettings_.isEnabled = isEnabled; | 517 this.marginSettings_.isEnabled = isEnabled; |
| 534 this.dpiSettings_.isEnabled = isEnabled; | 518 this.dpiSettings_.isEnabled = isEnabled; |
| 535 if (this.scalingEnabled_) | 519 if (this.scalingEnabled_) |
| 536 this.scalingSettings_.isEnabled = isEnabled; | 520 this.scalingSettings_.isEnabled = isEnabled; |
| 537 this.otherOptionsSettings_.isEnabled = isEnabled; | 521 this.otherOptionsSettings_.isEnabled = isEnabled; |
| 538 this.advancedOptionsSettings_.isEnabled = isEnabled; | 522 this.advancedOptionsSettings_.isEnabled = isEnabled; |
| 539 }, | 523 }, |
| 540 | 524 |
| 541 /** | 525 /** |
| 542 * Prints the document or launches a pdf preview on the local system. | 526 * Prints the document or launches a pdf preview on the local system. |
| 543 * @param {boolean} isPdfPreview Whether to launch the pdf preview. | 527 * @param {boolean} isPdfPreview Whether to launch the pdf preview. |
| 544 * @private | 528 * @private |
| 545 */ | 529 */ |
| 546 printDocumentOrOpenPdfPreview_: function(isPdfPreview) { | 530 printDocumentOrOpenPdfPreview_: function(isPdfPreview) { |
| 547 assert(this.uiState_ == PrintPreview.UiState_.READY, | 531 assert( |
| 548 'Print document request received when not in ready state: ' + | 532 this.uiState_ == PrintPreview.UiState_.READY, |
| 549 this.uiState_); | 533 'Print document request received when not in ready state: ' + |
| 534 this.uiState_); |
| 550 if (isPdfPreview) { | 535 if (isPdfPreview) { |
| 551 this.uiState_ = PrintPreview.UiState_.OPENING_PDF_PREVIEW; | 536 this.uiState_ = PrintPreview.UiState_.OPENING_PDF_PREVIEW; |
| 552 } else if (this.destinationStore_.selectedDestination.id == | 537 } else if ( |
| 538 this.destinationStore_.selectedDestination.id == |
| 553 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { | 539 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { |
| 554 this.uiState_ = PrintPreview.UiState_.FILE_SELECTION; | 540 this.uiState_ = PrintPreview.UiState_.FILE_SELECTION; |
| 555 } else { | 541 } else { |
| 556 this.uiState_ = PrintPreview.UiState_.PRINTING; | 542 this.uiState_ = PrintPreview.UiState_.PRINTING; |
| 557 } | 543 } |
| 558 this.setIsEnabled_(false); | 544 this.setIsEnabled_(false); |
| 559 this.printHeader_.isCancelButtonEnabled = true; | 545 this.printHeader_.isCancelButtonEnabled = true; |
| 560 var printAttemptResult = this.printIfReady_(); | 546 var printAttemptResult = this.printIfReady_(); |
| 561 if (printAttemptResult == PrintPreview.PrintAttemptResult_.PRINTED || | 547 if (printAttemptResult == PrintPreview.PrintAttemptResult_.PRINTED || |
| 562 printAttemptResult == | 548 printAttemptResult == |
| 563 PrintPreview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW) { | 549 PrintPreview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW) { |
| 564 if ((this.destinationStore_.selectedDestination.isLocal && | 550 if ((this.destinationStore_.selectedDestination.isLocal && |
| 565 !this.destinationStore_.selectedDestination.isPrivet && | 551 !this.destinationStore_.selectedDestination.isPrivet && |
| 566 !this.destinationStore_.selectedDestination.isExtension && | 552 !this.destinationStore_.selectedDestination.isExtension && |
| 567 this.destinationStore_.selectedDestination.id != | 553 this.destinationStore_.selectedDestination.id != |
| 568 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) || | 554 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) || |
| 569 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW) { | 555 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW) { |
| 570 // Hide the dialog for now. The actual print command will be issued | 556 // Hide the dialog for now. The actual print command will be issued |
| 571 // when the preview generation is done. | 557 // when the preview generation is done. |
| 572 this.nativeLayer_.startHideDialog(); | 558 this.nativeLayer_.startHideDialog(); |
| 573 } | 559 } |
| 574 } | 560 } |
| 575 }, | 561 }, |
| 576 | 562 |
| 577 /** | 563 /** |
| 578 * Attempts to print if needed and if ready. | 564 * Attempts to print if needed and if ready. |
| 579 * @return {PrintPreview.PrintAttemptResult_} Attempt result. | 565 * @return {PrintPreview.PrintAttemptResult_} Attempt result. |
| 580 * @private | 566 * @private |
| 581 */ | 567 */ |
| 582 printIfReady_: function() { | 568 printIfReady_: function() { |
| 583 var okToPrint = | 569 var okToPrint = |
| 584 (this.uiState_ == PrintPreview.UiState_.PRINTING || | 570 (this.uiState_ == PrintPreview.UiState_.PRINTING || |
| 585 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW || | 571 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW || |
| 586 this.uiState_ == PrintPreview.UiState_.FILE_SELECTION || | 572 this.uiState_ == PrintPreview.UiState_.FILE_SELECTION || |
| 587 this.isInKioskAutoPrintMode_) && | 573 this.isInKioskAutoPrintMode_) && |
| 588 this.destinationStore_.selectedDestination && | 574 this.destinationStore_.selectedDestination && |
| 589 this.destinationStore_.selectedDestination.capabilities; | 575 this.destinationStore_.selectedDestination.capabilities; |
| 590 if (!okToPrint) { | 576 if (!okToPrint) { |
| 591 return PrintPreview.PrintAttemptResult_.NOT_READY; | 577 return PrintPreview.PrintAttemptResult_.NOT_READY; |
| 592 } | 578 } |
| 593 if (this.isPreviewGenerationInProgress_) { | 579 if (this.isPreviewGenerationInProgress_) { |
| 594 return PrintPreview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW; | 580 return PrintPreview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW; |
| 595 } | 581 } |
| 596 assert(this.printTicketStore_.isTicketValid(), | 582 assert( |
| 583 this.printTicketStore_.isTicketValid(), |
| 597 'Trying to print with invalid ticket'); | 584 'Trying to print with invalid ticket'); |
| 598 if (getIsVisible(this.moreSettings_.getElement())) { | 585 if (getIsVisible(this.moreSettings_.getElement())) { |
| 599 new print_preview.PrintSettingsUiMetricsContext().record( | 586 new print_preview.PrintSettingsUiMetricsContext().record( |
| 600 this.moreSettings_.isExpanded ? | 587 this.moreSettings_.isExpanded ? |
| 601 print_preview.Metrics.PrintSettingsUiBucket. | 588 print_preview.Metrics.PrintSettingsUiBucket |
| 602 PRINT_WITH_SETTINGS_EXPANDED : | 589 .PRINT_WITH_SETTINGS_EXPANDED : |
| 603 print_preview.Metrics.PrintSettingsUiBucket. | 590 print_preview.Metrics.PrintSettingsUiBucket |
| 604 PRINT_WITH_SETTINGS_COLLAPSED); | 591 .PRINT_WITH_SETTINGS_COLLAPSED); |
| 605 } | 592 } |
| 606 this.nativeLayer_.startPrint( | 593 this.nativeLayer_.startPrint( |
| 607 this.destinationStore_.selectedDestination, | 594 this.destinationStore_.selectedDestination, this.printTicketStore_, |
| 608 this.printTicketStore_, | 595 this.cloudPrintInterface_, this.documentInfo_, |
| 609 this.cloudPrintInterface_, | |
| 610 this.documentInfo_, | |
| 611 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW, | 596 this.uiState_ == PrintPreview.UiState_.OPENING_PDF_PREVIEW, |
| 612 this.showSystemDialogBeforeNextPrint_); | 597 this.showSystemDialogBeforeNextPrint_); |
| 613 this.showSystemDialogBeforeNextPrint_ = false; | 598 this.showSystemDialogBeforeNextPrint_ = false; |
| 614 return PrintPreview.PrintAttemptResult_.PRINTED; | 599 return PrintPreview.PrintAttemptResult_.PRINTED; |
| 615 }, | 600 }, |
| 616 | 601 |
| 617 /** | 602 /** |
| 618 * Closes the print preview. | 603 * Closes the print preview. |
| 619 * @private | 604 * @private |
| 620 */ | 605 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 646 | 631 |
| 647 /** | 632 /** |
| 648 * Called when the native layer has initial settings to set. Sets the | 633 * Called when the native layer has initial settings to set. Sets the |
| 649 * initial settings of the print preview and begins fetching print | 634 * initial settings of the print preview and begins fetching print |
| 650 * destinations. | 635 * destinations. |
| 651 * @param {Event} event Contains the initial print preview settings | 636 * @param {Event} event Contains the initial print preview settings |
| 652 * persisted through the session. | 637 * persisted through the session. |
| 653 * @private | 638 * @private |
| 654 */ | 639 */ |
| 655 onInitialSettingsSet_: function(event) { | 640 onInitialSettingsSet_: function(event) { |
| 656 assert(this.uiState_ == PrintPreview.UiState_.INITIALIZING, | 641 assert( |
| 657 'Updating initial settings when not in initializing state: ' + | 642 this.uiState_ == PrintPreview.UiState_.INITIALIZING, |
| 658 this.uiState_); | 643 'Updating initial settings when not in initializing state: ' + |
| 644 this.uiState_); |
| 659 this.uiState_ = PrintPreview.UiState_.READY; | 645 this.uiState_ = PrintPreview.UiState_.READY; |
| 660 | 646 |
| 661 var settings = event.initialSettings; | 647 var settings = event.initialSettings; |
| 662 this.isInKioskAutoPrintMode_ = settings.isInKioskAutoPrintMode; | 648 this.isInKioskAutoPrintMode_ = settings.isInKioskAutoPrintMode; |
| 663 this.isInAppKioskMode_ = settings.isInAppKioskMode; | 649 this.isInAppKioskMode_ = settings.isInAppKioskMode; |
| 664 | 650 |
| 665 // The following components must be initialized in this order. | 651 // The following components must be initialized in this order. |
| 666 this.appState_.init(settings.serializedAppStateStr); | 652 this.appState_.init(settings.serializedAppStateStr); |
| 667 this.documentInfo_.init( | 653 this.documentInfo_.init( |
| 668 settings.isDocumentModifiable, | 654 settings.isDocumentModifiable, settings.documentTitle, |
| 669 settings.documentTitle, | |
| 670 settings.documentHasSelection); | 655 settings.documentHasSelection); |
| 671 this.printTicketStore_.init( | 656 this.printTicketStore_.init( |
| 672 settings.thousandsDelimeter, | 657 settings.thousandsDelimeter, settings.decimalDelimeter, |
| 673 settings.decimalDelimeter, | 658 settings.unitType, settings.selectionOnly); |
| 674 settings.unitType, | |
| 675 settings.selectionOnly); | |
| 676 this.destinationStore_.init( | 659 this.destinationStore_.init( |
| 677 settings.isInAppKioskMode, | 660 settings.isInAppKioskMode, settings.systemDefaultDestinationId, |
| 678 settings.systemDefaultDestinationId, | |
| 679 settings.serializedDefaultDestinationSelectionRulesStr); | 661 settings.serializedDefaultDestinationSelectionRulesStr); |
| 680 this.appState_.setInitialized(); | 662 this.appState_.setInitialized(); |
| 681 | 663 |
| 682 $('document-title').innerText = settings.documentTitle; | 664 $('document-title').innerText = settings.documentTitle; |
| 683 this.hideSystemDialogLink_ = settings.isInAppKioskMode; | 665 this.hideSystemDialogLink_ = settings.isInAppKioskMode; |
| 684 if ($('system-dialog-link')) { | 666 if ($('system-dialog-link')) { |
| 685 setIsVisible($('system-dialog-link'), | 667 setIsVisible( |
| 686 this.shouldShowSystemDialogLink_()); | 668 $('system-dialog-link'), this.shouldShowSystemDialogLink_()); |
| 687 } | 669 } |
| 688 }, | 670 }, |
| 689 | 671 |
| 690 /** | 672 /** |
| 691 * Calls when the native layer enables Google Cloud Print integration. | 673 * Calls when the native layer enables Google Cloud Print integration. |
| 692 * Fetches the user's cloud printers. | 674 * Fetches the user's cloud printers. |
| 693 * @param {Event} event Contains the base URL of the Google Cloud Print | 675 * @param {Event} event Contains the base URL of the Google Cloud Print |
| 694 * service. | 676 * service. |
| 695 * @private | 677 * @private |
| 696 */ | 678 */ |
| 697 onCloudPrintEnable_: function(event) { | 679 onCloudPrintEnable_: function(event) { |
| 698 this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface( | 680 this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface( |
| 699 event.baseCloudPrintUrl, | 681 event.baseCloudPrintUrl, this.nativeLayer_, this.userInfo_, |
| 700 this.nativeLayer_, | |
| 701 this.userInfo_, | |
| 702 event.appKioskMode); | 682 event.appKioskMode); |
| 703 this.tracker.add( | 683 this.tracker.add( |
| 704 this.cloudPrintInterface_, | 684 this.cloudPrintInterface_, |
| 705 cloudprint.CloudPrintInterface.EventType.SUBMIT_DONE, | 685 cloudprint.CloudPrintInterface.EventType.SUBMIT_DONE, |
| 706 this.onCloudPrintSubmitDone_.bind(this)); | 686 this.onCloudPrintSubmitDone_.bind(this)); |
| 707 this.tracker.add( | 687 this.tracker.add( |
| 708 this.cloudPrintInterface_, | 688 this.cloudPrintInterface_, |
| 709 cloudprint.CloudPrintInterface.EventType.SEARCH_FAILED, | 689 cloudprint.CloudPrintInterface.EventType.SEARCH_FAILED, |
| 710 this.onCloudPrintError_.bind(this)); | 690 this.onCloudPrintError_.bind(this)); |
| 711 this.tracker.add( | 691 this.tracker.add( |
| 712 this.cloudPrintInterface_, | 692 this.cloudPrintInterface_, |
| 713 cloudprint.CloudPrintInterface.EventType.SUBMIT_FAILED, | 693 cloudprint.CloudPrintInterface.EventType.SUBMIT_FAILED, |
| 714 this.onCloudPrintError_.bind(this)); | 694 this.onCloudPrintError_.bind(this)); |
| 715 this.tracker.add( | 695 this.tracker.add( |
| 716 this.cloudPrintInterface_, | 696 this.cloudPrintInterface_, |
| 717 cloudprint.CloudPrintInterface.EventType.PRINTER_FAILED, | 697 cloudprint.CloudPrintInterface.EventType.PRINTER_FAILED, |
| 718 this.onCloudPrintError_.bind(this)); | 698 this.onCloudPrintError_.bind(this)); |
| 719 this.tracker.add( | 699 this.tracker.add( |
| 720 this.cloudPrintInterface_, | 700 this.cloudPrintInterface_, cloudprint.CloudPrintInterface.EventType |
| 721 cloudprint.CloudPrintInterface.EventType. | 701 .UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED, |
| 722 UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED, | |
| 723 this.onCloudPrintError_.bind(this)); | 702 this.onCloudPrintError_.bind(this)); |
| 724 | 703 |
| 725 this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_); | 704 this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_); |
| 726 this.invitationStore_.setCloudPrintInterface(this.cloudPrintInterface_); | 705 this.invitationStore_.setCloudPrintInterface(this.cloudPrintInterface_); |
| 727 if (this.destinationSearch_.getIsVisible()) { | 706 if (this.destinationSearch_.getIsVisible()) { |
| 728 this.destinationStore_.startLoadCloudDestinations(); | 707 this.destinationStore_.startLoadCloudDestinations(); |
| 729 this.invitationStore_.startLoadingInvitations(); | 708 this.invitationStore_.startLoadingInvitations(); |
| 730 } | 709 } |
| 731 }, | 710 }, |
| 732 | 711 |
| 733 /** | 712 /** |
| 734 * Called from the native layer when ready to print to Google Cloud Print. | 713 * Called from the native layer when ready to print to Google Cloud Print. |
| 735 * @param {Event} event Contains the body to send in the HTTP request. | 714 * @param {Event} event Contains the body to send in the HTTP request. |
| 736 * @private | 715 * @private |
| 737 */ | 716 */ |
| 738 onPrintToCloud_: function(event) { | 717 onPrintToCloud_: function(event) { |
| 739 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, | 718 assert( |
| 740 'Document ready to be sent to the cloud when not in printing ' + | 719 this.uiState_ == PrintPreview.UiState_.PRINTING, |
| 741 'state: ' + this.uiState_); | 720 'Document ready to be sent to the cloud when not in printing ' + |
| 742 assert(this.cloudPrintInterface_ != null, | 721 'state: ' + this.uiState_); |
| 743 'Google Cloud Print is not enabled'); | 722 assert( |
| 723 this.cloudPrintInterface_ != null, |
| 724 'Google Cloud Print is not enabled'); |
| 744 this.cloudPrintInterface_.submit( | 725 this.cloudPrintInterface_.submit( |
| 745 this.destinationStore_.selectedDestination, | 726 this.destinationStore_.selectedDestination, this.printTicketStore_, |
| 746 this.printTicketStore_, | 727 this.documentInfo_, event.data); |
| 747 this.documentInfo_, | |
| 748 event.data); | |
| 749 }, | 728 }, |
| 750 | 729 |
| 751 /** | 730 /** |
| 752 * Called from the native layer when the user cancels the save-to-pdf file | 731 * Called from the native layer when the user cancels the save-to-pdf file |
| 753 * selection dialog. | 732 * selection dialog. |
| 754 * @private | 733 * @private |
| 755 */ | 734 */ |
| 756 onFileSelectionCancel_: function() { | 735 onFileSelectionCancel_: function() { |
| 757 assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, | 736 assert( |
| 758 'File selection cancelled when not in file-selection state: ' + | 737 this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, |
| 759 this.uiState_); | 738 'File selection cancelled when not in file-selection state: ' + |
| 739 this.uiState_); |
| 760 this.setIsEnabled_(true); | 740 this.setIsEnabled_(true); |
| 761 this.uiState_ = PrintPreview.UiState_.READY; | 741 this.uiState_ = PrintPreview.UiState_.READY; |
| 762 }, | 742 }, |
| 763 | 743 |
| 764 /** | 744 /** |
| 765 * Called from the native layer when save-to-pdf file selection is complete. | 745 * Called from the native layer when save-to-pdf file selection is complete. |
| 766 * @private | 746 * @private |
| 767 */ | 747 */ |
| 768 onFileSelectionComplete_: function() { | 748 onFileSelectionComplete_: function() { |
| 769 assert(this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, | 749 assert( |
| 770 'File selection completed when not in file-selection state: ' + | 750 this.uiState_ == PrintPreview.UiState_.FILE_SELECTION, |
| 771 this.uiState_); | 751 'File selection completed when not in file-selection state: ' + |
| 752 this.uiState_); |
| 772 this.previewArea_.showCustomMessage( | 753 this.previewArea_.showCustomMessage( |
| 773 loadTimeData.getString('printingToPDFInProgress')); | 754 loadTimeData.getString('printingToPDFInProgress')); |
| 774 this.uiState_ = PrintPreview.UiState_.PRINTING; | 755 this.uiState_ = PrintPreview.UiState_.PRINTING; |
| 775 }, | 756 }, |
| 776 | 757 |
| 777 /** | 758 /** |
| 778 * Called after successfully submitting a job to Google Cloud Print. | 759 * Called after successfully submitting a job to Google Cloud Print. |
| 779 * @param {!Event} event Contains the ID of the submitted print job. | 760 * @param {!Event} event Contains the ID of the submitted print job. |
| 780 * @private | 761 * @private |
| 781 */ | 762 */ |
| 782 onCloudPrintSubmitDone_: function(event) { | 763 onCloudPrintSubmitDone_: function(event) { |
| 783 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, | 764 assert( |
| 784 'Submited job to Google Cloud Print but not in printing state ' + | 765 this.uiState_ == PrintPreview.UiState_.PRINTING, |
| 785 this.uiState_); | 766 'Submited job to Google Cloud Print but not in printing state ' + |
| 767 this.uiState_); |
| 786 if (this.destinationStore_.selectedDestination.id == | 768 if (this.destinationStore_.selectedDestination.id == |
| 787 print_preview.Destination.GooglePromotedId.FEDEX) { | 769 print_preview.Destination.GooglePromotedId.FEDEX) { |
| 788 this.nativeLayer_.startForceOpenNewTab( | 770 this.nativeLayer_.startForceOpenNewTab( |
| 789 'https://www.google.com/cloudprint/fedexcode.html?jobid=' + | 771 'https://www.google.com/cloudprint/fedexcode.html?jobid=' + |
| 790 event.jobId); | 772 event.jobId); |
| 791 } | 773 } |
| 792 this.close_(); | 774 this.close_(); |
| 793 }, | 775 }, |
| 794 | 776 |
| 795 /** | 777 /** |
| 796 * Called when there was an error communicating with Google Cloud print. | 778 * Called when there was an error communicating with Google Cloud print. |
| 797 * Displays an error message in the print header. | 779 * Displays an error message in the print header. |
| 798 * @param {!Event} event Contains the error message. | 780 * @param {!Event} event Contains the error message. |
| 799 * @private | 781 * @private |
| 800 */ | 782 */ |
| 801 onCloudPrintError_: function(event) { | 783 onCloudPrintError_: function(event) { |
| 802 if (event.status == 403) { | 784 if (event.status == 403) { |
| 803 if (!this.isInAppKioskMode_) { | 785 if (!this.isInAppKioskMode_) { |
| 804 this.destinationSearch_.showCloudPrintPromo(); | 786 this.destinationSearch_.showCloudPrintPromo(); |
| 805 } | 787 } |
| 806 } else if (event.status == 0) { | 788 } else if (event.status == 0) { |
| 807 return; // Ignore, the system does not have internet connectivity. | 789 return; // Ignore, the system does not have internet connectivity. |
| 808 } else { | 790 } else { |
| 809 this.printHeader_.setErrorMessage(event.message); | 791 this.printHeader_.setErrorMessage(event.message); |
| 810 } | 792 } |
| 811 if (event.status == 200) { | 793 if (event.status == 200) { |
| 812 console.error('Google Cloud Print Error: (' + event.errorCode + ') ' + | 794 console.error( |
| 813 event.message); | 795 'Google Cloud Print Error: (' + event.errorCode + ') ' + |
| 796 event.message); |
| 814 } else { | 797 } else { |
| 815 console.error('Google Cloud Print Error: HTTP status ' + event.status); | 798 console.error('Google Cloud Print Error: HTTP status ' + event.status); |
| 816 } | 799 } |
| 817 }, | 800 }, |
| 818 | 801 |
| 819 /** | 802 /** |
| 820 * Called when the preview area's preview generation is in progress. | 803 * Called when the preview area's preview generation is in progress. |
| 821 * @private | 804 * @private |
| 822 */ | 805 */ |
| 823 onPreviewGenerationInProgress_: function() { | 806 onPreviewGenerationInProgress_: function() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 847 }, | 830 }, |
| 848 | 831 |
| 849 /** | 832 /** |
| 850 * Called when the 'Open pdf in preview' link is clicked. Launches the pdf | 833 * Called when the 'Open pdf in preview' link is clicked. Launches the pdf |
| 851 * preview app. | 834 * preview app. |
| 852 * @private | 835 * @private |
| 853 */ | 836 */ |
| 854 onOpenPdfInPreviewLinkClick_: function() { | 837 onOpenPdfInPreviewLinkClick_: function() { |
| 855 if ($('open-pdf-in-preview-link').classList.contains('disabled')) | 838 if ($('open-pdf-in-preview-link').classList.contains('disabled')) |
| 856 return; | 839 return; |
| 857 assert(this.uiState_ == PrintPreview.UiState_.READY, | 840 assert( |
| 858 'Trying to open pdf in preview when not in ready state: ' + | 841 this.uiState_ == PrintPreview.UiState_.READY, |
| 859 this.uiState_); | 842 'Trying to open pdf in preview when not in ready state: ' + |
| 843 this.uiState_); |
| 860 setIsVisible(getRequiredElement('open-preview-app-throbber'), true); | 844 setIsVisible(getRequiredElement('open-preview-app-throbber'), true); |
| 861 this.previewArea_.showCustomMessage( | 845 this.previewArea_.showCustomMessage( |
| 862 loadTimeData.getString('openingPDFInPreview')); | 846 loadTimeData.getString('openingPDFInPreview')); |
| 863 this.printDocumentOrOpenPdfPreview_(true /*isPdfPreview*/); | 847 this.printDocumentOrOpenPdfPreview_(true /*isPdfPreview*/); |
| 864 }, | 848 }, |
| 865 | 849 |
| 866 /** | 850 /** |
| 867 * Called when the print header's print button is clicked. Prints the | 851 * Called when the print header's print button is clicked. Prints the |
| 868 * document. | 852 * document. |
| 869 * @private | 853 * @private |
| 870 */ | 854 */ |
| 871 onPrintButtonClick_: function() { | 855 onPrintButtonClick_: function() { |
| 872 assert(this.uiState_ == PrintPreview.UiState_.READY, | 856 assert( |
| 873 'Trying to print when not in ready state: ' + this.uiState_); | 857 this.uiState_ == PrintPreview.UiState_.READY, |
| 858 'Trying to print when not in ready state: ' + this.uiState_); |
| 874 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); | 859 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); |
| 875 }, | 860 }, |
| 876 | 861 |
| 877 /** | 862 /** |
| 878 * Called when the print header's cancel button is clicked. Closes the | 863 * Called when the print header's cancel button is clicked. Closes the |
| 879 * print dialog. | 864 * print dialog. |
| 880 * @private | 865 * @private |
| 881 */ | 866 */ |
| 882 onCancelButtonClick_: function() { | 867 onCancelButtonClick_: function() { |
| 883 this.close_(); | 868 this.close_(); |
| 884 }, | 869 }, |
| 885 | 870 |
| 886 /** | 871 /** |
| 887 * Called when the register promo for Cloud Print is clicked. | 872 * Called when the register promo for Cloud Print is clicked. |
| 888 * @private | 873 * @private |
| 889 */ | 874 */ |
| 890 onCloudPrintRegisterPromoClick_: function(e) { | 875 onCloudPrintRegisterPromoClick_: function(e) { |
| 891 var devicesUrl = 'chrome://devices/register?id=' + e.destination.id; | 876 var devicesUrl = 'chrome://devices/register?id=' + e.destination.id; |
| 892 this.nativeLayer_.startForceOpenNewTab(devicesUrl); | 877 this.nativeLayer_.startForceOpenNewTab(devicesUrl); |
| 893 this.destinationStore_.waitForRegister(e.destination.id); | 878 this.destinationStore_.waitForRegister(e.destination.id); |
| 894 }, | 879 }, |
| 895 | 880 |
| 896 /** | 881 /** |
| 897 * Consume escape key presses and ctrl + shift + p. Delegate everything else | 882 * Consume escape key presses and ctrl + shift + p. Delegate everything else |
| 898 * to the preview area. | 883 * to the preview area. |
| 899 * @param {KeyboardEvent} e The keyboard event. | 884 * @param {KeyboardEvent} e The keyboard event. |
| 900 * @private | 885 * @private |
| 901 * @suppress {uselessCode} | 886 * @suppress {uselessCode} |
| 902 * Current compiler preprocessor leaves all the code inside all the <if>s, | 887 * Current compiler preprocessor leaves all the code inside all the <if>s, |
| 903 * so the compiler claims that code after first return is unreachable. | 888 * so the compiler claims that code after first return is unreachable. |
| 904 */ | 889 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 929 e.preventDefault(); | 914 e.preventDefault(); |
| 930 return; | 915 return; |
| 931 } | 916 } |
| 932 } | 917 } |
| 933 | 918 |
| 934 if (e.keyCode == 13 /*enter*/ && | 919 if (e.keyCode == 13 /*enter*/ && |
| 935 !document.querySelector('.overlay:not([hidden])') && | 920 !document.querySelector('.overlay:not([hidden])') && |
| 936 this.destinationStore_.selectedDestination && | 921 this.destinationStore_.selectedDestination && |
| 937 this.printTicketStore_.isTicketValid() && | 922 this.printTicketStore_.isTicketValid() && |
| 938 this.printHeader_.isPrintButtonEnabled) { | 923 this.printHeader_.isPrintButtonEnabled) { |
| 939 assert(this.uiState_ == PrintPreview.UiState_.READY, | 924 assert( |
| 925 this.uiState_ == PrintPreview.UiState_.READY, |
| 940 'Trying to print when not in ready state: ' + this.uiState_); | 926 'Trying to print when not in ready state: ' + this.uiState_); |
| 941 var activeElementTag = document.activeElement.tagName.toUpperCase(); | 927 var activeElementTag = document.activeElement.tagName.toUpperCase(); |
| 942 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT' && | 928 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT' && |
| 943 activeElementTag != 'A') { | 929 activeElementTag != 'A') { |
| 944 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); | 930 this.printDocumentOrOpenPdfPreview_(false /*isPdfPreview*/); |
| 945 e.preventDefault(); | 931 e.preventDefault(); |
| 946 } | 932 } |
| 947 return; | 933 return; |
| 948 } | 934 } |
| 949 | 935 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 | 1020 |
| 1035 /** | 1021 /** |
| 1036 * Called when the Page Count Ready message is received to update the fit to | 1022 * Called when the Page Count Ready message is received to update the fit to |
| 1037 * page scaling value in the scaling settings. | 1023 * page scaling value in the scaling settings. |
| 1038 * @param {Event} event Event object representing the page count ready | 1024 * @param {Event} event Event object representing the page count ready |
| 1039 * message | 1025 * message |
| 1040 * @private | 1026 * @private |
| 1041 */ | 1027 */ |
| 1042 onPageCountReady_: function(event) { | 1028 onPageCountReady_: function(event) { |
| 1043 if (event.fitToPageScaling >= 0) { | 1029 if (event.fitToPageScaling >= 0) { |
| 1044 this.scalingSettings_.updateFitToPageScaling( | 1030 this.scalingSettings_.updateFitToPageScaling(event.fitToPageScaling); |
| 1045 event.fitToPageScaling); | |
| 1046 } | 1031 } |
| 1047 }, | 1032 }, |
| 1048 | 1033 |
| 1049 /** | 1034 /** |
| 1050 * Called when privet printing fails. | 1035 * Called when privet printing fails. |
| 1051 * @param {Event} event Event object representing the failure. | 1036 * @param {Event} event Event object representing the failure. |
| 1052 * @private | 1037 * @private |
| 1053 */ | 1038 */ |
| 1054 onPrivetPrintFailed_: function(event) { | 1039 onPrivetPrintFailed_: function(event) { |
| 1055 console.error('Privet printing failed with error code ' + | 1040 console.error( |
| 1056 event.httpError); | 1041 'Privet printing failed with error code ' + event.httpError); |
| 1057 this.printHeader_.setErrorMessage( | 1042 this.printHeader_.setErrorMessage( |
| 1058 loadTimeData.getString('couldNotPrint')); | 1043 loadTimeData.getString('couldNotPrint')); |
| 1059 }, | 1044 }, |
| 1060 | 1045 |
| 1061 /** | 1046 /** |
| 1062 * Called when the print preview settings need to be changed for testing. | 1047 * Called when the print preview settings need to be changed for testing. |
| 1063 * @param {Event} event Event object that contains the option that is to | 1048 * @param {Event} event Event object that contains the option that is to |
| 1064 * be changed and what to set that option. | 1049 * be changed and what to set that option. |
| 1065 * @private | 1050 * @private |
| 1066 */ | 1051 */ |
| 1067 onManipulateSettingsForTest_: function(event) { | 1052 onManipulateSettingsForTest_: function(event) { |
| 1068 var settings = | 1053 var settings = |
| 1069 /** @type {print_preview.PreviewSettings} */(event.settings); | 1054 /** @type {print_preview.PreviewSettings} */ (event.settings); |
| 1070 if ('selectSaveAsPdfDestination' in settings) { | 1055 if ('selectSaveAsPdfDestination' in settings) { |
| 1071 this.saveAsPdfForTest_(); // No parameters. | 1056 this.saveAsPdfForTest_(); // No parameters. |
| 1072 } else if ('layoutSettings' in settings) { | 1057 } else if ('layoutSettings' in settings) { |
| 1073 this.setLayoutSettingsForTest_(settings.layoutSettings.portrait); | 1058 this.setLayoutSettingsForTest_(settings.layoutSettings.portrait); |
| 1074 } else if ('pageRange' in settings) { | 1059 } else if ('pageRange' in settings) { |
| 1075 this.setPageRangeForTest_(settings.pageRange); | 1060 this.setPageRangeForTest_(settings.pageRange); |
| 1076 } else if ('headersAndFooters' in settings) { | 1061 } else if ('headersAndFooters' in settings) { |
| 1077 this.setHeadersAndFootersForTest_(settings.headersAndFooters); | 1062 this.setHeadersAndFootersForTest_(settings.headersAndFooters); |
| 1078 } else if ('backgroundColorsAndImages' in settings) { | 1063 } else if ('backgroundColorsAndImages' in settings) { |
| 1079 this.setBackgroundColorsAndImagesForTest_( | 1064 this.setBackgroundColorsAndImagesForTest_( |
| 1080 settings.backgroundColorsAndImages); | 1065 settings.backgroundColorsAndImages); |
| 1081 } else if ('margins' in settings) { | 1066 } else if ('margins' in settings) { |
| 1082 this.setMarginsForTest_(settings.margins); | 1067 this.setMarginsForTest_(settings.margins); |
| 1083 } | 1068 } |
| 1084 }, | 1069 }, |
| 1085 | 1070 |
| 1086 /** | 1071 /** |
| 1087 * Called by onManipulateSettingsForTest_(). Sets the print destination | 1072 * Called by onManipulateSettingsForTest_(). Sets the print destination |
| 1088 * as a pdf. | 1073 * as a pdf. |
| 1089 * @private | 1074 * @private |
| 1090 */ | 1075 */ |
| 1091 saveAsPdfForTest_: function() { | 1076 saveAsPdfForTest_: function() { |
| 1092 if (this.destinationStore_.selectedDestination && | 1077 if (this.destinationStore_.selectedDestination && |
| 1093 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF == | 1078 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF == |
| 1094 this.destinationStore_.selectedDestination.id) { | 1079 this.destinationStore_.selectedDestination.id) { |
| 1095 this.nativeLayer_.previewReadyForTest(); | 1080 this.nativeLayer_.previewReadyForTest(); |
| 1096 return; | 1081 return; |
| 1097 } | 1082 } |
| 1098 | 1083 |
| 1099 var destinations = this.destinationStore_.destinations(); | 1084 var destinations = this.destinationStore_.destinations(); |
| 1100 var pdfDestination = null; | 1085 var pdfDestination = null; |
| 1101 for (var i = 0; i < destinations.length; i++) { | 1086 for (var i = 0; i < destinations.length; i++) { |
| 1102 if (destinations[i].id == | 1087 if (destinations[i].id == |
| 1103 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { | 1088 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { |
| 1104 pdfDestination = destinations[i]; | 1089 pdfDestination = destinations[i]; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 * current destination. | 1185 * current destination. |
| 1201 * @return {boolean} Returns true if link should be shown. | 1186 * @return {boolean} Returns true if link should be shown. |
| 1202 */ | 1187 */ |
| 1203 shouldShowSystemDialogLink_: function() { | 1188 shouldShowSystemDialogLink_: function() { |
| 1204 if (cr.isChromeOS || this.hideSystemDialogLink_) | 1189 if (cr.isChromeOS || this.hideSystemDialogLink_) |
| 1205 return false; | 1190 return false; |
| 1206 if (!cr.isWindows) | 1191 if (!cr.isWindows) |
| 1207 return true; | 1192 return true; |
| 1208 var selectedDest = this.destinationStore_.selectedDestination; | 1193 var selectedDest = this.destinationStore_.selectedDestination; |
| 1209 return !!selectedDest && | 1194 return !!selectedDest && |
| 1210 selectedDest.origin == print_preview.Destination.Origin.LOCAL && | 1195 selectedDest.origin == print_preview.Destination.Origin.LOCAL && |
| 1211 selectedDest.id != | 1196 selectedDest.id != |
| 1212 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; | 1197 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; |
| 1213 }, | 1198 }, |
| 1214 | 1199 |
| 1215 /** | 1200 /** |
| 1216 * Called when a print destination is selected. Shows/hides the "Print with | 1201 * Called when a print destination is selected. Shows/hides the "Print with |
| 1217 * Cloud Print" link in the navbar. | 1202 * Cloud Print" link in the navbar. |
| 1218 * @private | 1203 * @private |
| 1219 */ | 1204 */ |
| 1220 onDestinationSelect_: function() { | 1205 onDestinationSelect_: function() { |
| 1221 if ($('system-dialog-link')) { | 1206 if ($('system-dialog-link')) { |
| 1222 setIsVisible($('system-dialog-link'), | 1207 setIsVisible( |
| 1223 this.shouldShowSystemDialogLink_()); | 1208 $('system-dialog-link'), this.shouldShowSystemDialogLink_()); |
| 1224 } | 1209 } |
| 1225 if (this.destinationStore_.selectedDestination && | 1210 if (this.destinationStore_.selectedDestination && |
| 1226 this.isInKioskAutoPrintMode_) { | 1211 this.isInKioskAutoPrintMode_) { |
| 1227 this.onPrintButtonClick_(); | 1212 this.onPrintButtonClick_(); |
| 1228 } | 1213 } |
| 1229 }, | 1214 }, |
| 1230 | 1215 |
| 1231 /** | 1216 /** |
| 1232 * Called when the destination store loads a group of destinations. Shows | 1217 * Called when the destination store loads a group of destinations. Shows |
| 1233 * a promo on Chrome OS if the user has no print destinations promoting | 1218 * a promo on Chrome OS if the user has no print destinations promoting |
| 1234 * Google Cloud Print. | 1219 * Google Cloud Print. |
| 1235 * @private | 1220 * @private |
| 1236 */ | 1221 */ |
| 1237 onDestinationSearchDone_: function() { | 1222 onDestinationSearchDone_: function() { |
| 1238 var isPromoVisible = cr.isChromeOS && | 1223 var isPromoVisible = cr.isChromeOS && this.cloudPrintInterface_ && |
| 1239 this.cloudPrintInterface_ && | 1224 this.userInfo_.activeUser && !this.appState_.isGcpPromoDismissed && |
| 1240 this.userInfo_.activeUser && | |
| 1241 !this.appState_.isGcpPromoDismissed && | |
| 1242 !this.destinationStore_.isLocalDestinationSearchInProgress && | 1225 !this.destinationStore_.isLocalDestinationSearchInProgress && |
| 1243 !this.destinationStore_.isCloudDestinationSearchInProgress && | 1226 !this.destinationStore_.isCloudDestinationSearchInProgress && |
| 1244 this.destinationStore_.hasOnlyDefaultCloudDestinations(); | 1227 this.destinationStore_.hasOnlyDefaultCloudDestinations(); |
| 1245 setIsVisible(this.getChildElement('#no-destinations-promo'), | 1228 setIsVisible( |
| 1246 isPromoVisible); | 1229 this.getChildElement('#no-destinations-promo'), isPromoVisible); |
| 1247 if (isPromoVisible) { | 1230 if (isPromoVisible) { |
| 1248 new print_preview.GcpPromoMetricsContext().record( | 1231 new print_preview.GcpPromoMetricsContext().record( |
| 1249 print_preview.Metrics.GcpPromoBucket.PROMO_SHOWN); | 1232 print_preview.Metrics.GcpPromoBucket.PROMO_SHOWN); |
| 1250 } | 1233 } |
| 1251 }, | 1234 }, |
| 1252 | 1235 |
| 1253 /** | 1236 /** |
| 1254 * Called when the close button on the no-destinations-promotion is clicked. | 1237 * Called when the close button on the no-destinations-promotion is clicked. |
| 1255 * Hides the promotion. | 1238 * Hides the promotion. |
| 1256 * @private | 1239 * @private |
| 1257 */ | 1240 */ |
| 1258 onNoDestinationsPromoClose_: function() { | 1241 onNoDestinationsPromoClose_: function() { |
| 1259 new print_preview.GcpPromoMetricsContext().record( | 1242 new print_preview.GcpPromoMetricsContext().record( |
| 1260 print_preview.Metrics.GcpPromoBucket.PROMO_CLOSED); | 1243 print_preview.Metrics.GcpPromoBucket.PROMO_CLOSED); |
| 1261 setIsVisible(this.getChildElement('#no-destinations-promo'), false); | 1244 setIsVisible(this.getChildElement('#no-destinations-promo'), false); |
| 1262 this.appState_.persistIsGcpPromoDismissed(true); | 1245 this.appState_.persistIsGcpPromoDismissed(true); |
| 1263 }, | 1246 }, |
| 1264 | 1247 |
| 1265 /** | 1248 /** |
| 1266 * Called when the no-destinations promotion link is clicked. Opens the | 1249 * Called when the no-destinations promotion link is clicked. Opens the |
| 1267 * Google Cloud Print management page and closes the print preview. | 1250 * Google Cloud Print management page and closes the print preview. |
| 1268 * @private | 1251 * @private |
| 1269 */ | 1252 */ |
| 1270 onNoDestinationsPromoClick_: function() { | 1253 onNoDestinationsPromoClick_: function() { |
| 1271 new print_preview.GcpPromoMetricsContext().record( | 1254 new print_preview.GcpPromoMetricsContext().record( |
| 1272 print_preview.Metrics.GcpPromoBucket.PROMO_CLICKED); | 1255 print_preview.Metrics.GcpPromoBucket.PROMO_CLICKED); |
| 1273 this.appState_.persistIsGcpPromoDismissed(true); | 1256 this.appState_.persistIsGcpPromoDismissed(true); |
| 1274 window.open(this.cloudPrintInterface_.baseUrl + '?user=' + | 1257 window.open( |
| 1275 this.userInfo_.activeUser + '#printers'); | 1258 this.cloudPrintInterface_.baseUrl + '?user=' + |
| 1259 this.userInfo_.activeUser + '#printers'); |
| 1276 this.close_(); | 1260 this.close_(); |
| 1277 } | 1261 } |
| 1278 }; | 1262 }; |
| 1279 | 1263 |
| 1280 // Export | 1264 // Export |
| 1281 return { | 1265 return {PrintPreview: PrintPreview}; |
| 1282 PrintPreview: PrintPreview | |
| 1283 }; | |
| 1284 }); | 1266 }); |
| 1285 | 1267 |
| 1286 // Pull in all other scripts in a single shot. | 1268 // Pull in all other scripts in a single shot. |
| 1287 <include src="common/overlay.js"> | 1269 // <include src="common/overlay.js"> |
| 1288 <include src="common/search_box.js"> | 1270 // <include src="common/search_box.js"> |
| 1289 <include src="common/search_bubble.js"> | 1271 // <include src="common/search_bubble.js"> |
| 1290 | 1272 |
| 1291 <include src="data/page_number_set.js"> | 1273 // <include src="data/page_number_set.js"> |
| 1292 <include src="data/destination.js"> | 1274 // <include src="data/destination.js"> |
| 1293 <include src="data/local_parsers.js"> | 1275 // <include src="data/local_parsers.js"> |
| 1294 <include src="data/cloud_parsers.js"> | 1276 // <include src="data/cloud_parsers.js"> |
| 1295 <include src="data/destination_store.js"> | 1277 // <include src="data/destination_store.js"> |
| 1296 <include src="data/invitation.js"> | 1278 // <include src="data/invitation.js"> |
| 1297 <include src="data/invitation_store.js"> | 1279 // <include src="data/invitation_store.js"> |
| 1298 <include src="data/margins.js"> | 1280 // <include src="data/margins.js"> |
| 1299 <include src="data/document_info.js"> | 1281 // <include src="data/document_info.js"> |
| 1300 <include src="data/printable_area.js"> | 1282 // <include src="data/printable_area.js"> |
| 1301 <include src="data/measurement_system.js"> | 1283 // <include src="data/measurement_system.js"> |
| 1302 <include src="data/print_ticket_store.js"> | 1284 // <include src="data/print_ticket_store.js"> |
| 1303 <include src="data/coordinate2d.js"> | 1285 // <include src="data/coordinate2d.js"> |
| 1304 <include src="data/size.js"> | 1286 // <include src="data/size.js"> |
| 1305 <include src="data/capabilities_holder.js"> | 1287 // <include src="data/capabilities_holder.js"> |
| 1306 <include src="data/user_info.js"> | 1288 // <include src="data/user_info.js"> |
| 1307 <include src="data/app_state.js"> | 1289 // <include src="data/app_state.js"> |
| 1308 | 1290 |
| 1309 <include src="data/ticket_items/ticket_item.js"> | 1291 // <include src="data/ticket_items/ticket_item.js"> |
| 1310 | 1292 |
| 1311 <include src="data/ticket_items/custom_margins.js"> | 1293 // <include src="data/ticket_items/custom_margins.js"> |
| 1312 <include src="data/ticket_items/collate.js"> | 1294 // <include src="data/ticket_items/collate.js"> |
| 1313 <include src="data/ticket_items/color.js"> | 1295 // <include src="data/ticket_items/color.js"> |
| 1314 <include src="data/ticket_items/copies.js"> | 1296 // <include src="data/ticket_items/copies.js"> |
| 1315 <include src="data/ticket_items/dpi.js"> | 1297 // <include src="data/ticket_items/dpi.js"> |
| 1316 <include src="data/ticket_items/duplex.js"> | 1298 // <include src="data/ticket_items/duplex.js"> |
| 1317 <include src="data/ticket_items/header_footer.js"> | 1299 // <include src="data/ticket_items/header_footer.js"> |
| 1318 <include src="data/ticket_items/media_size.js"> | 1300 // <include src="data/ticket_items/media_size.js"> |
| 1319 <include src="data/ticket_items/scaling.js"> | 1301 // <include src="data/ticket_items/scaling.js"> |
| 1320 <include src="data/ticket_items/landscape.js"> | 1302 // <include src="data/ticket_items/landscape.js"> |
| 1321 <include src="data/ticket_items/margins_type.js"> | 1303 // <include src="data/ticket_items/margins_type.js"> |
| 1322 <include src="data/ticket_items/page_range.js"> | 1304 // <include src="data/ticket_items/page_range.js"> |
| 1323 <include src="data/ticket_items/fit_to_page.js"> | 1305 // <include src="data/ticket_items/fit_to_page.js"> |
| 1324 <include src="data/ticket_items/css_background.js"> | 1306 // <include src="data/ticket_items/css_background.js"> |
| 1325 <include src="data/ticket_items/selection_only.js"> | 1307 // <include src="data/ticket_items/selection_only.js"> |
| 1326 <include src="data/ticket_items/rasterize.js"> | 1308 // <include src="data/ticket_items/rasterize.js"> |
| 1327 <include src="data/ticket_items/vendor_items.js"> | 1309 // <include src="data/ticket_items/vendor_items.js"> |
| 1328 | 1310 |
| 1329 <include src="native_layer.js"> | 1311 // <include src="native_layer.js"> |
| 1330 <include src="print_preview_animations.js"> | 1312 // <include src="print_preview_animations.js"> |
| 1331 <include src="cloud_print_interface.js"> | 1313 // <include src="cloud_print_interface.js"> |
| 1332 <include src="print_preview_utils.js"> | 1314 // <include src="print_preview_utils.js"> |
| 1333 <include src="print_header.js"> | 1315 // <include src="print_header.js"> |
| 1334 <include src="metrics.js"> | 1316 // <include src="metrics.js"> |
| 1335 | 1317 |
| 1336 <include src="settings/settings_section.js"> | 1318 // <include src="settings/settings_section.js"> |
| 1337 <include src="settings/settings_section_select.js"> | 1319 // <include src="settings/settings_section_select.js"> |
| 1338 <include src="settings/destination_settings.js"> | 1320 // <include src="settings/destination_settings.js"> |
| 1339 <include src="settings/page_settings.js"> | 1321 // <include src="settings/page_settings.js"> |
| 1340 <include src="settings/copies_settings.js"> | 1322 // <include src="settings/copies_settings.js"> |
| 1341 <include src="settings/layout_settings.js"> | 1323 // <include src="settings/layout_settings.js"> |
| 1342 <include src="settings/color_settings.js"> | 1324 // <include src="settings/color_settings.js"> |
| 1343 <include src="settings/media_size_settings.js"> | 1325 // <include src="settings/media_size_settings.js"> |
| 1344 <include src="settings/margin_settings.js"> | 1326 // <include src="settings/margin_settings.js"> |
| 1345 <include src="settings/dpi_settings.js"> | 1327 // <include src="settings/dpi_settings.js"> |
| 1346 <include src="settings/scaling_settings.js"> | 1328 // <include src="settings/scaling_settings.js"> |
| 1347 <include src="settings/other_options_settings.js"> | 1329 // <include src="settings/other_options_settings.js"> |
| 1348 <include src="settings/advanced_options_settings.js"> | 1330 // <include src="settings/advanced_options_settings.js"> |
| 1349 <include src="settings/advanced_settings/advanced_settings.js"> | 1331 // <include src="settings/advanced_settings/advanced_settings.js"> |
| 1350 <include src="settings/advanced_settings/advanced_settings_item.js"> | 1332 // <include src="settings/advanced_settings/advanced_settings_item.js"> |
| 1351 <include src="settings/more_settings.js"> | 1333 // <include src="settings/more_settings.js"> |
| 1352 | 1334 |
| 1353 <include src="previewarea/margin_control.js"> | 1335 // <include src="previewarea/margin_control.js"> |
| 1354 <include src="previewarea/margin_control_container.js"> | 1336 // <include src="previewarea/margin_control_container.js"> |
| 1355 <include src="../pdf/pdf_scripting_api.js"> | 1337 // <include src="../pdf/pdf_scripting_api.js"> |
| 1356 <include src="previewarea/preview_area.js"> | 1338 // <include src="previewarea/preview_area.js"> |
| 1357 <include src="preview_generator.js"> | 1339 // <include src="preview_generator.js"> |
| 1358 | 1340 |
| 1359 <include src="search/destination_list.js"> | 1341 // <include src="search/destination_list.js"> |
| 1360 <include src="search/cloud_destination_list.js"> | 1342 // <include src="search/cloud_destination_list.js"> |
| 1361 <include src="search/recent_destination_list.js"> | 1343 // <include src="search/recent_destination_list.js"> |
| 1362 <include src="search/destination_list_item.js"> | 1344 // <include src="search/destination_list_item.js"> |
| 1363 <include src="search/destination_search.js"> | 1345 // <include src="search/destination_search.js"> |
| 1364 <include src="search/fedex_tos.js"> | 1346 // <include src="search/fedex_tos.js"> |
| 1365 <include src="search/provisional_destination_resolver.js"> | 1347 // <include src="search/provisional_destination_resolver.js"> |
| 1366 | 1348 |
| 1367 window.addEventListener('DOMContentLoaded', function() { | 1349 window.addEventListener('DOMContentLoaded', function() { |
| 1368 printPreview = new print_preview.PrintPreview(); | 1350 printPreview = new print_preview.PrintPreview(); |
| 1369 printPreview.initialize(); | 1351 printPreview.initialize(); |
| 1370 }); | 1352 }); |
| OLD | NEW |