| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 var settings = | 309 var settings = |
| 305 {'deviceName': deviceName, | 310 {'deviceName': deviceName, |
| 306 'pageRange': pageSettings.selectedPageRanges, | 311 'pageRange': pageSettings.selectedPageRanges, |
| 307 'duplex': copiesSettings.duplexMode, | 312 'duplex': copiesSettings.duplexMode, |
| 308 'copies': copiesSettings.numberOfCopies, | 313 'copies': copiesSettings.numberOfCopies, |
| 309 'collate': copiesSettings.isCollated(), | 314 'collate': copiesSettings.isCollated(), |
| 310 'landscape': layoutSettings.isLandscape(), | 315 'landscape': layoutSettings.isLandscape(), |
| 311 'color': colorSettings.isColor(), | 316 'color': colorSettings.isColor(), |
| 312 'printToPDF': printToPDF, | 317 'printToPDF': printToPDF, |
| 313 'isFirstRequest' : false, | 318 'isFirstRequest' : false, |
| 319 'headerFooterEnabled': headerFooterSettings.hasHeaderFooter(), |
| 314 'requestID': -1}; | 320 'requestID': -1}; |
| 315 | 321 |
| 316 var printerList = $('printer-list'); | 322 var printerList = $('printer-list'); |
| 317 var selectedPrinter = printerList.selectedIndex; | 323 var selectedPrinter = printerList.selectedIndex; |
| 318 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { | 324 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { |
| 319 settings['cloudPrintID'] = | 325 settings['cloudPrintID'] = |
| 320 printerList.options[selectedPrinter].value; | 326 printerList.options[selectedPrinter].value; |
| 321 } | 327 } |
| 322 return settings; | 328 return settings; |
| 323 } | 329 } |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 requestPrintPreview(); | 956 requestPrintPreview(); |
| 951 } | 957 } |
| 952 | 958 |
| 953 /// Pull in all other scripts in a single shot. | 959 /// Pull in all other scripts in a single shot. |
| 954 <include src="print_preview_animations.js"/> | 960 <include src="print_preview_animations.js"/> |
| 955 <include src="print_preview_cloud.js"/> | 961 <include src="print_preview_cloud.js"/> |
| 956 <include src="print_preview_utils.js"/> | 962 <include src="print_preview_utils.js"/> |
| 957 <include src="print_header.js"/> | 963 <include src="print_header.js"/> |
| 958 <include src="page_settings.js"/> | 964 <include src="page_settings.js"/> |
| 959 <include src="copies_settings.js"/> | 965 <include src="copies_settings.js"/> |
| 966 <include src="header_footer_settings.js"/> |
| 960 <include src="layout_settings.js"/> | 967 <include src="layout_settings.js"/> |
| 961 <include src="color_settings.js"/> | 968 <include src="color_settings.js"/> |
| OLD | NEW |