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', | |
155 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', | 153 PRINT_PRESET_OPTIONS: 'print_preview.NativeLayer.PRINT_PRESET_OPTIONS', |
156 PROVISIONAL_DESTINATION_RESOLVED: | 154 PROVISIONAL_DESTINATION_RESOLVED: |
157 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' | 155 'print_preview.NativeLayer.PROVISIONAL_DESTINATION_RESOLVED' |
158 }; | 156 }; |
159 | 157 |
160 /** | 158 /** |
161 * Constant values matching printing::DuplexMode enum. | 159 * Constant values matching printing::DuplexMode enum. |
162 * @enum {number} | 160 * @enum {number} |
163 */ | 161 */ |
164 NativeLayer.DuplexMode = { | 162 NativeLayer.DuplexMode = { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 * @private | 724 * @private |
727 */ | 725 */ |
728 onPrintPresetOptionsFromDocument_: function(options) { | 726 onPrintPresetOptionsFromDocument_: function(options) { |
729 var printPresetOptionsEvent = new Event( | 727 var printPresetOptionsEvent = new Event( |
730 NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 728 NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
731 printPresetOptionsEvent.optionsFromDocument = options; | 729 printPresetOptionsEvent.optionsFromDocument = options; |
732 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); | 730 this.eventTarget_.dispatchEvent(printPresetOptionsEvent); |
733 }, | 731 }, |
734 | 732 |
735 /** | 733 /** |
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 | 734 * Called when Chrome reports that attempt to resolve a provisional |
749 * destination failed. | 735 * destination failed. |
750 * @param {string} destinationId The provisional destination ID. | 736 * @param {string} destinationId The provisional destination ID. |
751 * @private | 737 * @private |
752 */ | 738 */ |
753 failedToResolveProvisionalDestination_: function(destinationId) { | 739 failedToResolveProvisionalDestination_: function(destinationId) { |
754 var evt = new Event( | 740 var evt = new Event( |
755 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); | 741 NativeLayer.EventType.PROVISIONAL_DESTINATION_RESOLVED); |
756 evt.provisionalId = destinationId; | 742 evt.provisionalId = destinationId; |
757 evt.destination = null; | 743 evt.destination = null; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 return this.serializedDefaultDestinationSelectionRulesStr_; | 991 return this.serializedDefaultDestinationSelectionRulesStr_; |
1006 } | 992 } |
1007 }; | 993 }; |
1008 | 994 |
1009 // Export | 995 // Export |
1010 return { | 996 return { |
1011 NativeInitialSettings: NativeInitialSettings, | 997 NativeInitialSettings: NativeInitialSettings, |
1012 NativeLayer: NativeLayer | 998 NativeLayer: NativeLayer |
1013 }; | 999 }; |
1014 }); | 1000 }); |
OLD | NEW |