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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 this.onPrintPresetOptionsFromDocument_.bind(this); | 73 this.onPrintPresetOptionsFromDocument_.bind(this); |
74 global.onProvisionalPrinterResolved = | 74 global.onProvisionalPrinterResolved = |
75 this.onProvisionalDestinationResolved_.bind(this); | 75 this.onProvisionalDestinationResolved_.bind(this); |
76 global.failedToResolveProvisionalPrinter = | 76 global.failedToResolveProvisionalPrinter = |
77 this.failedToResolveProvisionalDestination_.bind(this); | 77 this.failedToResolveProvisionalDestination_.bind(this); |
78 | 78 |
79 /** @private {!cr.EventTarget} */ | 79 /** @private {!cr.EventTarget} */ |
80 this.eventTarget_ = new cr.EventTarget(); | 80 this.eventTarget_ = new cr.EventTarget(); |
81 } | 81 } |
82 | 82 |
| 83 /** @private {?print_preview.NativeLayer} */ |
| 84 var currentInstance = null; |
| 85 |
| 86 /** |
| 87 * @return {!print_preview.NativeLayer} The singleton instance. |
| 88 * Creates a new NativeLayer if the current instance is not set. |
| 89 */ |
| 90 NativeLayer.getInstance = function() { |
| 91 if (currentInstance == null) |
| 92 currentInstance = new NativeLayer(); |
| 93 return assert(currentInstance); |
| 94 }; |
| 95 |
| 96 /** |
| 97 * @param {!print_preview.NativeLayer} instance The NativeLayer instance |
| 98 * to set for print preview construction. |
| 99 */ |
| 100 NativeLayer.setInstance = function(instance) { |
| 101 currentInstance = instance; |
| 102 }; |
| 103 |
83 /** | 104 /** |
84 * Event types dispatched from the Chromium native layer. | 105 * Event types dispatched from the Chromium native layer. |
85 * @enum {string} | 106 * @enum {string} |
86 * @const | 107 * @const |
87 */ | 108 */ |
88 NativeLayer.EventType = { | 109 NativeLayer.EventType = { |
89 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', | 110 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', |
90 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', | 111 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', |
91 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', | 112 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', |
92 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', | 113 DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD', |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 return this.serializedDefaultDestinationSelectionRulesStr_; | 1116 return this.serializedDefaultDestinationSelectionRulesStr_; |
1096 } | 1117 } |
1097 }; | 1118 }; |
1098 | 1119 |
1099 // Export | 1120 // Export |
1100 return { | 1121 return { |
1101 NativeInitialSettings: NativeInitialSettings, | 1122 NativeInitialSettings: NativeInitialSettings, |
1102 NativeLayer: NativeLayer | 1123 NativeLayer: NativeLayer |
1103 }; | 1124 }; |
1104 }); | 1125 }); |
OLD | NEW |