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

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

Issue 2956033002: Print Preview: Make useCloudPrint a WebUI event (Closed)
Patch Set: clean up Created 3 years, 6 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/print_preview.js
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index 741a50e1d1d08eb1df0cd7cd992dc8f4a83254f7..1b6bd406775667cc552ab4309c701ed7fab17bfa 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -340,16 +340,14 @@ cr.define('print_preview', function() {
'extension-printers-added',
this.destinationStore_.onExtensionPrintersAdded_.bind(
this.destinationStore_));
+ this.listenerTracker.add(
+ 'use-cloud-print', this.onCloudPrintEnable_.bind(this));
},
/** @override */
enterDocument: function() {
// Native layer events.
var nativeLayerEventTarget = this.nativeLayer_.getEventTarget();
- this.tracker.add(
- nativeLayerEventTarget,
- print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE,
- this.onCloudPrintEnable_.bind(this));
this.tracker.add(
nativeLayerEventTarget,
print_preview.NativeLayer.EventType.SETTINGS_INVALID,
@@ -688,16 +686,17 @@ cr.define('print_preview', function() {
},
/**
- * Calls when the native layer enables Google Cloud Print integration.
+ * Called when Google Cloud Print integration is enabled by the
+ * PrintPreviewHandler.
* Fetches the user's cloud printers.
- * @param {Event} event Contains the base URL of the Google Cloud Print
- * service.
+ * @param {string} cloudPrintUrl The URL to use for cloud print servers.
+ * @param {boolean} appKioskMode Whether to print automatically for kiosk
+ * mode.
* @private
*/
- onCloudPrintEnable_: function(event) {
+ onCloudPrintEnable_: function(cloudPrintUrl, appKioskMode) {
this.cloudPrintInterface_ = new cloudprint.CloudPrintInterface(
- event.baseCloudPrintUrl, this.nativeLayer_, this.userInfo_,
- event.appKioskMode);
+ cloudPrintUrl, this.nativeLayer_, this.userInfo_, appKioskMode);
rbpotter 2017/06/27 22:30:30 Note: there is now no reason cloudPrintUrl or appK
this.tracker.add(
this.cloudPrintInterface_,
cloudprint.CloudPrintInterfaceEventType.SUBMIT_DONE,
« no previous file with comments | « chrome/browser/resources/print_preview/native_layer.js ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698