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.exportPath('print_preview'); | 5 cr.exportPath('print_preview'); |
6 | 6 |
7 /** | 7 /** |
8 * @typedef {{selectSaveAsPdfDestination: boolean, | 8 * @typedef {{selectSaveAsPdfDestination: boolean, |
9 * layoutSettings.portrait: boolean, | 9 * layoutSettings.portrait: boolean, |
10 * pageRange: string, | 10 * pageRange: string, |
(...skipping 11 matching lines...) Expand all Loading... | |
22 * printerDescription: (string | undefined), | 22 * printerDescription: (string | undefined), |
23 * cupsEnterprisePrinter: (boolean | undefined), | 23 * cupsEnterprisePrinter: (boolean | undefined), |
24 * printerOptions: (Object | undefined), | 24 * printerOptions: (Object | undefined), |
25 * }} | 25 * }} |
26 */ | 26 */ |
27 print_preview.LocalDestinationInfo; | 27 print_preview.LocalDestinationInfo; |
28 | 28 |
29 /** | 29 /** |
30 * @typedef {{ | 30 * @typedef {{ |
31 * printerId: string, | 31 * printerId: string, |
32 * printerName: string, | |
33 * printerDescription: string, | |
34 * cupsEnterprisePrinter: (boolean | undefined), | |
35 * capabilities: print_preview.Cdd, | |
36 * }} | |
37 */ | |
38 print_preview.PrinterCapabilitiesResponse; | |
39 | |
40 /** | |
41 * @typedef {{ | |
42 * printerId: string, | |
32 * success: boolean, | 43 * success: boolean, |
33 * capabilities: Object, | 44 * capabilities: Object, |
34 * }} | 45 * }} |
35 */ | 46 */ |
36 print_preview.PrinterSetupResponse; | 47 print_preview.PrinterSetupResponse; |
37 | 48 |
38 cr.define('print_preview', function() { | 49 cr.define('print_preview', function() { |
39 'use strict'; | 50 'use strict'; |
40 | 51 |
41 /** | 52 /** |
42 * An interface to the native Chromium printing system layer. | 53 * An interface to the native Chromium printing system layer. |
43 * @constructor | 54 * @constructor |
44 */ | 55 */ |
45 function NativeLayer() { | 56 function NativeLayer() { |
46 // Bind global handlers | 57 // Bind global handlers |
47 global.setUseCloudPrint = this.onSetUseCloudPrint_.bind(this); | 58 global.setUseCloudPrint = this.onSetUseCloudPrint_.bind(this); |
48 global.updateWithPrinterCapabilities = | |
49 this.onUpdateWithPrinterCapabilities_.bind(this); | |
50 global.failedToGetPrinterCapabilities = | |
51 this.onFailedToGetPrinterCapabilities_.bind(this); | |
52 global.failedToGetPrivetPrinterCapabilities = | |
53 this.onFailedToGetPrivetPrinterCapabilities_.bind(this); | |
54 global.failedToGetExtensionPrinterCapabilities = | |
55 this.onFailedToGetExtensionPrinterCapabilities_.bind(this); | |
56 global.reloadPrintersList = this.onReloadPrintersList_.bind(this); | 59 global.reloadPrintersList = this.onReloadPrintersList_.bind(this); |
57 global.printToCloud = this.onPrintToCloud_.bind(this); | 60 global.printToCloud = this.onPrintToCloud_.bind(this); |
58 global.fileSelectionCancelled = | 61 global.fileSelectionCancelled = |
59 this.onFileSelectionCancelled_.bind(this); | 62 this.onFileSelectionCancelled_.bind(this); |
60 global.fileSelectionCompleted = | 63 global.fileSelectionCompleted = |
61 this.onFileSelectionCompleted_.bind(this); | 64 this.onFileSelectionCompleted_.bind(this); |
62 global.printPreviewFailed = this.onPrintPreviewFailed_.bind(this); | 65 global.printPreviewFailed = this.onPrintPreviewFailed_.bind(this); |
63 global.invalidPrinterSettings = | 66 global.invalidPrinterSettings = |
64 this.onInvalidPrinterSettings_.bind(this); | 67 this.onInvalidPrinterSettings_.bind(this); |
65 global.onDidGetDefaultPageLayout = | 68 global.onDidGetDefaultPageLayout = |
66 this.onDidGetDefaultPageLayout_.bind(this); | 69 this.onDidGetDefaultPageLayout_.bind(this); |
67 global.onDidGetPreviewPageCount = | 70 global.onDidGetPreviewPageCount = |
68 this.onDidGetPreviewPageCount_.bind(this); | 71 this.onDidGetPreviewPageCount_.bind(this); |
69 global.onDidPreviewPage = this.onDidPreviewPage_.bind(this); | 72 global.onDidPreviewPage = this.onDidPreviewPage_.bind(this); |
70 global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this); | 73 global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this); |
71 global.onDidGetAccessToken = this.onDidGetAccessToken_.bind(this); | 74 global.onDidGetAccessToken = this.onDidGetAccessToken_.bind(this); |
72 global.onPrivetCapabilitiesSet = | |
73 this.onPrivetCapabilitiesSet_.bind(this); | |
74 global.onPrivetPrintFailed = this.onPrivetPrintFailed_.bind(this); | 75 global.onPrivetPrintFailed = this.onPrivetPrintFailed_.bind(this); |
75 global.onExtensionCapabilitiesSet = | |
76 this.onExtensionCapabilitiesSet_.bind(this); | |
77 global.onEnableManipulateSettingsForTest = | 76 global.onEnableManipulateSettingsForTest = |
78 this.onEnableManipulateSettingsForTest_.bind(this); | 77 this.onEnableManipulateSettingsForTest_.bind(this); |
79 global.printPresetOptionsFromDocument = | 78 global.printPresetOptionsFromDocument = |
80 this.onPrintPresetOptionsFromDocument_.bind(this); | 79 this.onPrintPresetOptionsFromDocument_.bind(this); |
81 global.onProvisionalPrinterResolved = | 80 global.onProvisionalPrinterResolved = |
82 this.onProvisionalDestinationResolved_.bind(this); | 81 this.onProvisionalDestinationResolved_.bind(this); |
83 global.failedToResolveProvisionalPrinter = | 82 global.failedToResolveProvisionalPrinter = |
84 this.failedToResolveProvisionalDestination_.bind(this); | 83 this.failedToResolveProvisionalDestination_.bind(this); |
85 | 84 |
86 /** @private {!cr.EventTarget} */ | 85 /** @private {!cr.EventTarget} */ |
(...skipping 21 matching lines...) Expand all Loading... | |
108 currentInstance = instance; | 107 currentInstance = instance; |
109 }; | 108 }; |
110 | 109 |
111 /** | 110 /** |
112 * Event types dispatched from the Chromium native layer. | 111 * Event types dispatched from the Chromium native layer. |
113 * @enum {string} | 112 * @enum {string} |
114 * @const | 113 * @const |
115 */ | 114 */ |
116 NativeLayer.EventType = { | 115 NativeLayer.EventType = { |
117 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', | 116 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', |
118 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', | |
119 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', | 117 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', |
120 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', | 118 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', |
121 DISABLE_SCALING: 'print_preview.NativeLayer.DISABLE_SCALING', | 119 DISABLE_SCALING: 'print_preview.NativeLayer.DISABLE_SCALING', |
122 FILE_SELECTION_CANCEL: 'print_preview.NativeLayer.FILE_SELECTION_CANCEL', | 120 FILE_SELECTION_CANCEL: 'print_preview.NativeLayer.FILE_SELECTION_CANCEL', |
123 FILE_SELECTION_COMPLETE: | 121 FILE_SELECTION_COMPLETE: |
124 'print_preview.NativeLayer.FILE_SELECTION_COMPLETE', | 122 'print_preview.NativeLayer.FILE_SELECTION_COMPLETE', |
125 GET_CAPABILITIES_FAIL: 'print_preview.NativeLayer.GET_CAPABILITIES_FAIL', | |
126 MANIPULATE_SETTINGS_FOR_TEST: | 123 MANIPULATE_SETTINGS_FOR_TEST: |
127 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', | 124 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', |
128 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', | 125 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', |
129 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', | 126 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', |
130 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', | 127 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', |
131 PREVIEW_GENERATION_DONE: | 128 PREVIEW_GENERATION_DONE: |
132 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', | 129 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', |
133 PREVIEW_GENERATION_FAIL: | 130 PREVIEW_GENERATION_FAIL: |
134 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', | 131 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', |
135 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', | 132 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', |
136 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', | 133 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', |
137 PRIVET_PRINTER_CHANGED: 'print_preview.NativeLayer.PRIVET_PRINTER_CHANGED', | |
138 PRIVET_CAPABILITIES_SET: | |
139 'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', | |
140 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', | 134 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', |
141 EXTENSION_CAPABILITIES_SET: | |
142 'print_preview.NativeLayer.EXTENSION_CAPABILITIES_SET', | |
143 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', | 135 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', |
144 PROVISIONAL_DESTINATION_RESOLVED: | 136 PROVISIONAL_DESTINATION_RESOLVED: |
145 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' | 137 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' |
146 }; | 138 }; |
147 | 139 |
148 /** | 140 /** |
149 * Constant values matching printing::DuplexMode enum. | 141 * Constant values matching printing::DuplexMode enum. |
150 * @enum {number} | 142 * @enum {number} |
151 */ | 143 */ |
152 NativeLayer.DuplexMode = { | 144 NativeLayer.DuplexMode = { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 * Requests the network's privet print destinations. After this is called, | 226 * Requests the network's privet print destinations. After this is called, |
235 * a number of privet-printer-changed events may be fired. | 227 * a number of privet-printer-changed events may be fired. |
236 * @return {!Promise} Resolves when privet printer search is completed. | 228 * @return {!Promise} Resolves when privet printer search is completed. |
237 * Rejected if privet printers are not enabled. | 229 * Rejected if privet printers are not enabled. |
238 */ | 230 */ |
239 getPrivetPrinters: function() { | 231 getPrivetPrinters: function() { |
240 return cr.sendWithPromise('getPrivetPrinters'); | 232 return cr.sendWithPromise('getPrivetPrinters'); |
241 }, | 233 }, |
242 | 234 |
243 /** | 235 /** |
244 * Requests the privet destination's printing capabilities. A | |
245 * PRIVET_CAPABILITIES_SET event will be dispatched in response. | |
246 * @param {string} destinationId ID of the destination. | |
247 */ | |
248 startGetPrivetDestinationCapabilities: function(destinationId) { | |
249 chrome.send('getPrivetPrinterCapabilities', [destinationId]); | |
250 }, | |
251 | |
252 /** | |
253 * Request a list of extension printers. Printers are reported as they are | 236 * Request a list of extension printers. Printers are reported as they are |
254 * found by a series of 'extension-printers-added' events. | 237 * found by a series of 'extension-printers-added' events. |
255 * @return {!Promise} Will be resolved when all extension managed printers | 238 * @return {!Promise} Will be resolved when all extension managed printers |
256 * have been sent. | 239 * have been sent. |
257 */ | 240 */ |
258 getExtensionPrinters: function() { | 241 getExtensionPrinters: function() { |
259 return cr.sendWithPromise('getExtensionPrinters'); | 242 return cr.sendWithPromise('getExtensionPrinters'); |
260 }, | 243 }, |
261 | 244 |
262 /** | 245 /** |
263 * Requests an extension destination's printing capabilities. A | 246 * Requests the destination's printing capabilities. Returns a promise that |
264 * EXTENSION_CAPABILITIES_SET event will be dispatched in response. | 247 * will be resolved with the capabilities if they are obtained successfully. |
265 * @param {string} destinationId The ID of the destination whose | 248 * @param {string} destinationId ID of the destination. |
266 * capabilities are requested. | 249 * @return {!Promise<print_preview.PrinterCapabilitiesResponse>} |
dpapad
2017/06/09 17:59:11
Can this be more specific?
!Promise<!print_previe
rbpotter
2017/06/14 03:55:07
Done.
| |
267 */ | 250 */ |
268 startGetExtensionDestinationCapabilities: function(destinationId) { | 251 getPrinterCapabilities: function(destinationId) { |
269 chrome.send('getExtensionPrinterCapabilities', [destinationId]); | 252 return cr.sendWithPromise('getPrinterCapabilities', destinationId); |
270 }, | 253 }, |
271 | 254 |
272 /** | 255 /** |
273 * Requests the destination's printing capabilities. A CAPABILITIES_SET | 256 * Requests the privet destination's printing capabilities. Returns a |
274 * event will be dispatched in response. | 257 * promise that will be resolved with capabilities and printer information |
258 * if capabilities are obtained successfully. | |
275 * @param {string} destinationId ID of the destination. | 259 * @param {string} destinationId ID of the destination. |
260 * @return {!Promise<{"printer": !Object, | |
dpapad
2017/06/09 17:59:11
I don't recall needing to add double quotes within
rbpotter
2017/06/14 03:55:07
Done.
| |
261 * "capabilities": !print_preview.Cdd}>} | |
276 */ | 262 */ |
277 startGetLocalDestinationCapabilities: function(destinationId) { | 263 getPrivetPrinterCapabilities: function(destinationId) { |
278 chrome.send('getPrinterCapabilities', [destinationId]); | 264 return cr.sendWithPromise('getPrivetPrinterCapabilities', destinationId); |
279 }, | 265 }, |
280 | 266 |
281 /** | 267 /** |
268 * Requests the extension destination's printing capabilities. Returns a | |
269 * promise that will be resolved with the ID and capabilities if | |
270 * capabilities are obtained successfully. | |
271 * @param {string} destinationId The ID of the destination whose | |
272 * capabilities are requested. | |
273 * @return {!Promise<{"printerId": string, | |
274 * "capabilities": !print_preview.Cdd}>} | |
275 */ | |
276 getExtensionPrinterCapabilities: function(destinationId) { | |
277 return cr.sendWithPromise('getExtensionPrinterCapabilities', | |
278 destinationId); | |
279 }, | |
280 | |
281 /** | |
282 * Requests Chrome to resolve provisional extension destination by granting | 282 * Requests Chrome to resolve provisional extension destination by granting |
283 * the provider extension access to the printer. Chrome will respond with | 283 * the provider extension access to the printer. Chrome will respond with |
284 * the resolved destination properties by calling | 284 * the resolved destination properties by calling |
285 * {@code onProvisionalPrinterResolved}, or in case of an error | 285 * {@code onProvisionalPrinterResolved}, or in case of an error |
286 * {@code failedToResolveProvisionalPrinter} | 286 * {@code failedToResolveProvisionalPrinter} |
287 * @param {string} provisionalDestinationId | 287 * @param {string} provisionalDestinationId |
288 */ | 288 */ |
289 grantExtensionPrinterAccess: function(provisionalDestinationId) { | 289 grantExtensionPrinterAccess: function(provisionalDestinationId) { |
290 chrome.send('grantExtensionPrinterAccess', [provisionalDestinationId]); | 290 chrome.send('grantExtensionPrinterAccess', [provisionalDestinationId]); |
291 }, | 291 }, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 * @private | 542 * @private |
543 */ | 543 */ |
544 onSetUseCloudPrint_: function(settings) { | 544 onSetUseCloudPrint_: function(settings) { |
545 var cloudPrintEnableEvent = new Event( | 545 var cloudPrintEnableEvent = new Event( |
546 NativeLayer.EventType.CLOUD_PRINT_ENABLE); | 546 NativeLayer.EventType.CLOUD_PRINT_ENABLE); |
547 cloudPrintEnableEvent.baseCloudPrintUrl = settings['cloudPrintUrl'] || ''; | 547 cloudPrintEnableEvent.baseCloudPrintUrl = settings['cloudPrintUrl'] || ''; |
548 cloudPrintEnableEvent.appKioskMode = settings['appKioskMode'] || false; | 548 cloudPrintEnableEvent.appKioskMode = settings['appKioskMode'] || false; |
549 this.eventTarget_.dispatchEvent(cloudPrintEnableEvent); | 549 this.eventTarget_.dispatchEvent(cloudPrintEnableEvent); |
550 }, | 550 }, |
551 | 551 |
552 /** | |
553 * Called when native layer gets settings information for a requested local | |
554 * destination. | |
555 * @param {Object} settingsInfo printer setting information. | |
556 * @private | |
557 */ | |
558 onUpdateWithPrinterCapabilities_: function(settingsInfo) { | |
559 assert(settingsInfo.capabilities, | |
560 'Capabilities update without capabilites'); | |
561 var capsSetEvent = new Event(NativeLayer.EventType.CAPABILITIES_SET); | |
562 capsSetEvent.settingsInfo = settingsInfo; | |
563 this.eventTarget_.dispatchEvent(capsSetEvent); | |
564 }, | |
565 | |
566 /** | |
567 * Called when native layer gets settings information for a requested local | |
568 * destination. | |
569 * @param {string} destinationId Printer affected by error. | |
570 * @private | |
571 */ | |
572 onFailedToGetPrinterCapabilities_: function(destinationId) { | |
573 var getCapsFailEvent = new Event( | |
574 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | |
575 getCapsFailEvent.destinationId = destinationId; | |
576 getCapsFailEvent.destinationOrigin = | |
577 print_preview.DestinationOrigin.LOCAL; | |
578 this.eventTarget_.dispatchEvent(getCapsFailEvent); | |
579 }, | |
580 | |
581 /** | |
582 * Called when native layer gets settings information for a requested privet | |
583 * destination. | |
584 * @param {string} destinationId Printer affected by error. | |
585 * @private | |
586 */ | |
587 onFailedToGetPrivetPrinterCapabilities_: function(destinationId) { | |
588 var getCapsFailEvent = new Event( | |
589 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | |
590 getCapsFailEvent.destinationId = destinationId; | |
591 getCapsFailEvent.destinationOrigin = | |
592 print_preview.DestinationOrigin.PRIVET; | |
593 this.eventTarget_.dispatchEvent(getCapsFailEvent); | |
594 }, | |
595 | |
596 /** | |
597 * Called when native layer fails to get settings information for a | |
598 * requested extension destination. | |
599 * @param {string} destinationId Printer affected by error. | |
600 * @private | |
601 */ | |
602 onFailedToGetExtensionPrinterCapabilities_: function(destinationId) { | |
603 var getCapsFailEvent = new Event( | |
604 NativeLayer.EventType.GET_CAPABILITIES_FAIL); | |
605 getCapsFailEvent.destinationId = destinationId; | |
606 getCapsFailEvent.destinationOrigin = | |
607 print_preview.DestinationOrigin.EXTENSION; | |
608 this.eventTarget_.dispatchEvent(getCapsFailEvent); | |
609 }, | |
610 | |
611 /** Reloads the printer list. */ | 552 /** Reloads the printer list. */ |
612 onReloadPrintersList_: function() { | 553 onReloadPrintersList_: function() { |
613 cr.dispatchSimpleEvent(this.eventTarget_, | 554 cr.dispatchSimpleEvent(this.eventTarget_, |
614 NativeLayer.EventType.DESTINATIONS_RELOAD); | 555 NativeLayer.EventType.DESTINATIONS_RELOAD); |
615 }, | 556 }, |
616 | 557 |
617 /** | 558 /** |
618 * Called from the C++ layer. | 559 * Called from the C++ layer. |
619 * Take the PDF data handed to us and submit it to the cloud, closing the | 560 * Take the PDF data handed to us and submit it to the cloud, closing the |
620 * print preview dialog once the upload is successful. | 561 * print preview dialog once the upload is successful. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 * @private | 708 * @private |
768 */ | 709 */ |
769 onPrintPresetOptionsFromDocument_: function(options) { | 710 onPrintPresetOptionsFromDocument_: function(options) { |
770 var printPresetOptionsEvent = new Event( | 711 var printPresetOptionsEvent = new Event( |
771 NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 712 NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
772 printPresetOptionsEvent.optionsFromDocument = options; | 713 printPresetOptionsEvent.optionsFromDocument = options; |
773 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); | 714 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); |
774 }, | 715 }, |
775 | 716 |
776 /** | 717 /** |
777 * @param {Object} printer Specifies information about the printer that was | |
778 * added. | |
779 * @private | |
780 */ | |
781 onPrivetCapabilitiesSet_: function(printer, capabilities) { | |
782 var privetCapabilitiesSetEvent = | |
783 new Event(NativeLayer.EventType.PRIVET_CAPABILITIES_SET); | |
784 privetCapabilitiesSetEvent.printer = printer; | |
785 privetCapabilitiesSetEvent.capabilities = capabilities; | |
786 this.eventTarget_.dispatchEvent(privetCapabilitiesSetEvent); | |
787 }, | |
788 | |
789 /** | |
790 * @param {string} http_error The HTTP response code or -1 if not an HTTP | 718 * @param {string} http_error The HTTP response code or -1 if not an HTTP |
791 * error. | 719 * error. |
792 * @private | 720 * @private |
793 */ | 721 */ |
794 onPrivetPrintFailed_: function(http_error) { | 722 onPrivetPrintFailed_: function(http_error) { |
795 var privetPrintFailedEvent = | 723 var privetPrintFailedEvent = |
796 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); | 724 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); |
797 privetPrintFailedEvent.httpError = http_error; | 725 privetPrintFailedEvent.httpError = http_error; |
798 this.eventTarget_.dispatchEvent(privetPrintFailedEvent); | 726 this.eventTarget_.dispatchEvent(privetPrintFailedEvent); |
799 }, | 727 }, |
800 | 728 |
801 /** | 729 /** |
802 * Called when an extension responds to a request for an extension printer | |
803 * capabilities. | |
804 * @param {string} printerId The printer's ID. | |
805 * @param {!Object} capabilities The reported printer capabilities. | |
806 */ | |
807 onExtensionCapabilitiesSet_: function(printerId, | |
808 capabilities) { | |
809 var event = new Event(NativeLayer.EventType.EXTENSION_CAPABILITIES_SET); | |
810 event.printerId = printerId; | |
811 event.capabilities = capabilities; | |
812 this.eventTarget_.dispatchEvent(event); | |
813 }, | |
814 | |
815 /** | |
816 * Called when Chrome reports that attempt to resolve a provisional | 730 * Called when Chrome reports that attempt to resolve a provisional |
817 * destination failed. | 731 * destination failed. |
818 * @param {string} destinationId The provisional destination ID. | 732 * @param {string} destinationId The provisional destination ID. |
819 * @private | 733 * @private |
820 */ | 734 */ |
821 failedToResolveProvisionalDestination_: function(destinationId) { | 735 failedToResolveProvisionalDestination_: function(destinationId) { |
822 var evt = new Event( | 736 var evt = new Event( |
823 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); | 737 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); |
824 evt.provisionalId = destinationId; | 738 evt.provisionalId = destinationId; |
825 evt.destination = null; | 739 evt.destination = null; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 return this.serializedDefaultDestinationSelectionRulesStr_; | 987 return this.serializedDefaultDestinationSelectionRulesStr_; |
1074 } | 988 } |
1075 }; | 989 }; |
1076 | 990 |
1077 // Export | 991 // Export |
1078 return { | 992 return { |
1079 NativeInitialSettings: NativeInitialSettings, | 993 NativeInitialSettings: NativeInitialSettings, |
1080 NativeLayer: NativeLayer | 994 NativeLayer: NativeLayer |
1081 }; | 995 }; |
1082 }); | 996 }); |
OLD | NEW |