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 cr.define('print_preview', function() { | 10 cr.define('print_preview', function() { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 this.tracker.add( | 340 this.tracker.add( |
| 341 this.nativeLayer_, | 341 this.nativeLayer_, |
| 342 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, | 342 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, |
| 343 this.onFileSelectionComplete_.bind(this)); | 343 this.onFileSelectionComplete_.bind(this)); |
| 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.PRINT_PRESET_OPTIONS, |
| 351 this.onDisableScaling_.bind(this)); | 351 this.onPrintPresetOptionsFromDocument_.bind(this)); |
| 352 this.tracker.add( | 352 this.tracker.add( |
| 353 this.nativeLayer_, | 353 this.nativeLayer_, |
| 354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, | 354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, |
| 355 this.onPrivetPrintFailed_.bind(this)); | 355 this.onPrivetPrintFailed_.bind(this)); |
| 356 this.tracker.add( | 356 this.tracker.add( |
| 357 this.nativeLayer_, | 357 this.nativeLayer_, |
| 358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
| 359 this.onManipulateSettingsForTest_.bind(this)); | 359 this.onManipulateSettingsForTest_.bind(this)); |
| 360 | 360 |
| 361 if ($('system-dialog-link')) { | 361 if ($('system-dialog-link')) { |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 * corresponding native layer event. | 972 * corresponding native layer event. |
| 973 * @param {boolean} addAccount Whether to open an 'add a new account' or | 973 * @param {boolean} addAccount Whether to open an 'add a new account' or |
| 974 * default sign in page. | 974 * default sign in page. |
| 975 * @private | 975 * @private |
| 976 */ | 976 */ |
| 977 onCloudPrintSignInActivated_: function(addAccount) { | 977 onCloudPrintSignInActivated_: function(addAccount) { |
| 978 this.nativeLayer_.startCloudPrintSignIn(addAccount); | 978 this.nativeLayer_.startCloudPrintSignIn(addAccount); |
| 979 }, | 979 }, |
| 980 | 980 |
| 981 /** | 981 /** |
| 982 * Called when the native layer dispatches a DISABLE_SCALING event. Resets | 982 * Updates printing options according to source document presets. |
| 983 * fit-to-page selection and updates document info. | 983 * @param {Event} event Contains options from source document. |
| 984 * @private | 984 * @private |
| 985 */ | 985 */ |
| 986 onDisableScaling_: function() { | 986 onPrintPresetOptionsFromDocument_: function(event) { |
| 987 this.printTicketStore_.fitToPage.updateValue(null); | 987 if (event.optionsFromDocument.disableScaling) { |
| 988 this.documentInfo_.updateIsScalingDisabled(true); | 988 // Reset fit-to-page selection and update document info. |
|
Aleksey Shlyapnikov
2014/11/24 19:47:58
Remove this comment, it states the obvious now.
Nikhil
2014/11/25 06:36:13
Done.
| |
| 989 this.printTicketStore_.fitToPage.updateValue(null); | |
| 990 this.documentInfo_.updateIsScalingDisabled(true); | |
| 991 } | |
| 992 | |
| 993 if (event.optionsFromDocument.copies > 0 && | |
| 994 this.printTicketStore_.copies.isCapabilityAvailable()) { | |
| 995 this.printTicketStore_.copies.updateValue( | |
| 996 event.optionsFromDocument.copies); | |
| 997 } | |
| 989 }, | 998 }, |
| 990 | 999 |
| 991 /** | 1000 /** |
| 992 * Called when privet printing fails. | 1001 * Called when privet printing fails. |
| 993 * @param {Event} event Event object representing the failure. | 1002 * @param {Event} event Event object representing the failure. |
| 994 * @private | 1003 * @private |
| 995 */ | 1004 */ |
| 996 onPrivetPrintFailed_: function(event) { | 1005 onPrivetPrintFailed_: function(event) { |
| 997 console.error('Privet printing failed with error code ' + | 1006 console.error('Privet printing failed with error code ' + |
| 998 event.httpError); | 1007 event.httpError); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1299 <include src="search/cloud_destination_list.js"> | 1308 <include src="search/cloud_destination_list.js"> |
| 1300 <include src="search/recent_destination_list.js"> | 1309 <include src="search/recent_destination_list.js"> |
| 1301 <include src="search/destination_list_item.js"> | 1310 <include src="search/destination_list_item.js"> |
| 1302 <include src="search/destination_search.js"> | 1311 <include src="search/destination_search.js"> |
| 1303 <include src="search/fedex_tos.js"> | 1312 <include src="search/fedex_tos.js"> |
| 1304 | 1313 |
| 1305 window.addEventListener('DOMContentLoaded', function() { | 1314 window.addEventListener('DOMContentLoaded', function() { |
| 1306 printPreview = new print_preview.PrintPreview(); | 1315 printPreview = new print_preview.PrintPreview(); |
| 1307 printPreview.initialize(); | 1316 printPreview.initialize(); |
| 1308 }); | 1317 }); |
| OLD | NEW |