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

Unified Diff: chrome/browser/resources/print_preview/data/destination_store.js

Issue 2975663003: Print Preview: Fix followup issues for removing global JS functions (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/invitation_store.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/data/destination_store.js
diff --git a/chrome/browser/resources/print_preview/data/destination_store.js b/chrome/browser/resources/print_preview/data/destination_store.js
index 700d0d3adbe71e7c6e6d9717cc439702a0962af4..0980850ed99ba780b1385ac6ddb7c0d43ab34f1e 100644
--- a/chrome/browser/resources/print_preview/data/destination_store.js
+++ b/chrome/browser/resources/print_preview/data/destination_store.js
@@ -12,10 +12,12 @@ cr.define('print_preview', function() {
* destinations.
* @param {!print_preview.UserInfo} userInfo User information repository.
* @param {!print_preview.AppState} appState Application state.
+ * @param {!WebUIListenerTracker} listenerTracker Tracker for WebUI listeners
+ * added in DestinationStore constructor.
* @constructor
* @extends {cr.EventTarget}
*/
- function DestinationStore(nativeLayer, userInfo, appState) {
+ function DestinationStore(nativeLayer, userInfo, appState, listenerTracker) {
cr.EventTarget.call(this);
/**
@@ -178,6 +180,8 @@ cr.define('print_preview', function() {
loadTimeData.getBoolean('useSystemDefaultPrinter');
this.reset_();
+
+ this.addWebUIEventListeners_(listenerTracker);
}
/**
@@ -549,8 +553,9 @@ cr.define('print_preview', function() {
* |listenerTracker|. |listenerTracker| is responsible for removing the
* listeners when necessary.
* @param {!WebUIListenerTracker} listenerTracker
+ * @private
*/
- addWebUIEventListeners: function(listenerTracker) {
+ addWebUIEventListeners_: function(listenerTracker) {
listenerTracker.add(
'privet-printer-added', this.onPrivetPrinterAdded_.bind(this));
listenerTracker.add(
@@ -879,6 +884,7 @@ cr.define('print_preview', function() {
* to set.
*/
setCloudPrintInterface: function(cloudPrintInterface) {
+ assert(this.cloudPrintInterface_ == null);
this.cloudPrintInterface_ = cloudPrintInterface;
this.tracker_.add(
this.cloudPrintInterface_,
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/invitation_store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698