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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 this.listenerTracker.add( | 343 this.listenerTracker.add( |
| 344 'use-cloud-print', this.onCloudPrintEnable_.bind(this)); | 344 'use-cloud-print', this.onCloudPrintEnable_.bind(this)); |
| 345 }, | 345 }, |
| 346 | 346 |
| 347 /** @override */ | 347 /** @override */ |
| 348 enterDocument: function() { | 348 enterDocument: function() { |
| 349 // Native layer events. | 349 // Native layer events. |
| 350 var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); | 350 var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); |
| 351 this.tracker.add( | 351 this.tracker.add( |
| 352 nativeLayerEventTarget, | 352 nativeLayerEventTarget, |
| 353 print_preview.NativeLayer.EventType.SETTINGS_INVALID, | |
| 354 this.onSettingsInvalid_.bind(this)); | |
| 355 this.tracker.add( | |
| 356 nativeLayerEventTarget, | |
| 357 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, | 353 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, |
| 358 this.onPrintPresetOptionsFromDocument_.bind(this)); | 354 this.onPrintPresetOptionsFromDocument_.bind(this)); |
| 359 this.tracker.add( | 355 this.tracker.add( |
| 360 nativeLayerEventTarget, | 356 nativeLayerEventTarget, |
| 361 print_preview.NativeLayer.EventType.PAGE_COUNT_READY, | 357 print_preview.NativeLayer.EventType.PAGE_COUNT_READY, |
| 362 this.onPageCountReady_.bind(this)); | 358 this.onPageCountReady_.bind(this)); |
| 363 this.tracker.add( | 359 this.tracker.add( |
| 364 nativeLayerEventTarget, | 360 nativeLayerEventTarget, |
| 365 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 361 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
| 366 this.onManipulateSettingsForTest_.bind(this)); | 362 this.onManipulateSettingsForTest_.bind(this)); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 385 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE, | 381 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE, |
| 386 this.onPreviewGenerationDone_.bind(this)); | 382 this.onPreviewGenerationDone_.bind(this)); |
| 387 this.tracker.add( | 383 this.tracker.add( |
| 388 this.previewArea_, | 384 this.previewArea_, |
| 389 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, | 385 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_FAIL, |
| 390 this.onPreviewGenerationFail_.bind(this)); | 386 this.onPreviewGenerationFail_.bind(this)); |
| 391 this.tracker.add( | 387 this.tracker.add( |
| 392 this.previewArea_, | 388 this.previewArea_, |
| 393 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, | 389 print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, |
| 394 this.openSystemPrintDialog_.bind(this)); | 390 this.openSystemPrintDialog_.bind(this)); |
| 391 this.tracker.add( | |
| 392 this.previewArea_, | |
| 393 print_preview.PreviewArea.EventType.SETTINGS_INVALID, | |
| 394 this.onSettingsInvalid_.bind(this)); | |
| 395 | 395 |
| 396 this.tracker.add( | 396 this.tracker.add( |
| 397 this.destinationStore_, | 397 this.destinationStore_, |
| 398 print_preview.DestinationStore.EventType | 398 print_preview.DestinationStore.EventType |
| 399 .SELECTED_DESTINATION_CAPABILITIES_READY, | 399 .SELECTED_DESTINATION_CAPABILITIES_READY, |
| 400 this.printIfReady_.bind(this)); | 400 this.printIfReady_.bind(this)); |
| 401 this.tracker.add( | 401 this.tracker.add( |
| 402 this.destinationStore_, | 402 this.destinationStore_, |
| 403 print_preview.DestinationStore.EventType.DESTINATION_SELECT, | 403 print_preview.DestinationStore.EventType.DESTINATION_SELECT, |
| 404 this.onDestinationSelect_.bind(this)); | 404 this.onDestinationSelect_.bind(this)); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 }, | 948 }, |
| 949 | 949 |
| 950 /** | 950 /** |
| 951 * Called when native layer receives invalid settings for a print request. | 951 * Called when native layer receives invalid settings for a print request. |
| 952 * @private | 952 * @private |
| 953 */ | 953 */ |
| 954 onSettingsInvalid_: function() { | 954 onSettingsInvalid_: function() { |
| 955 this.uiState_ = PrintPreviewUiState_.ERROR; | 955 this.uiState_ = PrintPreviewUiState_.ERROR; |
| 956 this.isPreviewGenerationInProgress_ = false; | 956 this.isPreviewGenerationInProgress_ = false; |
| 957 this.printHeader_.isPrintButtonEnabled = false; | 957 this.printHeader_.isPrintButtonEnabled = false; |
| 958 this.previewArea_.cancelTimeout(); | 958 this.previewArea_.cancelTimeout(); |
|
dpapad
2017/06/30 18:58:39
This line and the next are now already happening w
rbpotter
2017/06/30 19:45:22
Done.
| |
| 959 this.previewArea_.showCustomMessage( | 959 this.previewArea_.showCustomMessage( |
| 960 loadTimeData.getString('invalidPrinterSettings')); | 960 loadTimeData.getString('invalidPrinterSettings')); |
| 961 }, | 961 }, |
| 962 | 962 |
| 963 /** | 963 /** |
| 964 * Called when the destination settings' change button is activated. | 964 * Called when the destination settings' change button is activated. |
| 965 * Displays the destination search component. | 965 * Displays the destination search component. |
| 966 * @private | 966 * @private |
| 967 */ | 967 */ |
| 968 onDestinationChangeButtonActivate_: function() { | 968 onDestinationChangeButtonActivate_: function() { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 // <include src="search/destination_search.js"> | 1363 // <include src="search/destination_search.js"> |
| 1364 // <include src="search/provisional_destination_resolver.js"> | 1364 // <include src="search/provisional_destination_resolver.js"> |
| 1365 | 1365 |
| 1366 window.addEventListener('DOMContentLoaded', function() { | 1366 window.addEventListener('DOMContentLoaded', function() { |
| 1367 var previewWindow = /** @type {{isTest: boolean}} */ (window); | 1367 var previewWindow = /** @type {{isTest: boolean}} */ (window); |
| 1368 if (!previewWindow.isTest) { | 1368 if (!previewWindow.isTest) { |
| 1369 var printPreview = new print_preview.PrintPreview(); | 1369 var printPreview = new print_preview.PrintPreview(); |
| 1370 printPreview.initialize(); | 1370 printPreview.initialize(); |
| 1371 } | 1371 } |
| 1372 }); | 1372 }); |
| OLD | NEW |