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

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: Addressing more comments 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 b73f6b91197ddca018ddcbf220b551e5e3962d6f..ef5b559248c033d41345f3ab42d078e398fe4c08 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -435,11 +435,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;
}
@@ -539,6 +539,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
@@ -823,9 +834,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);
@@ -881,7 +895,7 @@ function onPDFLoad() {
}
$('pdf-viewer').fitToHeight();
cr.dispatchSimpleEvent(document, 'PDFLoaded');
- hideLoadingAnimation();
+ hideOverlayLayer();
}
function setPluginPreviewPageCount() {
@@ -926,7 +940,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