| 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 var localStrings = new LocalStrings(); | 5 var localStrings = new LocalStrings(); |
| 6 | 6 |
| 7 // The total page count of the previewed document regardless of which pages the | 7 // The total page count of the previewed document regardless of which pages the |
| 8 // user has selected. | 8 // user has selected. |
| 9 var totalPageCount = -1; | 9 var totalPageCount = -1; |
| 10 | 10 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 var deviceName = ''; | 325 var deviceName = ''; |
| 326 if (selectedPrinter >= 0) | 326 if (selectedPrinter >= 0) |
| 327 deviceName = printerList.options[selectedPrinter].value; | 327 deviceName = printerList.options[selectedPrinter].value; |
| 328 return deviceName; | 328 return deviceName; |
| 329 } | 329 } |
| 330 | 330 |
| 331 /** | 331 /** |
| 332 * Asks the browser to print the preview PDF based on current print settings. | 332 * Asks the browser to print the preview PDF based on current print settings. |
| 333 */ | 333 */ |
| 334 function printFile() { | 334 function printFile() { |
| 335 $('print-button').classList.add('loading'); | |
| 336 $('cancel-button').classList.add('loading'); | |
| 337 $('print-summary').innerHTML = localStrings.getString('printing'); | |
| 338 removeEventListeners(); | |
| 339 | |
| 340 if (getSelectedPrinterName() != PRINT_TO_PDF) { | 335 if (getSelectedPrinterName() != PRINT_TO_PDF) { |
| 336 $('print-button').classList.add('loading'); |
| 337 $('cancel-button').classList.add('loading'); |
| 338 $('print-summary').innerHTML = localStrings.getString('printing'); |
| 339 removeEventListeners(); |
| 341 window.setTimeout(function() { chrome.send('print', [getSettingsJSON()]); }, | 340 window.setTimeout(function() { chrome.send('print', [getSettingsJSON()]); }, |
| 342 1000); | 341 1000); |
| 343 } else | 342 } else |
| 344 chrome.send('print', [getSettingsJSON()]); | 343 chrome.send('print', [getSettingsJSON()]); |
| 345 } | 344 } |
| 346 | 345 |
| 347 /** | 346 /** |
| 348 * Asks the browser to generate a preview PDF based on current print settings. | 347 * Asks the browser to generate a preview PDF based on current print settings. |
| 349 */ | 348 */ |
| 350 function requestPrintPreview() { | 349 function requestPrintPreview() { |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 this.isLandscape = ''; | 938 this.isLandscape = ''; |
| 940 } | 939 } |
| 941 | 940 |
| 942 /** | 941 /** |
| 943 * Takes a snapshot of the print settings. | 942 * Takes a snapshot of the print settings. |
| 944 */ | 943 */ |
| 945 PrintSettings.prototype.save = function() { | 944 PrintSettings.prototype.save = function() { |
| 946 this.deviceName = getSelectedPrinterName(); | 945 this.deviceName = getSelectedPrinterName(); |
| 947 this.isLandscape = isLandscape(); | 946 this.isLandscape = isLandscape(); |
| 948 } | 947 } |
| OLD | NEW |