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

Side by Side 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 unified diff | Download patch
OLDNEW
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
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} */
dpapad 2017/05/19 20:59:29 ?print_preview.NativeLayer
rbpotter 2017/05/20 00:43:59 Done.
84 var currentInstance = null;
85
86 /**
87 * @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.
88 * Creates a new NativeLayer if the current instance is not set.
89 */
90 NativeLayer.getInstance = function() {
91 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.
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
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 });
OLDNEW
« 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