| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * An interface to the native Chromium printing system layer. | 9 * An interface to the native Chromium printing system layer. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 if (initialSettings['measurementSystem'] != null) { | 338 if (initialSettings['measurementSystem'] != null) { |
| 339 unitType = initialSettings['measurementSystem']; | 339 unitType = initialSettings['measurementSystem']; |
| 340 } | 340 } |
| 341 | 341 |
| 342 var nativeInitialSettings = new print_preview.NativeInitialSettings( | 342 var nativeInitialSettings = new print_preview.NativeInitialSettings( |
| 343 initialSettings['printAutomaticallyInKioskMode'] || false, | 343 initialSettings['printAutomaticallyInKioskMode'] || false, |
| 344 numberFormatSymbols[0] || ',', | 344 numberFormatSymbols[0] || ',', |
| 345 numberFormatSymbols[1] || '.', | 345 numberFormatSymbols[1] || '.', |
| 346 unitType, | 346 unitType, |
| 347 initialSettings['previewModifiable'] || false, | 347 initialSettings['previewModifiable'] || false, |
| 348 initialSettings['initiatorTabTitle'] || '', | 348 initialSettings['initiatorTitle'] || '', |
| 349 initialSettings['documentHasSelection'] || false, | 349 initialSettings['documentHasSelection'] || false, |
| 350 initialSettings['shouldPrintSelectionOnly'] || false, | 350 initialSettings['shouldPrintSelectionOnly'] || false, |
| 351 initialSettings['printerName'] || null, | 351 initialSettings['printerName'] || null, |
| 352 initialSettings['appState'] || null); | 352 initialSettings['appState'] || null); |
| 353 | 353 |
| 354 var initialSettingsSetEvent = new cr.Event( | 354 var initialSettingsSetEvent = new cr.Event( |
| 355 NativeLayer.EventType.INITIAL_SETTINGS_SET); | 355 NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 356 initialSettingsSetEvent.initialSettings = nativeInitialSettings; | 356 initialSettingsSetEvent.initialSettings = nativeInitialSettings; |
| 357 this.dispatchEvent(initialSettingsSetEvent); | 357 this.dispatchEvent(initialSettingsSetEvent); |
| 358 }, | 358 }, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 }, | 410 }, |
| 411 | 411 |
| 412 /** Reloads the printer list. */ | 412 /** Reloads the printer list. */ |
| 413 onReloadPrintersList_: function() { | 413 onReloadPrintersList_: function() { |
| 414 cr.dispatchSimpleEvent(this, NativeLayer.EventType.DESTINATIONS_RELOAD); | 414 cr.dispatchSimpleEvent(this, NativeLayer.EventType.DESTINATIONS_RELOAD); |
| 415 }, | 415 }, |
| 416 | 416 |
| 417 /** | 417 /** |
| 418 * Called from the C++ layer. | 418 * Called from the C++ layer. |
| 419 * Take the PDF data handed to us and submit it to the cloud, closing the | 419 * Take the PDF data handed to us and submit it to the cloud, closing the |
| 420 * print preview tab once the upload is successful. | 420 * print preview dialog once the upload is successful. |
| 421 * @param {string} data Data to send as the print job. | 421 * @param {string} data Data to send as the print job. |
| 422 * @private | 422 * @private |
| 423 */ | 423 */ |
| 424 onPrintToCloud_: function(data) { | 424 onPrintToCloud_: function(data) { |
| 425 var printToCloudEvent = new cr.Event( | 425 var printToCloudEvent = new cr.Event( |
| 426 NativeLayer.EventType.PRINT_TO_CLOUD); | 426 NativeLayer.EventType.PRINT_TO_CLOUD); |
| 427 printToCloudEvent.data = data; | 427 printToCloudEvent.data = data; |
| 428 this.dispatchEvent(printToCloudEvent); | 428 this.dispatchEvent(printToCloudEvent); |
| 429 }, | 429 }, |
| 430 | 430 |
| 431 /** | 431 /** |
| 432 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print | 432 * Called from PrintPreviewUI::OnFileSelectionCancelled to notify the print |
| 433 * preview tab regarding the file selection cancel event. | 433 * preview dialog regarding the file selection cancel event. |
| 434 * @private | 434 * @private |
| 435 */ | 435 */ |
| 436 onFileSelectionCancelled_: function() { | 436 onFileSelectionCancelled_: function() { |
| 437 cr.dispatchSimpleEvent(this, NativeLayer.EventType.FILE_SELECTION_CANCEL); | 437 cr.dispatchSimpleEvent(this, NativeLayer.EventType.FILE_SELECTION_CANCEL); |
| 438 }, | 438 }, |
| 439 | 439 |
| 440 /** | 440 /** |
| 441 * Called from PrintPreviewUI::OnFileSelectionCompleted to notify the print | 441 * Called from PrintPreviewUI::OnFileSelectionCompleted to notify the print |
| 442 * preview tab regarding the file selection completed event. | 442 * preview dialog regarding the file selection completed event. |
| 443 * @private | 443 * @private |
| 444 */ | 444 */ |
| 445 onFileSelectionCompleted_: function() { | 445 onFileSelectionCompleted_: function() { |
| 446 // If the file selection is completed and the tab is not already closed it | 446 // If the file selection is completed and the dialog is not already closed |
| 447 // means that a pending print to pdf request exists. | 447 // it means that a pending print to pdf request exists. |
| 448 cr.dispatchSimpleEvent( | 448 cr.dispatchSimpleEvent( |
| 449 this, NativeLayer.EventType.FILE_SELECTION_COMPLETE); | 449 this, NativeLayer.EventType.FILE_SELECTION_COMPLETE); |
| 450 }, | 450 }, |
| 451 | 451 |
| 452 /** | 452 /** |
| 453 * Display an error message when print preview fails. | 453 * Display an error message when print preview fails. |
| 454 * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). | 454 * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). |
| 455 * @private | 455 * @private |
| 456 */ | 456 */ |
| 457 onPrintPreviewFailed_: function() { | 457 onPrintPreviewFailed_: function() { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return this.serializedAppStateStr_; | 739 return this.serializedAppStateStr_; |
| 740 } | 740 } |
| 741 }; | 741 }; |
| 742 | 742 |
| 743 // Export | 743 // Export |
| 744 return { | 744 return { |
| 745 NativeInitialSettings: NativeInitialSettings, | 745 NativeInitialSettings: NativeInitialSettings, |
| 746 NativeLayer: NativeLayer | 746 NativeLayer: NativeLayer |
| 747 }; | 747 }; |
| 748 }); | 748 }); |
| OLD | NEW |