Chromium Code Reviews| 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 c005fbfa041e2fa9792943260f8243c51c3a17aa..c79a6ecf0d3f399c6104575c2037e9e082f2b32c 100644 |
| --- a/chrome/browser/resources/print_preview/native_layer.js |
| +++ b/chrome/browser/resources/print_preview/native_layer.js |
| @@ -48,6 +48,7 @@ cr.define('print_preview', function() { |
| this.onPrivetPrinterSearchDone_.bind(this); |
| global['onPrivetCapabilitiesSet'] = |
| this.onPrivetCapabilitiesSet_.bind(this); |
| + global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); |
| }; |
| /** |
| @@ -81,7 +82,8 @@ cr.define('print_preview', function() { |
| PRIVET_PRINTER_SEARCH_DONE: |
| 'print_preview.NativeLayer.PRIVET_PRINTER_SEARCH_DONE', |
| PRIVET_CAPABILITIES_SET: |
| - 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET' |
| + 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', |
| + PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED' |
| }; |
| /** |
| @@ -273,6 +275,7 @@ cr.define('print_preview', function() { |
| 'printToPDF': destination.id == |
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, |
| 'printWithCloudPrint': !destination.isLocal, |
| + 'printWithPrivet': destination.isPrivet, |
| 'deviceName': destination.id, |
| 'isFirstRequest': false, |
| 'requestID': -1, |
| @@ -300,6 +303,10 @@ cr.define('print_preview', function() { |
| }; |
| } |
| + if (destination.isPrivet) { |
| + ticket['ticket'] = printTicketStore.createPrintTicket(destination); |
| + } |
| + |
| if (opt_isOpenPdfInPreview) { |
| ticket['OpenPDFInPreview'] = true; |
| } |
| @@ -351,7 +358,7 @@ cr.define('print_preview', function() { |
| /** Navigates the user to the Google Cloud Print management page. */ |
| startManageCloudDestinations: function() { |
| chrome.send('manageCloudPrinters'); |
|
Vitaly Buka (NO REVIEWS)
2013/11/06 07:45:51
remove space
Noam Samuel
2013/11/06 18:43:55
Done.
|
| - }, |
| + }, |
| /** Forces browser to open a new tab with the given URL address. */ |
| startForceOpenNewTab: function(url) { |
| @@ -670,6 +677,17 @@ cr.define('print_preview', function() { |
| privetCapabilitiesSetEvent.printer = printer; |
| privetCapabilitiesSetEvent.capabilities = capabilities; |
| this.dispatchEvent(privetCapabilitiesSetEvent); |
| + }, |
| + |
| + /** |
| + * @param {number} http_error HTTP Error code for the privet local error. |
| + * @private |
| + */ |
| + onPrivetPrintFailed_: function(http_error) { |
| + var privetPrintFailedEvent = new Event( |
| + NativeLayer.EventType.PRIVET_PRINT_FAILED); |
| + privetPrintFailedEvent.http_error = http_error; |
| + this.dispatchEvent(privetPrintFailedEvent); |
| } |
| }; |