OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Printer sharing invitations data store. | 9 * Printer sharing invitations data store. |
10 * @param {!print_preview.UserInfo} userInfo User information repository. | 10 * @param {!print_preview.UserInfo} userInfo User information repository. |
11 * @constructor | 11 * @constructor |
12 * @extends {cr.EventTarget} | 12 * @extends {cr.EventTarget} |
13 */ | 13 */ |
14 function InvitationStore(userInfo) { | 14 function InvitationStore(userInfo) { |
15 cr.EventTarget.call(this); | 15 cr.EventTarget.call(this); |
16 | 16 |
17 /** | 17 /** |
18 * User information repository. | 18 * User information repository. |
19 * @private {!print_preview.UserInfo} | 19 * @private {!print_preview.UserInfo} |
20 */ | 20 */ |
21 this.userInfo_ = userInfo; | 21 this.userInfo_ = userInfo; |
22 | 22 |
23 /** | 23 /** |
24 * Maps user account to the list of invitations for this account. | 24 * Maps user account to the list of invitations for this account. |
25 * @private {!Object.<string, !Array.<!print_preview.Invitation>>} | 25 * @private {!Object<string, !Array<!print_preview.Invitation>>} |
26 */ | 26 */ |
27 this.invitations_ = {}; | 27 this.invitations_ = {}; |
28 | 28 |
29 /** | 29 /** |
30 * Maps user account to the flag whether the invitations for this account | 30 * Maps user account to the flag whether the invitations for this account |
31 * were successfully loaded. | 31 * were successfully loaded. |
32 * @private {!Object.<string, print_preview.InvitationStore.LoadStatus_>} | 32 * @private {!Object<string, print_preview.InvitationStore.LoadStatus_>} |
33 */ | 33 */ |
34 this.loadStatus_ = {}; | 34 this.loadStatus_ = {}; |
35 | 35 |
36 /** | 36 /** |
37 * Event tracker used to track event listeners of the destination store. | 37 * Event tracker used to track event listeners of the destination store. |
38 * @private {!EventTracker} | 38 * @private {!EventTracker} |
39 */ | 39 */ |
40 this.tracker_ = new EventTracker(); | 40 this.tracker_ = new EventTracker(); |
41 | 41 |
42 /** | 42 /** |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 /** | 80 /** |
81 * @return {print_preview.Invitation} Currently processed invitation or | 81 * @return {print_preview.Invitation} Currently processed invitation or |
82 * {@code null}. | 82 * {@code null}. |
83 */ | 83 */ |
84 get invitationInProgress() { | 84 get invitationInProgress() { |
85 return this.invitationInProgress_; | 85 return this.invitationInProgress_; |
86 }, | 86 }, |
87 | 87 |
88 /** | 88 /** |
89 * @param {string} account Account to filter invitations by. | 89 * @param {string} account Account to filter invitations by. |
90 * @return {!Array.<!print_preview.Invitation>} List of invitations for the | 90 * @return {!Array<!print_preview.Invitation>} List of invitations for the |
91 * {@code account}. | 91 * {@code account}. |
92 */ | 92 */ |
93 invitations: function(account) { | 93 invitations: function(account) { |
94 return this.invitations_[account] || []; | 94 return this.invitations_[account] || []; |
95 }, | 95 }, |
96 | 96 |
97 /** | 97 /** |
98 * Sets the invitation store's Google Cloud Print interface. | 98 * Sets the invitation store's Google Cloud Print interface. |
99 * @param {!print_preview.CloudPrintInterface} cloudPrintInterface Interface | 99 * @param {!print_preview.CloudPrintInterface} cloudPrintInterface Interface |
100 * to set. | 100 * to set. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 cr.dispatchSimpleEvent( | 214 cr.dispatchSimpleEvent( |
215 this, InvitationStore.EventType.INVITATION_PROCESSED); | 215 this, InvitationStore.EventType.INVITATION_PROCESSED); |
216 } | 216 } |
217 }; | 217 }; |
218 | 218 |
219 // Export | 219 // Export |
220 return { | 220 return { |
221 InvitationStore: InvitationStore | 221 InvitationStore: InvitationStore |
222 }; | 222 }; |
223 }); | 223 }); |
OLD | NEW |