Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Unified Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 2893003003: Print Preview: Merge NativeLayerStubs for tests (Closed)
Patch Set: Remove extra variable Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d3a12f024adc6aeba9e64778c5ca921f472717ea 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} */
+ var currentInstance = null;
+
+ /**
+ * @return {!print_preview.NativeLayer} The singleton instance.
+ * Creates a new NativeLayer if the current instance is not set.
+ */
+ NativeLayer.getInstance = function() {
+ if (currentInstance == null)
+ 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}

Powered by Google App Engine
This is Rietveld 408576698