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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 * Asks the browser to print the preview PDF based on current print | 426 * Asks the browser to print the preview PDF based on current print |
427 * settings. If the preview is still loading, printPendingFile() will get | 427 * settings. If the preview is still loading, printPendingFile() will get |
428 * called once the preview loads. | 428 * called once the preview loads. |
429 */ | 429 */ |
430 function requestToPrintDocument() { | 430 function requestToPrintDocument() { |
431 hasPendingPrintDocumentRequest = !isPrintReadyMetafileReady; | 431 hasPendingPrintDocumentRequest = !isPrintReadyMetafileReady; |
432 var printToPDF = getSelectedPrinterName() == PRINT_TO_PDF; | 432 var printToPDF = getSelectedPrinterName() == PRINT_TO_PDF; |
433 | 433 |
434 if (hasPendingPrintDocumentRequest) { | 434 if (hasPendingPrintDocumentRequest) { |
435 if (printToPDF) { | 435 if (printToPDF) { |
436 // TODO(thestig) disable controls here. | 436 sendPrintDocumentRequest(); |
437 } else { | 437 } else { |
438 isTabHidden = true; | 438 isTabHidden = true; |
439 chrome.send('hidePreview'); | 439 chrome.send('hidePreview'); |
kmadhusu
2011/09/02 21:47:03
Create a helper function to set isTabHidden = true
dpapad
2011/09/07 00:46:19
This is only performed once here (as of latest pat
| |
440 } | 440 } |
441 return; | 441 return; |
442 } | 442 } |
443 | 443 |
444 if (printToPDF) { | 444 if (printToPDF) { |
445 sendPrintDocumentRequest(); | 445 sendPrintDocumentRequest(); |
446 } else { | 446 } else { |
447 window.setTimeout(function() { sendPrintDocumentRequest(); }, 1000); | 447 window.setTimeout(function() { sendPrintDocumentRequest(); }, 1000); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 } | 529 } |
530 | 530 |
531 /** | 531 /** |
532 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print | 532 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print |
533 * preview tab regarding the file selection cancel event. | 533 * preview tab regarding the file selection cancel event. |
534 */ | 534 */ |
535 function fileSelectionCancelled() { | 535 function fileSelectionCancelled() { |
536 // TODO(thestig) re-enable controls here. | 536 // TODO(thestig) re-enable controls here. |
537 } | 537 } |
538 | 538 |
539 function fileSelectionCompleted() { | |
540 isTabHidden = true; | |
kmadhusu
2011/09/02 21:47:03
Call that helper function here.
dpapad
2011/09/07 00:46:19
The preview tab is not hidden anymore here, instea
| |
541 chrome.send('hidePreview'); | |
542 } | |
543 | |
539 /** | 544 /** |
540 * Set the default printer. If there is one, generate a print preview. | 545 * Set the default printer. If there is one, generate a print preview. |
541 * @param {string} printer Name of the default printer. Empty if none. | 546 * @param {string} printer Name of the default printer. Empty if none. |
542 * @param {string} cloudPrintData Cloud print related data to restore if | 547 * @param {string} cloudPrintData Cloud print related data to restore if |
543 * the default printer is a cloud printer. | 548 * the default printer is a cloud printer. |
544 */ | 549 */ |
545 function setDefaultPrinter(printer_name, cloudPrintData) { | 550 function setDefaultPrinter(printer_name, cloudPrintData) { |
546 // Add a placeholder value so the printer list looks valid. | 551 // Add a placeholder value so the printer list looks valid. |
547 addDestinationListOption('', '', true, true, true); | 552 addDestinationListOption('', '', true, true, true); |
548 if (printer_name) { | 553 if (printer_name) { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
971 /** | 976 /** |
972 * Update the print preview when new preview data is available. | 977 * Update the print preview when new preview data is available. |
973 * Create the PDF plugin as needed. | 978 * Create the PDF plugin as needed. |
974 * Called from PrintPreviewUI::PreviewDataIsAvailable(). | 979 * Called from PrintPreviewUI::PreviewDataIsAvailable(). |
975 * @param {boolean} modifiable If the preview is modifiable. | 980 * @param {boolean} modifiable If the preview is modifiable. |
976 * @param {string} previewUid Preview unique identifier. | 981 * @param {string} previewUid Preview unique identifier. |
977 * @param {number} previewResponseId The preview request id that resulted in | 982 * @param {number} previewResponseId The preview request id that resulted in |
978 * this response. | 983 * this response. |
979 */ | 984 */ |
980 function updatePrintPreview(previewUid, previewResponseId) { | 985 function updatePrintPreview(previewUid, previewResponseId) { |
986 console.log("updatePrintPreview " + previewResponseId); | |
kmadhusu
2011/09/02 21:47:03
remove console.log
dpapad
2011/09/07 00:46:19
Done.
| |
981 if (!isExpectedPreviewResponse(previewResponseId)) | 987 if (!isExpectedPreviewResponse(previewResponseId)) |
982 return; | 988 return; |
983 hasPendingPreviewRequest = false; | 989 hasPendingPreviewRequest = false; |
984 isPrintReadyMetafileReady = true; | 990 isPrintReadyMetafileReady = true; |
985 | 991 |
986 if (!previewModifiable) { | 992 if (!previewModifiable) { |
987 // If the preview is not modifiable the plugin has not been created yet. | 993 // If the preview is not modifiable the plugin has not been created yet. |
988 currentPreviewUid = previewUid; | 994 currentPreviewUid = previewUid; |
989 createPDFPlugin(PRINT_READY_DATA_INDEX); | 995 createPDFPlugin(PRINT_READY_DATA_INDEX); |
990 } | 996 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1089 <include src="print_preview_animations.js"/> | 1095 <include src="print_preview_animations.js"/> |
1090 <include src="print_preview_cloud.js"/> | 1096 <include src="print_preview_cloud.js"/> |
1091 <include src="print_preview_utils.js"/> | 1097 <include src="print_preview_utils.js"/> |
1092 <include src="print_header.js"/> | 1098 <include src="print_header.js"/> |
1093 <include src="page_settings.js"/> | 1099 <include src="page_settings.js"/> |
1094 <include src="copies_settings.js"/> | 1100 <include src="copies_settings.js"/> |
1095 <include src="header_footer_settings.js"/> | 1101 <include src="header_footer_settings.js"/> |
1096 <include src="layout_settings.js"/> | 1102 <include src="layout_settings.js"/> |
1097 <include src="color_settings.js"/> | 1103 <include src="color_settings.js"/> |
1098 <include src="margin_settings.js"/> | 1104 <include src="margin_settings.js"/> |
OLD | NEW |