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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 global.printPreviewFailed = this.onPrintPreviewFailed_.bind(this); | 85 global.printPreviewFailed = this.onPrintPreviewFailed_.bind(this); |
86 global.invalidPrinterSettings = | 86 global.invalidPrinterSettings = |
87 this.onInvalidPrinterSettings_.bind(this); | 87 this.onInvalidPrinterSettings_.bind(this); |
88 global.onDidGetDefaultPageLayout = | 88 global.onDidGetDefaultPageLayout = |
89 this.onDidGetDefaultPageLayout_.bind(this); | 89 this.onDidGetDefaultPageLayout_.bind(this); |
90 global.onDidGetPreviewPageCount = | 90 global.onDidGetPreviewPageCount = |
91 this.onDidGetPreviewPageCount_.bind(this); | 91 this.onDidGetPreviewPageCount_.bind(this); |
92 global.onDidPreviewPage = this.onDidPreviewPage_.bind(this); | 92 global.onDidPreviewPage = this.onDidPreviewPage_.bind(this); |
93 global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this); | 93 global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this); |
94 global.onDidGetAccessToken = this.onDidGetAccessToken_.bind(this); | 94 global.onDidGetAccessToken = this.onDidGetAccessToken_.bind(this); |
95 global.onPrivetPrintFailed = this.onPrivetPrintFailed_.bind(this); | |
96 global.onEnableManipulateSettingsForTest = | 95 global.onEnableManipulateSettingsForTest = |
97 this.onEnableManipulateSettingsForTest_.bind(this); | 96 this.onEnableManipulateSettingsForTest_.bind(this); |
98 global.printPresetOptionsFromDocument = | 97 global.printPresetOptionsFromDocument = |
99 this.onPrintPresetOptionsFromDocument_.bind(this); | 98 this.onPrintPresetOptionsFromDocument_.bind(this); |
100 global.onProvisionalPrinterResolved = | 99 global.onProvisionalPrinterResolved = |
101 this.onProvisionalDestinationResolved_.bind(this); | 100 this.onProvisionalDestinationResolved_.bind(this); |
102 global.failedToResolveProvisionalPrinter = | 101 global.failedToResolveProvisionalPrinter = |
103 this.failedToResolveProvisionalDestination_.bind(this); | 102 this.failedToResolveProvisionalDestination_.bind(this); |
104 | 103 |
105 /** @private {!cr.EventTarget} */ | 104 /** @private {!cr.EventTarget} */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', | 143 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST', |
145 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', | 144 PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', |
146 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', | 145 PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', |
147 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', | 146 PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', |
148 PREVIEW_GENERATION_DONE: | 147 PREVIEW_GENERATION_DONE: |
149 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', | 148 'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', |
150 PREVIEW_GENERATION_FAIL: | 149 PREVIEW_GENERATION_FAIL: |
151 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', | 150 'print_preview.NativeLayer.PREVIEW_GENERATION_FAIL', |
152 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', | 151 PRINT_TO_CLOUD: 'print_preview.NativeLayer.PRINT_TO_CLOUD', |
153 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', | 152 SETTINGS_INVALID: 'print_preview.NativeLayer.SETTINGS_INVALID', |
154 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', | 153 PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', |
dpapad
2017/06/14 20:52:45
Is this still needed?
rbpotter
2017/06/14 22:52:55
No, removed.
| |
155 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', | 154 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', |
156 PROVISIONAL_DESTINATION_RESOLVED: | 155 PROVISIONAL_DESTINATION_RESOLVED: |
157 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' | 156 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' |
158 }; | 157 }; |
159 | 158 |
160 /** | 159 /** |
161 * Constant values matching printing::DuplexMode enum. | 160 * Constant values matching printing::DuplexMode enum. |
162 * @enum {number} | 161 * @enum {number} |
163 */ | 162 */ |
164 NativeLayer.DuplexMode = { | 163 NativeLayer.DuplexMode = { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 * @private | 725 * @private |
727 */ | 726 */ |
728 onPrintPresetOptionsFromDocument_: function(options) { | 727 onPrintPresetOptionsFromDocument_: function(options) { |
729 var printPresetOptionsEvent = new Event( | 728 var printPresetOptionsEvent = new Event( |
730 NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 729 NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
731 printPresetOptionsEvent.optionsFromDocument = options; | 730 printPresetOptionsEvent.optionsFromDocument = options; |
732 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); | 731 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); |
733 }, | 732 }, |
734 | 733 |
735 /** | 734 /** |
736 * @param {string} http_error The HTTP response code or -1 if not an HTTP | |
737 * error. | |
738 * @private | |
739 */ | |
740 onPrivetPrintFailed_: function(http_error) { | |
741 var privetPrintFailedEvent = | |
742 new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); | |
743 privetPrintFailedEvent.httpError = http_error; | |
744 this.eventTarget_.dispatchEvent(privetPrintFailedEvent); | |
745 }, | |
746 | |
747 /** | |
748 * Called when Chrome reports that attempt to resolve a provisional | 735 * Called when Chrome reports that attempt to resolve a provisional |
749 * destination failed. | 736 * destination failed. |
750 * @param {string} destinationId The provisional destination ID. | 737 * @param {string} destinationId The provisional destination ID. |
751 * @private | 738 * @private |
752 */ | 739 */ |
753 failedToResolveProvisionalDestination_: function(destinationId) { | 740 failedToResolveProvisionalDestination_: function(destinationId) { |
754 var evt = new Event( | 741 var evt = new Event( |
755 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); | 742 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); |
756 evt.provisionalId = destinationId; | 743 evt.provisionalId = destinationId; |
757 evt.destination = null; | 744 evt.destination = null; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1005 return this.serializedDefaultDestinationSelectionRulesStr_; | 992 return this.serializedDefaultDestinationSelectionRulesStr_; |
1006 } | 993 } |
1007 }; | 994 }; |
1008 | 995 |
1009 // Export | 996 // Export |
1010 return { | 997 return { |
1011 NativeInitialSettings: NativeInitialSettings, | 998 NativeInitialSettings: NativeInitialSettings, |
1012 NativeLayer: NativeLayer | 999 NativeLayer: NativeLayer |
1013 }; | 1000 }; |
1014 }); | 1001 }); |
OLD | NEW |