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('options', function() { | 5 cr.define('options', function() { |
6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 /** | 9 /** |
10 * SupervisedUserCreateConfirm class. | 10 * SupervisedUserCreateConfirm class. |
11 * Encapsulated handling of the confirmation overlay page when creating a | 11 * Encapsulated handling of the confirmation overlay page when creating a |
12 * supervised user. | 12 * supervised user. |
13 * @constructor | 13 * @constructor |
14 * @extends {cr.ui.pageManager.Page} | 14 * @extends {cr.ui.pageManager.Page} |
15 */ | 15 */ |
16 function SupervisedUserCreateConfirmOverlay() { | 16 function SupervisedUserCreateConfirmOverlay() { |
17 Page.call(this, 'supervisedUserCreateConfirm', | 17 Page.call( |
18 '', // The title will be based on the new profile name. | 18 this, 'supervisedUserCreateConfirm', |
19 'supervised-user-created'); | 19 '', // The title will be based on the new profile name. |
| 20 'supervised-user-created'); |
20 } | 21 } |
21 | 22 |
22 cr.addSingletonGetter(SupervisedUserCreateConfirmOverlay); | 23 cr.addSingletonGetter(SupervisedUserCreateConfirmOverlay); |
23 | 24 |
24 SupervisedUserCreateConfirmOverlay.prototype = { | 25 SupervisedUserCreateConfirmOverlay.prototype = { |
25 // Inherit from Page. | 26 // Inherit from Page. |
26 __proto__: Page.prototype, | 27 __proto__: Page.prototype, |
27 | 28 |
28 // Info about the newly created profile. | 29 // Info about the newly created profile. |
29 profileInfo_: null, | 30 profileInfo_: null, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 var MAX_LENGTH = 50; | 68 var MAX_LENGTH = 50; |
68 var elidedName = elide(info.name, MAX_LENGTH); | 69 var elidedName = elide(info.name, MAX_LENGTH); |
69 $('supervised-user-created-title').textContent = | 70 $('supervised-user-created-title').textContent = |
70 loadTimeData.getStringF('supervisedUserCreatedTitle', elidedName); | 71 loadTimeData.getStringF('supervisedUserCreatedTitle', elidedName); |
71 $('supervised-user-created-switch').textContent = | 72 $('supervised-user-created-switch').textContent = |
72 loadTimeData.getStringF('supervisedUserCreatedSwitch', elidedName); | 73 loadTimeData.getStringF('supervisedUserCreatedSwitch', elidedName); |
73 | 74 |
74 // HTML-escape the user-supplied strings before putting them into | 75 // HTML-escape the user-supplied strings before putting them into |
75 // innerHTML. This is probably excessive for the email address, but | 76 // innerHTML. This is probably excessive for the email address, but |
76 // belt-and-suspenders is cheap here. | 77 // belt-and-suspenders is cheap here. |
77 $('supervised-user-created-text').innerHTML = | 78 $('supervised-user-created-text').innerHTML = loadTimeData.getStringF( |
78 loadTimeData.getStringF('supervisedUserCreatedText', | 79 'supervisedUserCreatedText', HTMLEscape(elidedName), |
79 HTMLEscape(elidedName), | 80 HTMLEscape(elide(info.custodianEmail, MAX_LENGTH))); |
80 HTMLEscape(elide(info.custodianEmail, | |
81 MAX_LENGTH))); | |
82 }, | 81 }, |
83 | 82 |
84 /** @override */ | 83 /** @override */ |
85 canShowPage: function() { | 84 canShowPage: function() { |
86 return this.profileInfo_ != null; | 85 return this.profileInfo_ != null; |
87 }, | 86 }, |
88 | 87 |
89 /** | 88 /** |
90 * Updates the displayed profile name if it has changed. Called by the | 89 * Updates the displayed profile name if it has changed. Called by the |
91 * handler. | 90 * handler. |
(...skipping 27 matching lines...) Expand all Loading... |
119 'onDeletedProfile', | 118 'onDeletedProfile', |
120 'onUpdatedProfileName', | 119 'onUpdatedProfileName', |
121 'setProfileInfo', | 120 'setProfileInfo', |
122 ]); | 121 ]); |
123 | 122 |
124 // Export | 123 // Export |
125 return { | 124 return { |
126 SupervisedUserCreateConfirmOverlay: SupervisedUserCreateConfirmOverlay, | 125 SupervisedUserCreateConfirmOverlay: SupervisedUserCreateConfirmOverlay, |
127 }; | 126 }; |
128 }); | 127 }); |
OLD | NEW |