| 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'strict'; | 6 'strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a PreviewArea object. It represents the area where the preview | 9 * Creates a PreviewArea object. It represents the area where the preview |
| 10 * document is displayed. | 10 * document is displayed. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 this.customMessageWithDots_.hidden = false; | 191 this.customMessageWithDots_.hidden = false; |
| 192 if (this.pdfPlugin_) | 192 if (this.pdfPlugin_) |
| 193 this.pdfPlugin_.classList.add('invisible'); | 193 this.pdfPlugin_.classList.add('invisible'); |
| 194 this.overlayLayer.classList.remove('invisible'); | 194 this.overlayLayer.classList.remove('invisible'); |
| 195 }, | 195 }, |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Display an error message in the center of the preview area. | 198 * Display an error message in the center of the preview area. |
| 199 * @param {string} errorMessage The error message to be displayed. | 199 * @param {string} errorMessage The error message to be displayed. |
| 200 */ | 200 */ |
| 201 displayErrorMessage: function(errorMessage) { | 201 displayErrorMessageAndNotify: function(errorMessage) { |
| 202 $('print-button').disabled = true; | |
| 203 this.overlayLayer.classList.remove('invisible'); | 202 this.overlayLayer.classList.remove('invisible'); |
| 204 this.customMessage_.textContent = errorMessage; | 203 this.customMessage_.textContent = errorMessage; |
| 205 this.customMessage_.hidden = false; | 204 this.customMessage_.hidden = false; |
| 206 this.customMessageWithDots_.innerHTML = ''; | 205 this.customMessageWithDots_.innerHTML = ''; |
| 207 this.customMessageWithDots_.hidden = true; | 206 this.customMessageWithDots_.hidden = true; |
| 208 if (this.pdfPlugin_) { | 207 if (this.pdfPlugin_) { |
| 209 $('mainview').removeChild(this.pdfPlugin_); | 208 $('mainview').removeChild(this.pdfPlugin_); |
| 210 this.pdfPlugin_ = null; | 209 this.pdfPlugin_ = null; |
| 211 } | 210 } |
| 211 cr.dispatchSimpleEvent(document, 'PDFGenerationError'); |
| 212 }, | 212 }, |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * Display an error message in the center of the preview area followed by a | 215 * Display an error message in the center of the preview area followed by a |
| 216 * button. | 216 * button. |
| 217 * @param {string} errorMessage The error message to be displayed. | 217 * @param {string} errorMessage The error message to be displayed. |
| 218 * @param {string} buttonText The text to be displayed within the button. | 218 * @param {string} buttonText The text to be displayed within the button. |
| 219 * @param {string} buttonListener The listener to be executed when the | 219 * @param {string} buttonListener The listener to be executed when the |
| 220 * button is clicked. | 220 * button is clicked. |
| 221 */ | 221 */ |
| 222 displayErrorMessageWithButton: function( | 222 displayErrorMessageWithButtonAndNotify: function( |
| 223 errorMessage, buttonText, buttonListener) { | 223 errorMessage, buttonText, buttonListener) { |
| 224 this.errorButton.disabled = false; | 224 this.errorButton.disabled = false; |
| 225 this.errorButton.textContent = buttonText; | 225 this.errorButton.textContent = buttonText; |
| 226 this.errorButton.onclick = buttonListener; | 226 this.errorButton.onclick = buttonListener; |
| 227 this.errorButton.hidden = false; | 227 this.errorButton.hidden = false; |
| 228 $('system-dialog-throbber').hidden = true; | 228 $('system-dialog-throbber').hidden = true; |
| 229 $('native-print-dialog-throbber').hidden = true; | 229 $('native-print-dialog-throbber').hidden = true; |
| 230 this.displayErrorMessage(errorMessage); | 230 this.displayErrorMessageAndNotify(errorMessage); |
| 231 } | 231 } |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 return { | 234 return { |
| 235 PreviewArea: PreviewArea, | 235 PreviewArea: PreviewArea, |
| 236 }; | 236 }; |
| 237 }); | 237 }); |
| OLD | NEW |