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 'supervised-user-create-confirm' is a page that is displayed | 6 * @fileoverview 'supervised-user-create-confirm' is a page that is displayed |
7 * upon successful creation of a supervised user. It contains information for | 7 * upon successful creation of a supervised user. It contains information for |
8 * the custodian on where to configure browsing restrictions as well as how to | 8 * the custodian on where to configure browsing restrictions as well as how to |
9 * exit and childlock their profile. | 9 * exit and childlock their profile. |
10 */ | 10 */ |
11 (function() { | 11 (function() { |
12 /** | 12 /** |
13 * Maximum length of the supervised user profile name or custodian's username. | 13 * Maximum length of the supervised user profile name or custodian's username. |
14 * @const {number} | 14 * @const {number} |
15 */ | 15 */ |
16 var MAX_NAME_LENGTH = 50; | 16 var MAX_NAME_LENGTH = 50; |
17 | 17 |
18 Polymer({ | 18 Polymer({ |
19 is: 'supervised-user-create-confirm', | 19 is: 'supervised-user-create-confirm', |
20 | 20 |
21 behaviors: [ | 21 behaviors: [I18nBehavior], |
22 I18nBehavior | |
23 ], | |
24 | 22 |
25 properties: { | 23 properties: { |
26 /** | 24 /** |
27 * Profile Info of the supervised user that is passed to the page. | 25 * Profile Info of the supervised user that is passed to the page. |
28 * @type {?ProfileInfo} | 26 * @type {?ProfileInfo} |
29 */ | 27 */ |
30 profileInfo: { | 28 profileInfo: { |
31 type: Object, | 29 type: Object, |
32 value: function() { return null; } | 30 value: function() { |
| 31 return null; |
| 32 } |
33 }, | 33 }, |
34 | 34 |
35 /** @private {!signin.ProfileBrowserProxy} */ | 35 /** @private {!signin.ProfileBrowserProxy} */ |
36 browserProxy_: Object | 36 browserProxy_: Object |
37 }, | 37 }, |
38 | 38 |
39 listeners: { | 39 listeners: {'tap': 'onTap_'}, |
40 'tap': 'onTap_' | |
41 }, | |
42 | 40 |
43 /** @override */ | 41 /** @override */ |
44 created: function() { | 42 created: function() { |
45 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); | 43 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); |
46 }, | 44 }, |
47 | 45 |
48 /** | 46 /** |
49 * Handles tap events from dynamically created links in the | 47 * Handles tap events from dynamically created links in the |
50 * supervisedUserCreatedText i18n string. | 48 * supervisedUserCreatedText i18n string. |
51 * @param {!Event} event | 49 * @param {!Event} event |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }, | 95 }, |
98 | 96 |
99 /** | 97 /** |
100 * Computed binding returning the sanitized confirmation HTML message that is | 98 * Computed binding returning the sanitized confirmation HTML message that is |
101 * safe to set as innerHTML. | 99 * safe to set as innerHTML. |
102 * @param {?ProfileInfo} profileInfo | 100 * @param {?ProfileInfo} profileInfo |
103 * @return {string} | 101 * @return {string} |
104 * @private | 102 * @private |
105 */ | 103 */ |
106 confirmationMessage_: function(profileInfo) { | 104 confirmationMessage_: function(profileInfo) { |
107 return this.i18n('supervisedUserCreatedText', | 105 return this.i18nAdvanced('supervisedUserCreatedText', { |
108 this.elideProfileName_(profileInfo), | 106 substitutions: [ |
109 this.elideCustodianUsername_(profileInfo)); | 107 this.elideProfileName_(profileInfo), |
| 108 this.elideCustodianUsername_(profileInfo) |
| 109 ], |
| 110 }); |
110 }, | 111 }, |
111 | 112 |
112 /** | 113 /** |
113 * Computed binding returning the text of the 'Switch To User' button. | 114 * Computed binding returning the text of the 'Switch To User' button. |
114 * @param {?ProfileInfo} profileInfo | 115 * @param {?ProfileInfo} profileInfo |
115 * @return {string} | 116 * @return {string} |
116 * @private | 117 * @private |
117 */ | 118 */ |
118 switchUserText_: function(profileInfo) { | 119 switchUserText_: function(profileInfo) { |
119 return this.i18n('supervisedUserCreatedSwitch', | 120 return this.i18n('supervisedUserCreatedSwitch', |
(...skipping 15 matching lines...) Expand all Loading... |
135 * @param {!Event} event | 136 * @param {!Event} event |
136 * @private | 137 * @private |
137 */ | 138 */ |
138 onSwitchUserTap_: function(event) { | 139 onSwitchUserTap_: function(event) { |
139 this.browserProxy_.switchToProfile(this.profileInfo.filePath); | 140 this.browserProxy_.switchToProfile(this.profileInfo.filePath); |
140 // Event is caught by user-manager-pages. | 141 // Event is caught by user-manager-pages. |
141 this.fire('change-page', {page: 'user-pods-page'}); | 142 this.fire('change-page', {page: 'user-pods-page'}); |
142 } | 143 } |
143 }); | 144 }); |
144 })(); | 145 })(); |
OLD | NEW |