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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 this.tracker.add( | 344 this.tracker.add( |
345 this.nativeLayer_, | 345 this.nativeLayer_, |
346 print_preview.NativeLayer.EventType.SETTINGS_INVALID, | 346 print_preview.NativeLayer.EventType.SETTINGS_INVALID, |
347 this.onSettingsInvalid_.bind(this)); | 347 this.onSettingsInvalid_.bind(this)); |
348 this.tracker.add( | 348 this.tracker.add( |
349 this.nativeLayer_, | 349 this.nativeLayer_, |
350 print_preview.NativeLayer.EventType.DISABLE_SCALING, | 350 print_preview.NativeLayer.EventType.DISABLE_SCALING, |
351 this.onDisableScaling_.bind(this)); | 351 this.onDisableScaling_.bind(this)); |
352 this.tracker.add( | 352 this.tracker.add( |
353 this.nativeLayer_, | 353 this.nativeLayer_, |
354 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, | |
355 this.onPrintPresetOptionsFromDocument_.bind(this)); | |
356 this.tracker.add( | |
357 this.nativeLayer_, | |
354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, | 358 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, |
355 this.onPrivetPrintFailed_.bind(this)); | 359 this.onPrivetPrintFailed_.bind(this)); |
356 this.tracker.add( | 360 this.tracker.add( |
357 this.nativeLayer_, | 361 this.nativeLayer_, |
358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 362 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
359 this.onManipulateSettingsForTest_.bind(this)); | 363 this.onManipulateSettingsForTest_.bind(this)); |
360 | 364 |
361 if ($('system-dialog-link')) { | 365 if ($('system-dialog-link')) { |
362 this.tracker.add( | 366 this.tracker.add( |
363 $('system-dialog-link'), | 367 $('system-dialog-link'), |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 * Called when the native layer dispatches a DISABLE_SCALING event. Resets | 986 * Called when the native layer dispatches a DISABLE_SCALING event. Resets |
983 * fit-to-page selection and updates document info. | 987 * fit-to-page selection and updates document info. |
984 * @private | 988 * @private |
985 */ | 989 */ |
986 onDisableScaling_: function() { | 990 onDisableScaling_: function() { |
987 this.printTicketStore_.fitToPage.updateValue(null); | 991 this.printTicketStore_.fitToPage.updateValue(null); |
988 this.documentInfo_.updateIsScalingDisabled(true); | 992 this.documentInfo_.updateIsScalingDisabled(true); |
989 }, | 993 }, |
990 | 994 |
991 /** | 995 /** |
996 * Called when the native layer dispatches a PRINT_PRESET_OPTIONS event. It | |
997 * updates the print preset options from source document. | |
998 * @param {event} event Contains options from source document. | |
999 * @private | |
1000 */ | |
1001 onPrintPresetOptionsFromDocument_: function(event) { | |
1002 if (event.optionsFromDocument.fitToPageEnabled) { | |
1003 this.printTicketStore_.fitToPage.updateValue(null); | |
1004 this.documentInfo_.updateIsScalingDisabled(true); | |
1005 } | |
1006 | |
1007 if (event.optionsFromDocument.copies) { | |
Aleksey Shlyapnikov
2014/11/20 18:56:56
Check this.printTicketStore_.copies.isCapabilityAv
Nikhil
2014/11/21 10:45:32
NumCopies property spec doesn't say anything speci
Aleksey Shlyapnikov
2014/11/21 22:50:41
I agree and that's why I suggested to add this.pri
| |
1008 this.printTicketStore_.copies.updateValue( | |
1009 event.optionsFromDocument.copies); | |
Aleksey Shlyapnikov
2014/11/20 18:56:56
Two more spaces indent.
Nikhil
2014/11/21 10:45:32
Done.
| |
1010 } | |
1011 }, | |
1012 | |
1013 /** | |
992 * Called when privet printing fails. | 1014 * Called when privet printing fails. |
993 * @param {Event} event Event object representing the failure. | 1015 * @param {Event} event Event object representing the failure. |
994 * @private | 1016 * @private |
995 */ | 1017 */ |
996 onPrivetPrintFailed_: function(event) { | 1018 onPrivetPrintFailed_: function(event) { |
997 console.error('Privet printing failed with error code ' + | 1019 console.error('Privet printing failed with error code ' + |
998 event.httpError); | 1020 event.httpError); |
999 this.printHeader_.setErrorMessage( | 1021 this.printHeader_.setErrorMessage( |
1000 loadTimeData.getString('couldNotPrint')); | 1022 loadTimeData.getString('couldNotPrint')); |
1001 }, | 1023 }, |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 <include src="search/cloud_destination_list.js"> | 1321 <include src="search/cloud_destination_list.js"> |
1300 <include src="search/recent_destination_list.js"> | 1322 <include src="search/recent_destination_list.js"> |
1301 <include src="search/destination_list_item.js"> | 1323 <include src="search/destination_list_item.js"> |
1302 <include src="search/destination_search.js"> | 1324 <include src="search/destination_search.js"> |
1303 <include src="search/fedex_tos.js"> | 1325 <include src="search/fedex_tos.js"> |
1304 | 1326 |
1305 window.addEventListener('DOMContentLoaded', function() { | 1327 window.addEventListener('DOMContentLoaded', function() { |
1306 printPreview = new print_preview.PrintPreview(); | 1328 printPreview = new print_preview.PrintPreview(); |
1307 printPreview.initialize(); | 1329 printPreview.initialize(); |
1308 }); | 1330 }); |
OLD | NEW |