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

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

Issue 2893003003: Print Preview: Merge NativeLayerStubs for tests (Closed)
Patch Set: Fix closure error 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..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}
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview.js » ('j') | chrome/test/data/webui/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698