Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/resources/options/managed_user_create_confirm.js

Issue 403343002: Rename "managed (mode|user)" to "supervised user" (part 8) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix2 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage;
7
8 /**
9 * ManagedUserCreateConfirm class.
10 * Encapsulated handling of the confirmation overlay page when creating a
11 * managed user.
12 * @constructor
13 * @class
14 */
15 function ManagedUserCreateConfirmOverlay() {
16 OptionsPage.call(this, 'managedUserCreateConfirm',
17 '', // The title will be based on the new profile name.
18 'managed-user-created');
19 };
20
21 cr.addSingletonGetter(ManagedUserCreateConfirmOverlay);
22
23 ManagedUserCreateConfirmOverlay.prototype = {
24 // Inherit from OptionsPage.
25 __proto__: OptionsPage.prototype,
26
27 // Info about the newly created profile.
28 profileInfo_: null,
29
30 /**
31 * Initialize the page.
32 */
33 initializePage: function() {
34 OptionsPage.prototype.initializePage.call(this);
35
36 $('managed-user-created-done').onclick = function(event) {
37 OptionsPage.closeOverlay();
38 };
39
40 var self = this;
41
42 $('managed-user-created-switch').onclick = function(event) {
43 OptionsPage.closeOverlay();
44 chrome.send('switchToProfile', [self.profileInfo_.filePath]);
45 };
46 },
47
48 /** @override */
49 didShowPage: function() {
50 $('managed-user-created-switch').focus();
51 },
52
53 /**
54 * Sets the profile info used in the dialog and updates the profile name
55 * displayed. Called by the profile creation overlay when this overlay is
56 * opened.
57 * @param {Object} info An object of the form:
58 * info = {
59 * name: "Profile Name",
60 * filePath: "/path/to/profile/data/on/disk",
61 * isManaged: (true|false)
62 * custodianEmail: "example@gmail.com"
63 * };
64 * @private
65 */
66 setProfileInfo_: function(info) {
67 this.profileInfo_ = info;
68 var MAX_LENGTH = 50;
69 var elidedName = elide(info.name, MAX_LENGTH);
70 $('managed-user-created-title').textContent =
71 loadTimeData.getStringF('managedUserCreatedTitle', elidedName);
72 $('managed-user-created-switch').textContent =
73 loadTimeData.getStringF('managedUserCreatedSwitch', elidedName);
74
75 // HTML-escape the user-supplied strings before putting them into
76 // innerHTML. This is probably excessive for the email address, but
77 // belt-and-suspenders is cheap here.
78 $('managed-user-created-text').innerHTML =
79 loadTimeData.getStringF('managedUserCreatedText',
80 HTMLEscape(elidedName),
81 HTMLEscape(elide(info.custodianEmail,
82 MAX_LENGTH)));
83 },
84
85 /** @override */
86 canShowPage: function() {
87 return this.profileInfo_ != null;
88 },
89 };
90
91 // Forward public APIs to private implementations.
92 [
93 'setProfileInfo',
94 ].forEach(function(name) {
95 ManagedUserCreateConfirmOverlay[name] = function() {
96 var instance = ManagedUserCreateConfirmOverlay.getInstance();
97 return instance[name + '_'].apply(instance, arguments);
98 };
99 });
100
101 // Export
102 return {
103 ManagedUserCreateConfirmOverlay: ManagedUserCreateConfirmOverlay,
104 };
105 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698