| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // require: cr/ui/print_preview_cloud.js | 5 // require: cr/ui/print_preview_cloud.js |
| 6 | 6 |
| 7 var localStrings = new LocalStrings(); | 7 var localStrings = new LocalStrings(); |
| 8 | 8 |
| 9 // If useCloudPrint is true we attempt to connect to cloud print | 9 // If useCloudPrint is true we attempt to connect to cloud print |
| 10 // and populate the list of printers with cloud print printers. | 10 // and populate the list of printers with cloud print printers. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Object holding all the pages related settings. | 45 // Object holding all the pages related settings. |
| 46 var pageSettings; | 46 var pageSettings; |
| 47 | 47 |
| 48 // Object holding all the copies related settings. | 48 // Object holding all the copies related settings. |
| 49 var copiesSettings; | 49 var copiesSettings; |
| 50 | 50 |
| 51 // Object holding all the layout related settings. | 51 // Object holding all the layout related settings. |
| 52 var layoutSettings; | 52 var layoutSettings; |
| 53 | 53 |
| 54 // Object holding all the header footer related settings. |
| 55 var headerFooterSettings; |
| 56 |
| 54 // Object holding all the color related settings. | 57 // Object holding all the color related settings. |
| 55 var colorSettings; | 58 var colorSettings; |
| 56 | 59 |
| 57 // True if the user has click 'Advanced...' in order to open the system print | 60 // True if the user has click 'Advanced...' in order to open the system print |
| 58 // dialog. | 61 // dialog. |
| 59 var showingSystemDialog = false; | 62 var showingSystemDialog = false; |
| 60 | 63 |
| 61 // The range of options in the printer dropdown controlled by cloud print. | 64 // The range of options in the printer dropdown controlled by cloud print. |
| 62 var firstCloudPrintOptionPos = 0; | 65 var firstCloudPrintOptionPos = 0; |
| 63 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; | 66 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 100 |
| 98 $('system-dialog-link').addEventListener('click', onSystemDialogLinkClicked); | 101 $('system-dialog-link').addEventListener('click', onSystemDialogLinkClicked); |
| 99 $('mainview').parentElement.removeChild($('dummy-viewer')); | 102 $('mainview').parentElement.removeChild($('dummy-viewer')); |
| 100 | 103 |
| 101 $('printer-list').disabled = true; | 104 $('printer-list').disabled = true; |
| 102 | 105 |
| 103 printHeader = print_preview.PrintHeader.getInstance(); | 106 printHeader = print_preview.PrintHeader.getInstance(); |
| 104 pageSettings = print_preview.PageSettings.getInstance(); | 107 pageSettings = print_preview.PageSettings.getInstance(); |
| 105 copiesSettings = print_preview.CopiesSettings.getInstance(); | 108 copiesSettings = print_preview.CopiesSettings.getInstance(); |
| 106 layoutSettings = print_preview.LayoutSettings.getInstance(); | 109 layoutSettings = print_preview.LayoutSettings.getInstance(); |
| 110 headerFooterSettings = print_preview.HeaderFooterSettings.getInstance(); |
| 107 colorSettings = print_preview.ColorSettings.getInstance(); | 111 colorSettings = print_preview.ColorSettings.getInstance(); |
| 108 printHeader.addEventListeners(); | 112 printHeader.addEventListeners(); |
| 109 pageSettings.addEventListeners(); | 113 pageSettings.addEventListeners(); |
| 110 copiesSettings.addEventListeners(); | 114 copiesSettings.addEventListeners(); |
| 115 headerFooterSettings.addEventListeners(); |
| 111 layoutSettings.addEventListeners(); | 116 layoutSettings.addEventListeners(); |
| 112 colorSettings.addEventListeners(); | 117 colorSettings.addEventListeners(); |
| 113 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; | 118 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; |
| 114 | 119 |
| 115 showLoadingAnimation(); | 120 showLoadingAnimation(); |
| 116 chrome.send('getDefaultPrinter'); | 121 chrome.send('getDefaultPrinter'); |
| 117 } | 122 } |
| 118 | 123 |
| 119 /** | 124 /** |
| 120 * Disables the input elements in the sidebar. | 125 * Disables the input elements in the sidebar. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 var settings = | 296 var settings = |
| 292 {'deviceName': deviceName, | 297 {'deviceName': deviceName, |
| 293 'pageRange': pageSettings.selectedPageRanges, | 298 'pageRange': pageSettings.selectedPageRanges, |
| 294 'duplex': copiesSettings.duplexMode, | 299 'duplex': copiesSettings.duplexMode, |
| 295 'copies': copiesSettings.numberOfCopies, | 300 'copies': copiesSettings.numberOfCopies, |
| 296 'collate': copiesSettings.isCollated(), | 301 'collate': copiesSettings.isCollated(), |
| 297 'landscape': layoutSettings.isLandscape(), | 302 'landscape': layoutSettings.isLandscape(), |
| 298 'color': colorSettings.isColor(), | 303 'color': colorSettings.isColor(), |
| 299 'printToPDF': printToPDF, | 304 'printToPDF': printToPDF, |
| 300 'isFirstRequest' : false, | 305 'isFirstRequest' : false, |
| 306 'headerFooterEnabled': headerFooterSettings.hasHeaderFooter(), |
| 301 'requestID': -1}; | 307 'requestID': -1}; |
| 302 | 308 |
| 303 var printerList = $('printer-list'); | 309 var printerList = $('printer-list'); |
| 304 var selectedPrinter = printerList.selectedIndex; | 310 var selectedPrinter = printerList.selectedIndex; |
| 305 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { | 311 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { |
| 306 settings['cloudPrintID'] = | 312 settings['cloudPrintID'] = |
| 307 printerList.options[selectedPrinter].value; | 313 printerList.options[selectedPrinter].value; |
| 308 } | 314 } |
| 309 return settings; | 315 return settings; |
| 310 } | 316 } |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 requestPrintPreview(); | 943 requestPrintPreview(); |
| 938 } | 944 } |
| 939 | 945 |
| 940 /// Pull in all other scripts in a single shot. | 946 /// Pull in all other scripts in a single shot. |
| 941 <include src="print_preview_animations.js"/> | 947 <include src="print_preview_animations.js"/> |
| 942 <include src="print_preview_cloud.js"/> | 948 <include src="print_preview_cloud.js"/> |
| 943 <include src="print_preview_utils.js"/> | 949 <include src="print_preview_utils.js"/> |
| 944 <include src="print_header.js"/> | 950 <include src="print_header.js"/> |
| 945 <include src="page_settings.js"/> | 951 <include src="page_settings.js"/> |
| 946 <include src="copies_settings.js"/> | 952 <include src="copies_settings.js"/> |
| 953 <include src="header_footer_settings.js"/> |
| 947 <include src="layout_settings.js"/> | 954 <include src="layout_settings.js"/> |
| 948 <include src="color_settings.js"/> | 955 <include src="color_settings.js"/> |
| OLD | NEW |