| Index: chrome/browser/resources/print_preview/native_layer.js
|
| diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
|
| index e0c54bc360b0fe104d2f383b49db9cabe8577fe0..dd3e72ef6658b2afa59ced6d9a5b9193d51658de 100644
|
| --- a/chrome/browser/resources/print_preview/native_layer.js
|
| +++ b/chrome/browser/resources/print_preview/native_layer.js
|
| @@ -71,6 +71,7 @@ cr.define('print_preview', function() {
|
| this.onProvisionalDestinationResolved_.bind(this);
|
| global.failedToResolveProvisionalPrinter =
|
| this.failedToResolveProvisionalDestination_.bind(this);
|
| + global.onPrinterSetup = this.onPrinterSetupResolved_.bind(this);
|
| };
|
|
|
| /**
|
| @@ -111,7 +112,8 @@ cr.define('print_preview', function() {
|
| 'print_preview.NativeLayer.EXTENSION_CAPABILITIES_SET',
|
| PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS',
|
| PROVISIONAL_DESTINATION_RESOLVED:
|
| - 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED'
|
| + 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED',
|
| + PRINTER_SETUP: 'print_preview.NativeLayer.PRINTER_SETUP'
|
| };
|
|
|
| /**
|
| @@ -232,6 +234,14 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| + * Requests that Chrome peform printer setup for the given printer.
|
| + * @param {string} printerId
|
| + */
|
| + setupPrinter: function(printerId) {
|
| + chrome.send('setupPrinter', [printerId]);
|
| + },
|
| +
|
| + /**
|
| * @param {!print_preview.Destination} destination Destination to print to.
|
| * @param {!print_preview.ticket_items.Color} color Color ticket item.
|
| * @return {number} Native layer color model.
|
| @@ -837,6 +847,22 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| + * Called when printer setup has been completed.
|
| + * @param {string} printerId The id of the printer in the backend.
|
| + * @param {boolean} success True if the setup was successful.
|
| + * @param {Object} capabilities A capabilities object suitable for
|
| + * Destination.capabilities.
|
| + * @private
|
| + */
|
| + onPrinterSetupResolved_: function(printerId, success, capabilities) {
|
| + var evt = new Event(NativeLayer.EventType.PRINTER_SETUP);
|
| + evt.printerId = printerId;
|
| + evt.success = success;
|
| + evt.capabilities = capabilities;
|
| + this.dispatchEvent(evt);
|
| + },
|
| +
|
| + /**
|
| * Called when Chrome reports that a provisional destination has been
|
| * successfully resolved.
|
| * Currently used only for extension provided destinations.
|
|
|