Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6815)

Unified Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 7792085: Print Preview: Handling pending print to pdf requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/print_preview.js
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index 9e7503884667f614b5e569f4d6621e50484a8399..b085402df58fcc46bdd22ba82af4a6d2652a88cb 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -436,11 +436,11 @@ function requestToPrintDocument() {
if (hasPendingPrintDocumentRequest) {
if (printToPDF) {
- // TODO(thestig) disable controls here.
- } else {
- isTabHidden = true;
- chrome.send('hidePreview');
- }
+ sendPrintDocumentRequest();
+ } else {
+ isTabHidden = true;
+ chrome.send('hidePreview');
+ }
return;
}
@@ -540,6 +540,17 @@ function fileSelectionCancelled() {
}
/**
+ * Called from PrintPreviewUI::OnFileSelectionCompleted to notify the print
+ * preview tab regarding the file selection completed event.
+ */
+function fileSelectionCompleted() {
+ // If the file selection is completed and the tab is not already closed it
+ // means that a pending print to pdf request exists.
+ disableInputElementsInSidebar();
+ showCustomMessage(localStrings.getString('printingToPDFInProgress'));
+}
+
+/**
* Set the default printer. If there is one, generate a print preview.
* @param {string} printer Name of the default printer. Empty if none.
* @param {string} cloudPrintData Cloud print related data to restore if
@@ -824,9 +835,12 @@ function setColor(color) {
function displayErrorMessage(errorMessage) {
$('print-button').disabled = true;
$('overlay-layer').classList.remove('invisible');
- $('dancing-dots-text').classList.add('hidden');
- $('error-text').innerHTML = errorMessage;
- $('error-text').classList.remove('hidden');
+ var customMessage = $('custom-message');
+ customMessage.textContent = errorMessage;
+ customMessage.hidden = false;
+ var customMessageWithDots = $('custom-message-with-dots');
+ customMessageWithDots.innerHTML = '';
+ customMessageWithDots.hidden = true;;
var pdfViewer = $('pdf-viewer');
if (pdfViewer)
$('mainview').removeChild(pdfViewer);
@@ -882,7 +896,7 @@ function onPDFLoad() {
}
$('pdf-viewer').fitToHeight();
cr.dispatchSimpleEvent(document, 'PDFLoaded');
- hideLoadingAnimation();
+ hideOverlayLayer();
}
function setPluginPreviewPageCount() {
@@ -927,7 +941,7 @@ function reloadPreviewPages(previewUid, previewResponseId) {
isPrintReadyMetafileReady = true;
cr.dispatchSimpleEvent(document, 'updatePrintButton');
- hideLoadingAnimation();
+ hideOverlayLayer();
var pageSet = pageSettings.previouslySelectedPages;
for (var i = 0; i < pageSet.length; i++)
$('pdf-viewer').loadPreviewPage(getPageSrcURL(previewUid, pageSet[i]-1), i);

Powered by Google App Engine
This is Rietveld 408576698