OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @fileoverview 'import-supervised-user' is a dialog that allows user to select | 6 * @fileoverview 'import-supervised-user' is a dialog that allows user to select |
7 * a supervised profile from a list of profiles to import on the current device. | 7 * a supervised profile from a list of profiles to import on the current device. |
8 */ | 8 */ |
9 (function() { | 9 (function() { |
10 /** | 10 /** |
11 * It means no supervised user is selected. | 11 * It means no supervised user is selected. |
12 * @const {number} | 12 * @const {number} |
13 */ | 13 */ |
14 var NO_USER_SELECTED = -1; | 14 var NO_USER_SELECTED = -1; |
15 | 15 |
16 Polymer({ | 16 Polymer({ |
17 is: 'import-supervised-user', | 17 is: 'import-supervised-user', |
18 | 18 |
19 behaviors: [ | 19 behaviors: [ |
20 I18nBehavior, | 20 I18nBehavior, |
21 ], | 21 ], |
22 | 22 |
23 properties: { | 23 properties: { |
24 /** | 24 /** |
25 * The currently signed in user and the custodian. | 25 * The currently signed in user and the custodian. |
26 * @private {?SignedInUser} | 26 * @private {?SignedInUser} |
27 */ | 27 */ |
28 signedInUser_: { | 28 signedInUser_: { |
29 type: Object, | 29 type: Object, |
30 value: function() { return null; } | 30 value: function() { |
| 31 return null; |
| 32 } |
31 }, | 33 }, |
32 | 34 |
33 /** | 35 /** |
34 * The list of supervised users managed by signedInUser_. | 36 * The list of supervised users managed by signedInUser_. |
35 * @private {!Array<!SupervisedUser>} | 37 * @private {!Array<!SupervisedUser>} |
36 */ | 38 */ |
37 supervisedUsers_: { | 39 supervisedUsers_: { |
38 type: Array, | 40 type: Array, |
39 value: function() { return []; } | 41 value: function() { |
| 42 return []; |
| 43 } |
40 }, | 44 }, |
41 | 45 |
42 /** | 46 /** |
43 * Index of the selected supervised user. | 47 * Index of the selected supervised user. |
44 * @private {number} | 48 * @private {number} |
45 */ | 49 */ |
46 supervisedUserIndex_: { | 50 supervisedUserIndex_: {type: Number, value: NO_USER_SELECTED} |
47 type: Number, | |
48 value: NO_USER_SELECTED | |
49 } | |
50 }, | 51 }, |
51 | 52 |
52 /** override */ | 53 /** override */ |
53 ready: function() { | 54 ready: function() { |
54 this.$.dialog.lastFocusableNode = this.$.cancel; | 55 this.$.dialog.lastFocusableNode = this.$.cancel; |
55 }, | 56 }, |
56 | 57 |
57 /** | 58 /** |
58 * Displays the dialog. | 59 * Displays the dialog. |
59 * @param {(!SignedInUser|undefined)} signedInUser | 60 * @param {(!SignedInUser|undefined)} signedInUser |
(...skipping 30 matching lines...) Expand all Loading... |
90 /** | 91 /** |
91 * Called when the user clicks the 'Import' button. it proceeds with importing | 92 * Called when the user clicks the 'Import' button. it proceeds with importing |
92 * the supervised user. | 93 * the supervised user. |
93 * @private | 94 * @private |
94 */ | 95 */ |
95 onImportTap_: function() { | 96 onImportTap_: function() { |
96 var supervisedUser = this.supervisedUsers_[this.supervisedUserIndex_]; | 97 var supervisedUser = this.supervisedUsers_[this.supervisedUserIndex_]; |
97 if (this.signedInUser_ && supervisedUser) { | 98 if (this.signedInUser_ && supervisedUser) { |
98 this.$.dialog.close(); | 99 this.$.dialog.close(); |
99 // Event is caught by create-profile. | 100 // Event is caught by create-profile. |
100 this.fire('import', {supervisedUser: supervisedUser, | 101 this.fire( |
101 signedInUser: this.signedInUser_}); | 102 'import', |
| 103 {supervisedUser: supervisedUser, signedInUser: this.signedInUser_}); |
102 } | 104 } |
103 } | 105 } |
104 }); | 106 }); |
105 })(); | 107 })(); |
OLD | NEW |