| 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 988601f49b98f39033809c50a00b81ff8e2135b0..1d2c8635e6128c1a8d8fbb664f056d7fcd9f5630 100644
|
| --- a/chrome/browser/resources/print_preview/native_layer.js
|
| +++ b/chrome/browser/resources/print_preview/native_layer.js
|
| @@ -39,6 +39,7 @@ cr.define('print_preview', function() {
|
| global['updatePrintPreview'] = this.onUpdatePrintPreview_.bind(this);
|
| global['printScalingDisabledForSourcePDF'] =
|
| this.onPrintScalingDisabledForSourcePDF_.bind(this);
|
| + global['onDidGetAccessToken'] = this.onDidGetAccessToken_.bind(this);
|
| };
|
|
|
| /**
|
| @@ -47,6 +48,7 @@ cr.define('print_preview', function() {
|
| * @const
|
| */
|
| NativeLayer.EventType = {
|
| + ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY',
|
| CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET',
|
| CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE',
|
| DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD',
|
| @@ -100,6 +102,14 @@ cr.define('print_preview', function() {
|
| NativeLayer.prototype = {
|
| __proto__: cr.EventTarget.prototype,
|
|
|
| + /**
|
| + * Requests access token for cloud print requests.
|
| + * @param {string} authType type of access token.
|
| + */
|
| + startGetAccessToken: function(authType) {
|
| + chrome.send('getAccessToken', [authType]);
|
| + },
|
| +
|
| /** Gets the initial settings to initialize the print preview with. */
|
| startGetInitialSettings: function() {
|
| chrome.send('getInitialSettings');
|
| @@ -520,6 +530,20 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| + * Notification that access token is ready.
|
| + * @param {string} authType Type of access token.
|
| + * @param {string} accessToken Access token.
|
| + * @private
|
| + */
|
| + onDidGetAccessToken_: function(authType, accessToken) {
|
| + var getAccessTokenEvent = new cr.Event(
|
| + NativeLayer.EventType.ACCESS_TOKEN_READY);
|
| + getAccessTokenEvent.authType = authType;
|
| + getAccessTokenEvent.accessToken = accessToken;
|
| + this.dispatchEvent(getAccessTokenEvent);
|
| + },
|
| +
|
| + /**
|
| * Update the print preview when new preview data is available.
|
| * Create the PDF plugin as needed.
|
| * Called from PrintPreviewUI::PreviewDataIsAvailable().
|
|
|