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 19a5231930c9556349d757bbbf3be6fe026c2422..3e513c979cd09eb1c05313ad424afdb92792b6a4 100644 |
| --- a/chrome/browser/resources/print_preview/native_layer.js |
| +++ b/chrome/browser/resources/print_preview/native_layer.js |
| @@ -80,6 +80,27 @@ cr.define('print_preview', function() { |
| this.eventTarget_ = new cr.EventTarget(); |
| } |
| + /** @private {print_preview.NativeLayer} */ |
|
dpapad
2017/05/19 20:59:29
?print_preview.NativeLayer
rbpotter
2017/05/20 00:43:59
Done.
|
| + var currentInstance = null; |
| + |
| + /** |
| + * @return {!print_preview.NativeLayer} an instance of NativeLayer. |
|
dpapad
2017/05/19 20:59:29
Nit:
"an instance of NativeLayer." -> "The singlet
rbpotter
2017/05/20 00:43:59
Done.
|
| + * Creates a new NativeLayer if the current instance is not set. |
| + */ |
| + NativeLayer.getInstance = function() { |
| + if (currentInstance) |
|
dpapad
2017/05/19 20:59:29
This condition should be reversed I think. Also le
rbpotter
2017/05/20 00:43:59
Done.
|
| + currentInstance = new NativeLayer(); |
| + return assert(currentInstance); |
| + }; |
| + |
| + /** |
| + * @param {!print_preview.NativeLayer} instance The NativeLayer instance |
| + * to set for print preview construction. |
| + */ |
| + NativeLayer.setInstance = function(instance) { |
| + currentInstance = instance; |
| + }; |
| + |
| /** |
| * Event types dispatched from the Chromium native layer. |
| * @enum {string} |