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 | |
57 // Object holding all the color related settings. | 54 // Object holding all the color related settings. |
58 var colorSettings; | 55 var colorSettings; |
59 | 56 |
60 // True if the user has click 'Advanced...' in order to open the system print | 57 // True if the user has click 'Advanced...' in order to open the system print |
61 // dialog. | 58 // dialog. |
62 var showingSystemDialog = false; | 59 var showingSystemDialog = false; |
63 | 60 |
64 // The range of options in the printer dropdown controlled by cloud print. | 61 // The range of options in the printer dropdown controlled by cloud print. |
65 var firstCloudPrintOptionPos = 0; | 62 var firstCloudPrintOptionPos = 0; |
66 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; | 63 var lastCloudPrintOptionPos = firstCloudPrintOptionPos; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 97 |
101 $('system-dialog-link').addEventListener('click', onSystemDialogLinkClicked); | 98 $('system-dialog-link').addEventListener('click', onSystemDialogLinkClicked); |
102 $('mainview').parentElement.removeChild($('dummy-viewer')); | 99 $('mainview').parentElement.removeChild($('dummy-viewer')); |
103 | 100 |
104 $('printer-list').disabled = true; | 101 $('printer-list').disabled = true; |
105 | 102 |
106 printHeader = print_preview.PrintHeader.getInstance(); | 103 printHeader = print_preview.PrintHeader.getInstance(); |
107 pageSettings = print_preview.PageSettings.getInstance(); | 104 pageSettings = print_preview.PageSettings.getInstance(); |
108 copiesSettings = print_preview.CopiesSettings.getInstance(); | 105 copiesSettings = print_preview.CopiesSettings.getInstance(); |
109 layoutSettings = print_preview.LayoutSettings.getInstance(); | 106 layoutSettings = print_preview.LayoutSettings.getInstance(); |
110 headerFooterSettings = print_preview.HeaderFooterSettings.getInstance(); | |
111 colorSettings = print_preview.ColorSettings.getInstance(); | 107 colorSettings = print_preview.ColorSettings.getInstance(); |
112 printHeader.addEventListeners(); | 108 printHeader.addEventListeners(); |
113 pageSettings.addEventListeners(); | 109 pageSettings.addEventListeners(); |
114 copiesSettings.addEventListeners(); | 110 copiesSettings.addEventListeners(); |
115 headerFooterSettings.addEventListeners(); | |
116 layoutSettings.addEventListeners(); | 111 layoutSettings.addEventListeners(); |
117 colorSettings.addEventListeners(); | 112 colorSettings.addEventListeners(); |
118 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; | 113 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; |
119 | 114 |
120 showLoadingAnimation(); | 115 showLoadingAnimation(); |
121 chrome.send('getDefaultPrinter'); | 116 chrome.send('getDefaultPrinter'); |
122 } | 117 } |
123 | 118 |
124 /** | 119 /** |
125 * Disables the input elements in the sidebar. | 120 * Disables the input elements in the sidebar. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 var settings = | 304 var settings = |
310 {'deviceName': deviceName, | 305 {'deviceName': deviceName, |
311 'pageRange': pageSettings.selectedPageRanges, | 306 'pageRange': pageSettings.selectedPageRanges, |
312 'duplex': copiesSettings.duplexMode, | 307 'duplex': copiesSettings.duplexMode, |
313 'copies': copiesSettings.numberOfCopies, | 308 'copies': copiesSettings.numberOfCopies, |
314 'collate': copiesSettings.isCollated(), | 309 'collate': copiesSettings.isCollated(), |
315 'landscape': layoutSettings.isLandscape(), | 310 'landscape': layoutSettings.isLandscape(), |
316 'color': colorSettings.isColor(), | 311 'color': colorSettings.isColor(), |
317 'printToPDF': printToPDF, | 312 'printToPDF': printToPDF, |
318 'isFirstRequest' : false, | 313 'isFirstRequest' : false, |
319 'headerFooterEnabled': headerFooterSettings.hasHeaderFooter(), | |
320 'requestID': -1}; | 314 'requestID': -1}; |
321 | 315 |
322 var printerList = $('printer-list'); | 316 var printerList = $('printer-list'); |
323 var selectedPrinter = printerList.selectedIndex; | 317 var selectedPrinter = printerList.selectedIndex; |
324 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { | 318 if (cloudprint.isCloudPrint(printerList.options[selectedPrinter])) { |
325 settings['cloudPrintID'] = | 319 settings['cloudPrintID'] = |
326 printerList.options[selectedPrinter].value; | 320 printerList.options[selectedPrinter].value; |
327 } | 321 } |
328 return settings; | 322 return settings; |
329 } | 323 } |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 requestPrintPreview(); | 950 requestPrintPreview(); |
957 } | 951 } |
958 | 952 |
959 /// Pull in all other scripts in a single shot. | 953 /// Pull in all other scripts in a single shot. |
960 <include src="print_preview_animations.js"/> | 954 <include src="print_preview_animations.js"/> |
961 <include src="print_preview_cloud.js"/> | 955 <include src="print_preview_cloud.js"/> |
962 <include src="print_preview_utils.js"/> | 956 <include src="print_preview_utils.js"/> |
963 <include src="print_header.js"/> | 957 <include src="print_header.js"/> |
964 <include src="page_settings.js"/> | 958 <include src="page_settings.js"/> |
965 <include src="copies_settings.js"/> | 959 <include src="copies_settings.js"/> |
966 <include src="header_footer_settings.js"/> | |
967 <include src="layout_settings.js"/> | 960 <include src="layout_settings.js"/> |
968 <include src="color_settings.js"/> | 961 <include src="color_settings.js"/> |
OLD | NEW |