OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * Repository which stores information about the user. Events are dispatched | 9 * Repository which stores information about the user. Events are dispatched |
10 * when the information changes. | 10 * when the information changes. |
11 * @constructor | 11 * @constructor |
12 * @extends {cr.EventTarget} | 12 * @extends {cr.EventTarget} |
13 */ | 13 */ |
14 function UserInfo() { | 14 function UserInfo() { |
15 cr.EventTarget.call(this); | 15 cr.EventTarget.call(this); |
16 | 16 |
17 /** | 17 /** |
18 * Email address of the logged in user or {@code null} if no user is logged | 18 * Email address of the logged in user or {@code null} if no user is logged |
19 * in. In case of Google multilogin, can be changed by the user. | 19 * in. In case of Google multilogin, can be changed by the user. |
20 * @private {?string} | 20 * @private {?string} |
21 */ | 21 */ |
22 this.activeUser_ = null; | 22 this.activeUser_ = null; |
23 | 23 |
24 /** | 24 /** |
25 * Email addresses of the logged in users or empty array if no user is | 25 * Email addresses of the logged in users or empty array if no user is |
26 * logged in. {@code null} if not known yet. | 26 * logged in. {@code null} if not known yet. |
27 * @private {?Array<string>} | 27 * @private {?Array<string>} |
28 */ | 28 */ |
29 this.users_ = null; | 29 this.users_ = null; |
30 }; | 30 } |
31 | 31 |
32 /** | 32 /** |
33 * Enumeration of event types dispatched by the user info. | 33 * Enumeration of event types dispatched by the user info. |
34 * @enum {string} | 34 * @enum {string} |
35 */ | 35 */ |
36 UserInfo.EventType = { | 36 UserInfo.EventType = { |
37 ACTIVE_USER_CHANGED: 'print_preview.UserInfo.ACTIVE_USER_CHANGED', | 37 ACTIVE_USER_CHANGED: 'print_preview.UserInfo.ACTIVE_USER_CHANGED', |
38 USERS_CHANGED: 'print_preview.UserInfo.USERS_CHANGED' | 38 USERS_CHANGED: 'print_preview.UserInfo.USERS_CHANGED' |
39 }; | 39 }; |
40 | 40 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 this.activeUser_ = activeUser; | 84 this.activeUser_ = activeUser; |
85 this.users_ = users || []; | 85 this.users_ = users || []; |
86 cr.dispatchSimpleEvent(this, UserInfo.EventType.USERS_CHANGED); | 86 cr.dispatchSimpleEvent(this, UserInfo.EventType.USERS_CHANGED); |
87 }, | 87 }, |
88 }; | 88 }; |
89 | 89 |
90 return { | 90 return { |
91 UserInfo: UserInfo | 91 UserInfo: UserInfo |
92 }; | 92 }; |
93 }); | 93 }); |
OLD | NEW |