Chromium Code Reviews| 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 | 10 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 cr.ui.FocusOutlineManager.forDocument(document); | 333 cr.ui.FocusOutlineManager.forDocument(document); |
| 334 this.listenerTracker.add('print-failed', this.onPrintFailed_.bind(this)); | 334 this.listenerTracker.add('print-failed', this.onPrintFailed_.bind(this)); |
| 335 this.listenerTracker.add( | 335 this.listenerTracker.add( |
| 336 'privet-printer-added', | 336 'privet-printer-added', |
| 337 this.destinationStore_.onPrivetPrinterAdded_.bind( | 337 this.destinationStore_.onPrivetPrinterAdded_.bind( |
| 338 this.destinationStore_)); | 338 this.destinationStore_)); |
| 339 this.listenerTracker.add( | 339 this.listenerTracker.add( |
| 340 'extension-printers-added', | 340 'extension-printers-added', |
| 341 this.destinationStore_.onExtensionPrintersAdded_.bind( | 341 this.destinationStore_.onExtensionPrintersAdded_.bind( |
| 342 this.destinationStore_)); | 342 this.destinationStore_)); |
| 343 this.listenerTracker.add( | |
| 344 'use-cloud-print', this.onCloudPrintEnable_.bind(this)); | |
| 343 }, | 345 }, |
| 344 | 346 |
| 345 /** @override */ | 347 /** @override */ |
| 346 enterDocument: function() { | 348 enterDocument: function() { |
| 347 // Native layer events. | 349 // Native layer events. |
| 348 var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); | 350 var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); |
| 349 this.tracker.add( | 351 this.tracker.add( |
| 350 nativeLayerEventTarget, | 352 nativeLayerEventTarget, |
| 351 print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE, | |
| 352 this.onCloudPrintEnable_.bind(this)); | |
| 353 this.tracker.add( | |
| 354 nativeLayerEventTarget, | |
| 355 print_preview.NativeLayer.EventType.SETTINGS_INVALID, | 353 print_preview.NativeLayer.EventType.SETTINGS_INVALID, |
| 356 this.onSettingsInvalid_.bind(this)); | 354 this.onSettingsInvalid_.bind(this)); |
| 357 this.tracker.add( | 355 this.tracker.add( |
| 358 nativeLayerEventTarget, | 356 nativeLayerEventTarget, |
| 359 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, | 357 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, |
| 360 this.onPrintPresetOptionsFromDocument_.bind(this)); | 358 this.onPrintPresetOptionsFromDocument_.bind(this)); |
| 361 this.tracker.add( | 359 this.tracker.add( |
| 362 nativeLayerEventTarget, | 360 nativeLayerEventTarget, |
| 363 print_preview.NativeLayer.EventType.PAGE_COUNT_READY, | 361 print_preview.NativeLayer.EventType.PAGE_COUNT_READY, |
| 364 this.onPageCountReady_.bind(this)); | 362 this.onPageCountReady_.bind(this)); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 $('document-title').innerText = settings.documentTitle; | 679 $('document-title').innerText = settings.documentTitle; |
| 682 this.hideSystemDialogLink_ = settings.isInAppKioskMode; | 680 this.hideSystemDialogLink_ = settings.isInAppKioskMode; |
| 683 if ($('system-dialog-link')) { | 681 if ($('system-dialog-link')) { |
| 684 setIsVisible( | 682 setIsVisible( |
| 685 getRequiredElement('system-dialog-link'), | 683 getRequiredElement('system-dialog-link'), |
| 686 this.shouldShowSystemDialogLink_()); | 684 this.shouldShowSystemDialogLink_()); |
| 687 } | 685 } |
| 688 }, | 686 }, |
| 689 | 687 |
| 690 /** | 688 /** |
| 691 * Calls when the native layer enables Google Cloud Print integration. | 689 * Called when Google Cloud Print integration is enabled by the |
| 690 * PrintPreviewHandler. | |
| 692 * Fetches the user's cloud printers. | 691 * Fetches the user's cloud printers. |
| 693 * @param {Event} event Contains the base URL of the Google Cloud Print | 692 * @param {string} cloudPrintUrl The URL to use for cloud print servers. |
| 694 * service. | 693 * @param {boolean} appKioskMode Whether to print automatically for kiosk |
| 694 * mode. | |
| 695 * @private | 695 * @private |
| 696 */ | 696 */ |
| 697 onCloudPrintEnable_: function(event) { | 697 onCloudPrintEnable_: function(cloudPrintUrl, appKioskMode) { |
| 698 this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface( | 698 this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface( |
| 699 event.baseCloudPrintUrl, this.nativeLayer_, this.userInfo_, | 699 cloudPrintUrl, this.nativeLayer_, this.userInfo_, appKioskMode); |
|
rbpotter
2017/06/27 22:30:30
Note: there is now no reason cloudPrintUrl or appK
| |
| 700 event.appKioskMode); | |
| 701 this.tracker.add( | 700 this.tracker.add( |
| 702 this.cloudPrintInterface_, | 701 this.cloudPrintInterface_, |
| 703 cloudprint.CloudPrintInterfaceEventType.SUBMIT_DONE, | 702 cloudprint.CloudPrintInterfaceEventType.SUBMIT_DONE, |
| 704 this.onCloudPrintSubmitDone_.bind(this)); | 703 this.onCloudPrintSubmitDone_.bind(this)); |
| 705 this.tracker.add( | 704 this.tracker.add( |
| 706 this.cloudPrintInterface_, | 705 this.cloudPrintInterface_, |
| 707 cloudprint.CloudPrintInterfaceEventType.SEARCH_FAILED, | 706 cloudprint.CloudPrintInterfaceEventType.SEARCH_FAILED, |
| 708 this.onCloudPrintError_.bind(this)); | 707 this.onCloudPrintError_.bind(this)); |
| 709 this.tracker.add( | 708 this.tracker.add( |
| 710 this.cloudPrintInterface_, | 709 this.cloudPrintInterface_, |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 // <include src="search/destination_search.js"> | 1362 // <include src="search/destination_search.js"> |
| 1364 // <include src="search/provisional_destination_resolver.js"> | 1363 // <include src="search/provisional_destination_resolver.js"> |
| 1365 | 1364 |
| 1366 window.addEventListener('DOMContentLoaded', function() { | 1365 window.addEventListener('DOMContentLoaded', function() { |
| 1367 var previewWindow = /** @type {{isTest: boolean}} */ (window); | 1366 var previewWindow = /** @type {{isTest: boolean}} */ (window); |
| 1368 if (!previewWindow.isTest) { | 1367 if (!previewWindow.isTest) { |
| 1369 var printPreview = new print_preview.PrintPreview(); | 1368 var printPreview = new print_preview.PrintPreview(); |
| 1370 printPreview.initialize(); | 1369 printPreview.initialize(); |
| 1371 } | 1370 } |
| 1372 }); | 1371 }); |
| OLD | NEW |