1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr.define('print_preview', function() {
9 * Printer sharing invitation data object.
10 * @param {string} sender Text identifying invitation sender.
11 * @param {string} receiver Text identifying invitation receiver. Empty in
12 * case of a personal invitation. Identifies a group or domain in case
13 * of an invitation received by a group manager.
14 * @param {!print_preview.Destination} destination Shared destination.
15 * @param {!Object} aclEntry JSON representation of the ACL entry this
16 * invitation was sent to.
17 * @param {string} account User account this invitation is sent for.
20 function Invitation(sender, receiver, destination, aclEntry, account) {
22 * Text identifying invitation sender.
25 this.sender_ = sender;
28 * Text identifying invitation receiver. Empty in case of a personal
29 * invitation. Identifies a group or domain in case of an invitation
30 * received by a group manager.
33 this.receiver_ = receiver;
37 * @private {!print_preview.Destination}
39 this.destination_ = destination;
42 * JSON representation of the ACL entry this invitation was sent to.
45 this.aclEntry_ = aclEntry;
48 * Account this invitation is sent for.
51 this.account_ = account;
54 Invitation.prototype = {
55 /** @return {string} Text identifying invitation sender. */
60 /** @return {string} Text identifying invitation receiver. */
62 return this.receiver_;
66 * @return {boolean} Whether this user acts as a manager for a group of
69 get asGroupManager() {
70 return !!this.receiver_;
73 /** @return {!print_preview.Destination} Shared destination. */
75 return this.destination_;
78 /** @return {string} Scope (account) this invitation was sent to. */
80 return this.aclEntry_['scope'] || '';
83 /** @return {string} Account this invitation is sent for. */
91 Invitation: Invitation