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_.distillPage); | |
174 this.addChild(this.otherOptionsSettings_); | 173 this.addChild(this.otherOptionsSettings_); |
175 | 174 |
176 /** | 175 /** |
177 * Component that renders the advanced options button. | 176 * Component that renders the advanced options button. |
178 * @type {!print_preview.AdvancedOptionsSettings} | 177 * @type {!print_preview.AdvancedOptionsSettings} |
179 * @private | 178 * @private |
180 */ | 179 */ |
181 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( | 180 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( |
182 this.printTicketStore_.vendorItems, this.destinationStore_); | 181 this.printTicketStore_.vendorItems, this.destinationStore_); |
183 this.addChild(this.advancedOptionsSettings_); | 182 this.addChild(this.advancedOptionsSettings_); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, | 350 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, |
352 this.onPrintPresetOptionsFromDocument_.bind(this)); | 351 this.onPrintPresetOptionsFromDocument_.bind(this)); |
353 this.tracker.add( | 352 this.tracker.add( |
354 this.nativeLayer_, | 353 this.nativeLayer_, |
355 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, | 354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, |
356 this.onPrivetPrintFailed_.bind(this)); | 355 this.onPrivetPrintFailed_.bind(this)); |
357 this.tracker.add( | 356 this.tracker.add( |
358 this.nativeLayer_, | 357 this.nativeLayer_, |
359 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, | 358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, |
360 this.onManipulateSettingsForTest_.bind(this)); | 359 this.onManipulateSettingsForTest_.bind(this)); |
361 this.tracker.add( | |
362 this.nativeLayer_, | |
363 print_preview.NativeLayer.EventType.ALLOW_DISTILL_PAGE, | |
364 this.onAllowDistillPage_.bind(this)); | |
365 | 360 |
366 if ($('system-dialog-link')) { | 361 if ($('system-dialog-link')) { |
367 this.tracker.add( | 362 this.tracker.add( |
368 $('system-dialog-link'), | 363 $('system-dialog-link'), |
369 'click', | 364 'click', |
370 this.openSystemPrintDialog_.bind(this)); | 365 this.openSystemPrintDialog_.bind(this)); |
371 } | 366 } |
372 if ($('open-pdf-in-preview-link')) { | 367 if ($('open-pdf-in-preview-link')) { |
373 this.tracker.add( | 368 this.tracker.add( |
374 $('open-pdf-in-preview-link'), | 369 $('open-pdf-in-preview-link'), |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 * @private | 1005 * @private |
1011 */ | 1006 */ |
1012 onPrivetPrintFailed_: function(event) { | 1007 onPrivetPrintFailed_: function(event) { |
1013 console.error('Privet printing failed with error code ' + | 1008 console.error('Privet printing failed with error code ' + |
1014 event.httpError); | 1009 event.httpError); |
1015 this.printHeader_.setErrorMessage( | 1010 this.printHeader_.setErrorMessage( |
1016 loadTimeData.getString('couldNotPrint')); | 1011 loadTimeData.getString('couldNotPrint')); |
1017 }, | 1012 }, |
1018 | 1013 |
1019 /** | 1014 /** |
1020 * Called when the native layer has detected that the "Distill page" | |
1021 * option should be allowed. | |
1022 * @private | |
1023 */ | |
1024 onAllowDistillPage_: function(event) { | |
1025 this.printTicketStore_.distillPage.setIsCapabilityAvailable(true); | |
1026 }, | |
1027 | |
1028 /** | |
1029 * Called when the print preview settings need to be changed for testing. | 1015 * Called when the print preview settings need to be changed for testing. |
1030 * @param {Event} event Event object that contains the option that is to | 1016 * @param {Event} event Event object that contains the option that is to |
1031 * be changed and what to set that option. | 1017 * be changed and what to set that option. |
1032 * @private | 1018 * @private |
1033 */ | 1019 */ |
1034 onManipulateSettingsForTest_: function(event) { | 1020 onManipulateSettingsForTest_: function(event) { |
1035 var settings = | 1021 var settings = |
1036 /** @type {print_preview.PreviewSettings} */(event.settings); | 1022 /** @type {print_preview.PreviewSettings} */(event.settings); |
1037 if ('selectSaveAsPdfDestination' in settings) { | 1023 if ('selectSaveAsPdfDestination' in settings) { |
1038 this.saveAsPdfForTest_(); // No parameters. | 1024 this.saveAsPdfForTest_(); // No parameters. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 | 1261 |
1276 <include src="data/ticket_items/ticket_item.js"> | 1262 <include src="data/ticket_items/ticket_item.js"> |
1277 | 1263 |
1278 <include src="data/ticket_items/custom_margins.js"> | 1264 <include src="data/ticket_items/custom_margins.js"> |
1279 <include src="data/ticket_items/collate.js"> | 1265 <include src="data/ticket_items/collate.js"> |
1280 <include src="data/ticket_items/color.js"> | 1266 <include src="data/ticket_items/color.js"> |
1281 <include src="data/ticket_items/copies.js"> | 1267 <include src="data/ticket_items/copies.js"> |
1282 <include src="data/ticket_items/dpi.js"> | 1268 <include src="data/ticket_items/dpi.js"> |
1283 <include src="data/ticket_items/duplex.js"> | 1269 <include src="data/ticket_items/duplex.js"> |
1284 <include src="data/ticket_items/header_footer.js"> | 1270 <include src="data/ticket_items/header_footer.js"> |
1285 <include src="data/ticket_items/distill_page.js"> | |
1286 <include src="data/ticket_items/media_size.js"> | 1271 <include src="data/ticket_items/media_size.js"> |
1287 <include src="data/ticket_items/landscape.js"> | 1272 <include src="data/ticket_items/landscape.js"> |
1288 <include src="data/ticket_items/margins_type.js"> | 1273 <include src="data/ticket_items/margins_type.js"> |
1289 <include src="data/ticket_items/page_range.js"> | 1274 <include src="data/ticket_items/page_range.js"> |
1290 <include src="data/ticket_items/fit_to_page.js"> | 1275 <include src="data/ticket_items/fit_to_page.js"> |
1291 <include src="data/ticket_items/css_background.js"> | 1276 <include src="data/ticket_items/css_background.js"> |
1292 <include src="data/ticket_items/selection_only.js"> | 1277 <include src="data/ticket_items/selection_only.js"> |
1293 <include src="data/ticket_items/vendor_items.js"> | 1278 <include src="data/ticket_items/vendor_items.js"> |
1294 | 1279 |
1295 <include src="native_layer.js"> | 1280 <include src="native_layer.js"> |
(...skipping 30 matching lines...) Expand all Loading... |
1326 <include src="search/recent_destination_list.js"> | 1311 <include src="search/recent_destination_list.js"> |
1327 <include src="search/destination_list_item.js"> | 1312 <include src="search/destination_list_item.js"> |
1328 <include src="search/destination_search.js"> | 1313 <include src="search/destination_search.js"> |
1329 <include src="search/fedex_tos.js"> | 1314 <include src="search/fedex_tos.js"> |
1330 <include src="search/provisional_destination_resolver.js"> | 1315 <include src="search/provisional_destination_resolver.js"> |
1331 | 1316 |
1332 window.addEventListener('DOMContentLoaded', function() { | 1317 window.addEventListener('DOMContentLoaded', function() { |
1333 printPreview = new print_preview.PrintPreview(); | 1318 printPreview = new print_preview.PrintPreview(); |
1334 printPreview.initialize(); | 1319 printPreview.initialize(); |
1335 }); | 1320 }); |
OLD | NEW |