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

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

Issue 7202012: Print Preview: Display a throbber when the user requests the system print (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 6 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 d33f981a3798ea24a8d7cbb11cc393a67c37f591..ee6e3511dac46c3afcb96051503edd0969603b4f 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -48,6 +48,10 @@ var isTabHidden = false;
// True when draft preview data is requested for preview.
var draftDocument = true;
+// True if the user has click 'Advanced...' in order to open the system print
+// dialog.
+var showingSystemDialog = false;
+
/**
* Window onload handler, sets up the page and starts print preview by getting
* the printer list.
@@ -169,13 +173,22 @@ function removeEventListeners() {
$('portrait').onclick = null;
$('printer-list').onchange = null;
- // Controls that dont require preview rendering.
+ // Controls that don't require preview rendering.
$('two-sided').onclick = null;
$('color').onclick = null;
$('bw').onclick = null;
}
/**
+ * Disables the input elements in the controls pane.
+ */
+function disableInputElements() {
+ var els = document.querySelectorAll('input, button, select');
+ for (var i = 0; i < els.length; i++)
+ els[i].disabled = true;
+}
+
+/**
* Asks the browser to close the preview tab.
*/
function handleCancelButtonClick() {
@@ -186,6 +199,9 @@ function handleCancelButtonClick() {
* Asks the browser to show the native print dialog for printing.
*/
function showSystemDialog() {
+ showingSystemDialog = true;
+ disableInputElements();
+ $('system-dialog-throbber').classList.remove('hidden');
chrome.send('showSystemDialog');
}
@@ -656,10 +672,6 @@ function updatePrintPreview(pageCount, jobTitle, modifiable, previewUid) {
* @param {string} previewUid Preview unique identifier.
*/
function createPDFPlugin(previewUid) {
- // Enable the print button.
- if (!$('printer-list').disabled)
- $('print-button').disabled = false;
-
var pdfViewer = $('pdf-viewer');
if (pdfViewer) {
// Need to call this before the reload(), where the plugin resets its
@@ -700,6 +712,9 @@ function checkCompatiblePluginExists() {
* 2) The number of copies is valid (if applicable).
*/
function updatePrintButtonState() {
+ if (showingSystemDialog)
+ return;
+
if (getSelectedPrinterName() == PRINT_TO_PDF) {
$('print-button').disabled = !isSelectedPagesValid();
} else {

Powered by Google App Engine
This is Rietveld 408576698