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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 printHeader.addEventListeners(); | 130 printHeader.addEventListeners(); |
131 pageSettings.addEventListeners(); | 131 pageSettings.addEventListeners(); |
132 copiesSettings.addEventListeners(); | 132 copiesSettings.addEventListeners(); |
133 headerFooterSettings.addEventListeners(); | 133 headerFooterSettings.addEventListeners(); |
134 layoutSettings.addEventListeners(); | 134 layoutSettings.addEventListeners(); |
135 marginSettings.addEventListeners(); | 135 marginSettings.addEventListeners(); |
136 colorSettings.addEventListeners(); | 136 colorSettings.addEventListeners(); |
137 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; | 137 $('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities; |
138 | 138 |
139 showLoadingAnimation(); | 139 showLoadingAnimation(); |
140 chrome.send('getInitiatorTabTitle'); | |
kmadhusu
2011/09/02 06:50:09
What will be the title if the initiator tab is clo
dpapad
2011/09/02 17:40:18
It was displaying "Print -", fixed now to display
| |
140 chrome.send('getDefaultPrinter'); | 141 chrome.send('getDefaultPrinter'); |
141 } | 142 } |
142 | 143 |
143 /** | 144 /** |
144 * Disables the input elements in the sidebar. | 145 * Disables the input elements in the sidebar. |
145 */ | 146 */ |
146 function disableInputElementsInSidebar() { | 147 function disableInputElementsInSidebar() { |
147 var els = $('sidebar').querySelectorAll('input, button, select'); | 148 var els = $('sidebar').querySelectorAll('input, button, select'); |
148 for (var i = 0; i < els.length; i++) | 149 for (var i = 0; i < els.length; i++) |
149 els[i].disabled = true; | 150 els[i].disabled = true; |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 } | 881 } |
881 | 882 |
882 /** | 883 /** |
883 * Update the page count and check the page range. | 884 * Update the page count and check the page range. |
884 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). | 885 * Called from PrintPreviewUI::OnDidGetPreviewPageCount(). |
885 * @param {number} pageCount The number of pages. | 886 * @param {number} pageCount The number of pages. |
886 * @param {boolean} isModifiable Indicates whether the previewed document can be | 887 * @param {boolean} isModifiable Indicates whether the previewed document can be |
887 * modified. | 888 * modified. |
888 * @param {number} previewResponseId The preview request id that resulted in | 889 * @param {number} previewResponseId The preview request id that resulted in |
889 * this response. | 890 * this response. |
890 * @param {string} jobTitle The print job title | |
891 */ | 891 */ |
892 function onDidGetPreviewPageCount(pageCount, isModifiable, previewResponseId, | 892 function onDidGetPreviewPageCount(pageCount, isModifiable, previewResponseId) { |
893 jobTitle) { | |
894 if (!isExpectedPreviewResponse(previewResponseId)) | 893 if (!isExpectedPreviewResponse(previewResponseId)) |
895 return; | 894 return; |
896 pageSettings.updateState(pageCount); | 895 pageSettings.updateState(pageCount); |
897 previewModifiable = isModifiable; | 896 previewModifiable = isModifiable; |
898 document.title = localStrings.getStringF('printPreviewTitleFormat', jobTitle); | |
899 cr.dispatchSimpleEvent(document, 'updateSummary'); | 897 cr.dispatchSimpleEvent(document, 'updateSummary'); |
900 } | 898 } |
901 | 899 |
902 function onDidGetDefaultPageLayout(pageLayout) { | 900 function onDidGetDefaultPageLayout(pageLayout) { |
903 // TODO(aayushkumar): Do something here! | 901 // TODO(aayushkumar): Do something here! |
904 } | 902 } |
905 | 903 |
906 /** | 904 /** |
907 * Called when no pipelining previewed pages. | 905 * Called when no pipelining previewed pages. |
908 * @param {string} previewUid Preview unique identifier. | 906 * @param {string} previewUid Preview unique identifier. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 | 1064 |
1067 /** | 1065 /** |
1068 * Takes a snapshot of the print settings. | 1066 * Takes a snapshot of the print settings. |
1069 */ | 1067 */ |
1070 PrintSettings.prototype.save = function() { | 1068 PrintSettings.prototype.save = function() { |
1071 this.deviceName = getSelectedPrinterName(); | 1069 this.deviceName = getSelectedPrinterName(); |
1072 this.isLandscape = layoutSettings.isLandscape(); | 1070 this.isLandscape = layoutSettings.isLandscape(); |
1073 this.hasHeaderFooter = headerFooterSettings.hasHeaderFooter(); | 1071 this.hasHeaderFooter = headerFooterSettings.hasHeaderFooter(); |
1074 } | 1072 } |
1075 | 1073 |
1074 /** | |
1075 * Updates the title of the print preview tab according to |initiatorTabTitle|. | |
1076 * Called from PrintPreviewUI::OnGetInitiatorTabTitle as a result of sending a | |
1077 * 'getInitiatorTabTitle' message. | |
1078 * @param {string} initiatorTabTitle The title of the initiator tab. | |
1079 */ | |
1080 function setInitiatorTabTitle(initiatorTabTitle) { | |
1081 document.title = localStrings.getStringF( | |
1082 'printPreviewTitleFormat', initiatorTabTitle); | |
1083 } | |
1084 | |
1076 /// Pull in all other scripts in a single shot. | 1085 /// Pull in all other scripts in a single shot. |
1077 <include src="print_preview_animations.js"/> | 1086 <include src="print_preview_animations.js"/> |
1078 <include src="print_preview_cloud.js"/> | 1087 <include src="print_preview_cloud.js"/> |
1079 <include src="print_preview_utils.js"/> | 1088 <include src="print_preview_utils.js"/> |
1080 <include src="print_header.js"/> | 1089 <include src="print_header.js"/> |
1081 <include src="page_settings.js"/> | 1090 <include src="page_settings.js"/> |
1082 <include src="copies_settings.js"/> | 1091 <include src="copies_settings.js"/> |
1083 <include src="header_footer_settings.js"/> | 1092 <include src="header_footer_settings.js"/> |
1084 <include src="layout_settings.js"/> | 1093 <include src="layout_settings.js"/> |
1085 <include src="color_settings.js"/> | 1094 <include src="color_settings.js"/> |
1086 <include src="margin_settings.js"/> | 1095 <include src="margin_settings.js"/> |
OLD | NEW |