Chromium Code Reviews| 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 | 913 |
| 914 /** | 914 /** |
| 915 * Called when no pipelining previewed pages. | 915 * Called when no pipelining previewed pages. |
| 916 * @param {string} previewUid Preview unique identifier. | 916 * @param {string} previewUid Preview unique identifier. |
| 917 * @param {number} previewResponseId The preview request id that resulted in | 917 * @param {number} previewResponseId The preview request id that resulted in |
| 918 * this response. | 918 * this response. |
| 919 */ | 919 */ |
| 920 function reloadPreviewPages(previewUid, previewResponseId) { | 920 function reloadPreviewPages(previewUid, previewResponseId) { |
| 921 if (!isExpectedPreviewResponse(previewResponseId)) | 921 if (!isExpectedPreviewResponse(previewResponseId)) |
| 922 return; | 922 return; |
| 923 | |
| 924 if (pageSettings.requestPrintPreviewIfNeeded()) | |
|
dpapad
2011/09/01 21:20:53
Repeating our in person discussion, it seems bette
kmadhusu
2011/09/01 21:38:34
Done.
| |
| 925 return; | |
| 923 hasPendingPreviewRequest = false; | 926 hasPendingPreviewRequest = false; |
| 924 | 927 |
| 925 cr.dispatchSimpleEvent(document, 'updatePrintButton'); | 928 cr.dispatchSimpleEvent(document, 'updatePrintButton'); |
| 926 hideLoadingAnimation(); | 929 hideLoadingAnimation(); |
| 927 var pageSet = pageSettings.previouslySelectedPages; | 930 var pageSet = pageSettings.previouslySelectedPages; |
| 928 for (var i = 0; i < pageSet.length; i++) | 931 for (var i = 0; i < pageSet.length; i++) |
| 929 $('pdf-viewer').loadPreviewPage(getPageSrcURL(previewUid, pageSet[i]-1), i); | 932 $('pdf-viewer').loadPreviewPage(getPageSrcURL(previewUid, pageSet[i]-1), i); |
| 930 // TODO(dpapad): handle pending print file requests. | 933 // TODO(dpapad): handle pending print file requests. |
| 931 } | 934 } |
| 932 | 935 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 * Create the PDF plugin as needed. | 972 * Create the PDF plugin as needed. |
| 970 * Called from PrintPreviewUI::PreviewDataIsAvailable(). | 973 * Called from PrintPreviewUI::PreviewDataIsAvailable(). |
| 971 * @param {boolean} modifiable If the preview is modifiable. | 974 * @param {boolean} modifiable If the preview is modifiable. |
| 972 * @param {string} previewUid Preview unique identifier. | 975 * @param {string} previewUid Preview unique identifier. |
| 973 * @param {number} previewResponseId The preview request id that resulted in | 976 * @param {number} previewResponseId The preview request id that resulted in |
| 974 * this response. | 977 * this response. |
| 975 */ | 978 */ |
| 976 function updatePrintPreview(previewUid, previewResponseId) { | 979 function updatePrintPreview(previewUid, previewResponseId) { |
| 977 if (!isExpectedPreviewResponse(previewResponseId)) | 980 if (!isExpectedPreviewResponse(previewResponseId)) |
| 978 return; | 981 return; |
| 982 | |
| 983 if (pageSettings.requestPrintPreviewIfNeeded()) | |
| 984 return; | |
| 985 | |
| 979 hasPendingPreviewRequest = false; | 986 hasPendingPreviewRequest = false; |
| 980 hasPendingPrintReadyDocumentRequest = false; | 987 hasPendingPrintReadyDocumentRequest = false; |
| 981 | 988 |
| 982 if (!previewModifiable) { | 989 if (!previewModifiable) { |
| 983 // If the preview is not modifiable the plugin has not been created yet. | 990 // If the preview is not modifiable the plugin has not been created yet. |
| 984 currentPreviewUid = previewUid; | 991 currentPreviewUid = previewUid; |
| 985 createPDFPlugin(PRINT_READY_DATA_INDEX); | 992 createPDFPlugin(PRINT_READY_DATA_INDEX); |
| 986 } | 993 } |
| 987 | 994 |
| 988 cr.dispatchSimpleEvent(document, 'updatePrintButton'); | 995 cr.dispatchSimpleEvent(document, 'updatePrintButton'); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 <include src="print_preview_animations.js"/> | 1092 <include src="print_preview_animations.js"/> |
| 1086 <include src="print_preview_cloud.js"/> | 1093 <include src="print_preview_cloud.js"/> |
| 1087 <include src="print_preview_utils.js"/> | 1094 <include src="print_preview_utils.js"/> |
| 1088 <include src="print_header.js"/> | 1095 <include src="print_header.js"/> |
| 1089 <include src="page_settings.js"/> | 1096 <include src="page_settings.js"/> |
| 1090 <include src="copies_settings.js"/> | 1097 <include src="copies_settings.js"/> |
| 1091 <include src="header_footer_settings.js"/> | 1098 <include src="header_footer_settings.js"/> |
| 1092 <include src="layout_settings.js"/> | 1099 <include src="layout_settings.js"/> |
| 1093 <include src="color_settings.js"/> | 1100 <include src="color_settings.js"/> |
| 1094 <include src="margin_settings.js"/> | 1101 <include src="margin_settings.js"/> |
| OLD | NEW |