| 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() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 /** | 162 /** |
| 163 * Component that renders miscellaneous print options. | 163 * Component that renders miscellaneous print options. |
| 164 * @type {!print_preview.OtherOptionsSettings} | 164 * @type {!print_preview.OtherOptionsSettings} |
| 165 * @private | 165 * @private |
| 166 */ | 166 */ |
| 167 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings( | 167 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings( |
| 168 this.printTicketStore_.duplex, | 168 this.printTicketStore_.duplex, |
| 169 this.printTicketStore_.fitToPage, | 169 this.printTicketStore_.fitToPage, |
| 170 this.printTicketStore_.cssBackground, | 170 this.printTicketStore_.cssBackground, |
| 171 this.printTicketStore_.selectionOnly, | 171 this.printTicketStore_.selectionOnly, |
| 172 this.printTicketStore_.headerFooter); | 172 this.printTicketStore_.headerFooter, |
| 173 this.printTicketStore_.printFriendly); |
| 173 this.addChild(this.otherOptionsSettings_); | 174 this.addChild(this.otherOptionsSettings_); |
| 174 | 175 |
| 175 /** | 176 /** |
| 176 * Component that renders the advanced options button. | 177 * Component that renders the advanced options button. |
| 177 * @type {!print_preview.AdvancedOptionsSettings} | 178 * @type {!print_preview.AdvancedOptionsSettings} |
| 178 * @private | 179 * @private |
| 179 */ | 180 */ |
| 180 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( | 181 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( |
| 181 this.printTicketStore_.vendorItems, this.destinationStore_); | 182 this.printTicketStore_.vendorItems, this.destinationStore_); |
| 182 this.addChild(this.advancedOptionsSettings_); | 183 this.addChild(this.advancedOptionsSettings_); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, | 351 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, |
| 351 this.onPrintPresetOptionsFromDocument_.bind(this)); | 352 this.onPrintPresetOptionsFromDocument_.bind(this)); |
| 352 this.tracker.add( | 353 this.tracker.add( |
| 353 this.nativeLayer_, | 354 this.nativeLayer_, |
| 354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, | 355 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, |
| 355 this.onPrivetPrintFailed_.bind(this)); | 356 this.onPrivetPrintFailed_.bind(this)); |
| 356 this.tracker.add( | 357 this.tracker.add( |
| 357 this.nativeLayer_, | 358 this.nativeLayer_, |
| 358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 359 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
| 359 this.onManipulateSettingsForTest_.bind(this)); | 360 this.onManipulateSettingsForTest_.bind(this)); |
| 361 this.tracker.add( |
| 362 this.nativeLayer_, |
| 363 print_preview.NativeLayer.EventType.ALLOW_PRINT_FRIENDLY, |
| 364 this.onAllowPrintFriendly_.bind(this)); |
| 360 | 365 |
| 361 if ($('system-dialog-link')) { | 366 if ($('system-dialog-link')) { |
| 362 this.tracker.add( | 367 this.tracker.add( |
| 363 $('system-dialog-link'), | 368 $('system-dialog-link'), |
| 364 'click', | 369 'click', |
| 365 this.openSystemPrintDialog_.bind(this)); | 370 this.openSystemPrintDialog_.bind(this)); |
| 366 } | 371 } |
| 367 if ($('open-pdf-in-preview-link')) { | 372 if ($('open-pdf-in-preview-link')) { |
| 368 this.tracker.add( | 373 this.tracker.add( |
| 369 $('open-pdf-in-preview-link'), | 374 $('open-pdf-in-preview-link'), |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 settings.systemDefaultDestinationId); | 639 settings.systemDefaultDestinationId); |
| 635 this.documentInfo_.init( | 640 this.documentInfo_.init( |
| 636 settings.isDocumentModifiable, | 641 settings.isDocumentModifiable, |
| 637 settings.documentTitle, | 642 settings.documentTitle, |
| 638 settings.documentHasSelection); | 643 settings.documentHasSelection); |
| 639 this.printTicketStore_.init( | 644 this.printTicketStore_.init( |
| 640 settings.thousandsDelimeter, | 645 settings.thousandsDelimeter, |
| 641 settings.decimalDelimeter, | 646 settings.decimalDelimeter, |
| 642 settings.unitType, | 647 settings.unitType, |
| 643 settings.selectionOnly); | 648 settings.selectionOnly); |
| 649 |
| 644 this.destinationStore_.init(settings.isInAppKioskMode); | 650 this.destinationStore_.init(settings.isInAppKioskMode); |
| 645 this.appState_.setInitialized(); | 651 this.appState_.setInitialized(); |
| 646 | 652 |
| 647 $('document-title').innerText = settings.documentTitle; | 653 $('document-title').innerText = settings.documentTitle; |
| 648 this.hideSystemDialogLink_ = settings.hidePrintWithSystemDialogLink || | 654 this.hideSystemDialogLink_ = settings.hidePrintWithSystemDialogLink || |
| 649 settings.isInAppKioskMode; | 655 settings.isInAppKioskMode; |
| 650 if ($('system-dialog-link')) { | 656 if ($('system-dialog-link')) { |
| 651 setIsVisible($('system-dialog-link'), | 657 setIsVisible($('system-dialog-link'), |
| 652 this.shouldShowSystemDialogLink_()); | 658 this.shouldShowSystemDialogLink_()); |
| 653 } | 659 } |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 * @private | 1013 * @private |
| 1008 */ | 1014 */ |
| 1009 onPrivetPrintFailed_: function(event) { | 1015 onPrivetPrintFailed_: function(event) { |
| 1010 console.error('Privet printing failed with error code ' + | 1016 console.error('Privet printing failed with error code ' + |
| 1011 event.httpError); | 1017 event.httpError); |
| 1012 this.printHeader_.setErrorMessage( | 1018 this.printHeader_.setErrorMessage( |
| 1013 loadTimeData.getString('couldNotPrint')); | 1019 loadTimeData.getString('couldNotPrint')); |
| 1014 }, | 1020 }, |
| 1015 | 1021 |
| 1016 /** | 1022 /** |
| 1023 * Called when the native layer has detected that the "Print friendly" |
| 1024 * option should be allowed. |
| 1025 * @private |
| 1026 */ |
| 1027 onAllowPrintFriendly_: function(event) { |
| 1028 this.printTicketStore_.printFriendly.setIsCapabilityAvailable(true); |
| 1029 }, |
| 1030 |
| 1031 /** |
| 1017 * Called when the print preview settings need to be changed for testing. | 1032 * Called when the print preview settings need to be changed for testing. |
| 1018 * @param {Event} event Event object that contains the option that is to | 1033 * @param {Event} event Event object that contains the option that is to |
| 1019 * be changed and what to set that option. | 1034 * be changed and what to set that option. |
| 1020 * @private | 1035 * @private |
| 1021 */ | 1036 */ |
| 1022 onManipulateSettingsForTest_: function(event) { | 1037 onManipulateSettingsForTest_: function(event) { |
| 1023 var settings = | 1038 var settings = |
| 1024 /** @type {print_preview.PreviewSettings} */(event.settings); | 1039 /** @type {print_preview.PreviewSettings} */(event.settings); |
| 1025 if ('selectSaveAsPdfDestination' in settings) { | 1040 if ('selectSaveAsPdfDestination' in settings) { |
| 1026 this.saveAsPdfForTest_(); // No parameters. | 1041 this.saveAsPdfForTest_(); // No parameters. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 | 1278 |
| 1264 <include src="data/ticket_items/ticket_item.js"> | 1279 <include src="data/ticket_items/ticket_item.js"> |
| 1265 | 1280 |
| 1266 <include src="data/ticket_items/custom_margins.js"> | 1281 <include src="data/ticket_items/custom_margins.js"> |
| 1267 <include src="data/ticket_items/collate.js"> | 1282 <include src="data/ticket_items/collate.js"> |
| 1268 <include src="data/ticket_items/color.js"> | 1283 <include src="data/ticket_items/color.js"> |
| 1269 <include src="data/ticket_items/copies.js"> | 1284 <include src="data/ticket_items/copies.js"> |
| 1270 <include src="data/ticket_items/dpi.js"> | 1285 <include src="data/ticket_items/dpi.js"> |
| 1271 <include src="data/ticket_items/duplex.js"> | 1286 <include src="data/ticket_items/duplex.js"> |
| 1272 <include src="data/ticket_items/header_footer.js"> | 1287 <include src="data/ticket_items/header_footer.js"> |
| 1288 <include src="data/ticket_items/print_friendly.js"> |
| 1273 <include src="data/ticket_items/media_size.js"> | 1289 <include src="data/ticket_items/media_size.js"> |
| 1274 <include src="data/ticket_items/landscape.js"> | 1290 <include src="data/ticket_items/landscape.js"> |
| 1275 <include src="data/ticket_items/margins_type.js"> | 1291 <include src="data/ticket_items/margins_type.js"> |
| 1276 <include src="data/ticket_items/page_range.js"> | 1292 <include src="data/ticket_items/page_range.js"> |
| 1277 <include src="data/ticket_items/fit_to_page.js"> | 1293 <include src="data/ticket_items/fit_to_page.js"> |
| 1278 <include src="data/ticket_items/css_background.js"> | 1294 <include src="data/ticket_items/css_background.js"> |
| 1279 <include src="data/ticket_items/selection_only.js"> | 1295 <include src="data/ticket_items/selection_only.js"> |
| 1280 <include src="data/ticket_items/vendor_items.js"> | 1296 <include src="data/ticket_items/vendor_items.js"> |
| 1281 | 1297 |
| 1282 <include src="native_layer.js"> | 1298 <include src="native_layer.js"> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1313 <include src="search/recent_destination_list.js"> | 1329 <include src="search/recent_destination_list.js"> |
| 1314 <include src="search/destination_list_item.js"> | 1330 <include src="search/destination_list_item.js"> |
| 1315 <include src="search/destination_search.js"> | 1331 <include src="search/destination_search.js"> |
| 1316 <include src="search/fedex_tos.js"> | 1332 <include src="search/fedex_tos.js"> |
| 1317 <include src="search/provisional_destination_resolver.js"> | 1333 <include src="search/provisional_destination_resolver.js"> |
| 1318 | 1334 |
| 1319 window.addEventListener('DOMContentLoaded', function() { | 1335 window.addEventListener('DOMContentLoaded', function() { |
| 1320 printPreview = new print_preview.PrintPreview(); | 1336 printPreview = new print_preview.PrintPreview(); |
| 1321 printPreview.initialize(); | 1337 printPreview.initialize(); |
| 1322 }); | 1338 }); |
| OLD | NEW |