Commit 88ba2a5a authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Print Preview: Alter passing of app kiosk info to the user manager

The user manager already has access to the cloud print interface, which
contains information about whether cookie based printers are disabled
due to app kiosk mode. Instead of passing the app kiosk information
from the sidebar to the destination settings, allow the user manager to
access the desired information through a getter added to the interface.

Change-Id: I7669d99fcfa2c8228de6dff42fff0e11ce1fb0c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904946
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714752}
parent 02227e29
...@@ -71,6 +71,9 @@ import {Invitation} from './data/invitation.js'; ...@@ -71,6 +71,9 @@ import {Invitation} from './data/invitation.js';
/** @interface */ /** @interface */
export class CloudPrintInterface { export class CloudPrintInterface {
/** @return {boolean} Whether cookie destinations are disabled. */
areCookieDestinationsDisabled() {}
/** /**
* @return {boolean} Whether a search for cloud destinations is in progress. * @return {boolean} Whether a search for cloud destinations is in progress.
*/ */
......
...@@ -38,8 +38,8 @@ import {parseCloudDestination, parseInvitation} from './data/cloud_parsers.js'; ...@@ -38,8 +38,8 @@ import {parseCloudDestination, parseInvitation} from './data/cloud_parsers.js';
this.nativeLayer_ = nativeLayer; this.nativeLayer_ = nativeLayer;
/** /**
* Whether Print Preview is in App Kiosk mode, basically, use only * Whether Print Preview is in App Kiosk mode; use only printers available
* printers available for the device. * for the device and disable cookie destinations.
* @private {boolean} * @private {boolean}
*/ */
this.isInAppKioskMode_ = isInAppKioskMode; this.isInAppKioskMode_ = isInAppKioskMode;
...@@ -85,6 +85,11 @@ import {parseCloudDestination, parseInvitation} from './data/cloud_parsers.js'; ...@@ -85,6 +85,11 @@ import {parseCloudDestination, parseInvitation} from './data/cloud_parsers.js';
this.eventTarget_ = new EventTarget(); this.eventTarget_ = new EventTarget();
} }
/** @override */
areCookieDestinationsDisabled() {
return this.isInAppKioskMode_;
}
/** @override */ /** @override */
getEventTarget() { getEventTarget() {
return this.eventTarget_; return this.eventTarget_;
......
...@@ -8,6 +8,9 @@ import {CloudPrintInterface} from './cloud_print_interface.js'; ...@@ -8,6 +8,9 @@ import {CloudPrintInterface} from './cloud_print_interface.js';
export class CloudPrintInterfaceNative { export class CloudPrintInterfaceNative {
constructor() {} constructor() {}
/** @override */
areCookieDestinationsDisabled() {}
/** @override */ /** @override */
isCloudDestinationSearchInProgress() {} isCloudDestinationSearchInProgress() {}
......
...@@ -30,8 +30,6 @@ Polymer({ ...@@ -30,8 +30,6 @@ Polymer({
notify: true, notify: true,
}, },
appKioskMode: Boolean,
cloudPrintDisabled: { cloudPrintDisabled: {
type: Boolean, type: Boolean,
value: true, value: true,
...@@ -134,7 +132,8 @@ Polymer({ ...@@ -134,7 +132,8 @@ Polymer({
* @private * @private
*/ */
checkCloudPrintStatus_: function(event) { checkCloudPrintStatus_: function(event) {
if (event.detail.status != 403 || this.appKioskMode) { if (event.detail.status != 403 ||
this.cloudPrintInterface.areCookieDestinationsDisabled()) {
return; return;
} }
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
} }
</style> </style>
<print-preview-user-manager id="userManager" active-user="{{activeUser_}}" <print-preview-user-manager id="userManager" active-user="{{activeUser_}}"
app-kiosk-mode="[[appKioskMode]]"
cloud-print-disabled="{{cloudPrintDisabled_}}" cloud-print-disabled="{{cloudPrintDisabled_}}"
cloud-print-interface="[[cloudPrintInterface]]" cloud-print-interface="[[cloudPrintInterface]]"
users="{{users_}}" destination-store="[[destinationStore_]]" users="{{users_}}" destination-store="[[destinationStore_]]"
......
...@@ -49,8 +49,6 @@ import '../strings.m.js'; ...@@ -49,8 +49,6 @@ import '../strings.m.js';
], ],
properties: { properties: {
appKioskMode: Boolean,
/** @type {CloudPrintInterface} */ /** @type {CloudPrintInterface} */
cloudPrintInterface: { cloudPrintInterface: {
type: Object, type: Object,
...@@ -265,7 +263,7 @@ import '../strings.m.js'; ...@@ -265,7 +263,7 @@ import '../strings.m.js';
init: function( init: function(
defaultPrinter, pdfPrinterDisabled, defaultPrinter, pdfPrinterDisabled,
serializedDefaultDestinationRulesStr, userAccounts, syncAvailable) { serializedDefaultDestinationRulesStr, userAccounts, syncAvailable) {
this.pdfPrinterDisabled_ = this.appKioskMode || pdfPrinterDisabled; this.pdfPrinterDisabled_ = pdfPrinterDisabled;
this.$.userManager.initUserAccounts(userAccounts, syncAvailable); this.$.userManager.initUserAccounts(userAccounts, syncAvailable);
this.destinationStore_.init( this.destinationStore_.init(
this.pdfPrinterDisabled_, defaultPrinter, this.pdfPrinterDisabled_, defaultPrinter,
......
...@@ -145,8 +145,9 @@ Polymer({ ...@@ -145,8 +145,9 @@ Polymer({
appKioskMode, defaultPrinter, serializedDestinationSelectionRulesStr, appKioskMode, defaultPrinter, serializedDestinationSelectionRulesStr,
userAccounts, syncAvailable, pdfPrinterDisabled) { userAccounts, syncAvailable, pdfPrinterDisabled) {
this.isInAppKioskMode_ = appKioskMode; this.isInAppKioskMode_ = appKioskMode;
const saveAsPdfDisabled = this.isInAppKioskMode_ || pdfPrinterDisabled;
this.$.destinationSettings.init( this.$.destinationSettings.init(
defaultPrinter, pdfPrinterDisabled, defaultPrinter, saveAsPdfDisabled,
serializedDestinationSelectionRulesStr, userAccounts, syncAvailable); serializedDestinationSelectionRulesStr, userAccounts, syncAvailable);
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment