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

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: rebase Created 6 years, 4 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 /** @override */
31 initializePage: function() {
32 OptionsPage.prototype.initializePage.call(this);
33
34 $('managed-user-created-done').onclick = function(event) {
35 OptionsPage.closeOverlay();
36 };
37
38 var self = this;
39
40 $('managed-user-created-switch').onclick = function(event) {
41 OptionsPage.closeOverlay();
42 chrome.send('switchToProfile', [self.profileInfo_.filePath]);
43 };
44 },
45
46 /** @override */
47 didShowPage: function() {
48 $('managed-user-created-switch').focus();
49 },
50
51 /**
52 * Sets the profile info used in the dialog and updates the profile name
53 * displayed. Called by the profile creation overlay when this overlay is
54 * opened.
55 * @param {Object} info An object of the form:
56 * info = {
57 * name: "Profile Name",
58 * filePath: "/path/to/profile/data/on/disk",
59 * isManaged: (true|false)
60 * custodianEmail: "example@gmail.com"
61 * };
62 * @private
63 */
64 setProfileInfo_: function(info) {
65 this.profileInfo_ = info;
66 var MAX_LENGTH = 50;
67 var elidedName = elide(info.name, MAX_LENGTH);
68 $('managed-user-created-title').textContent =
69 loadTimeData.getStringF('managedUserCreatedTitle', elidedName);
70 $('managed-user-created-switch').textContent =
71 loadTimeData.getStringF('managedUserCreatedSwitch', elidedName);
72
73 // HTML-escape the user-supplied strings before putting them into
74 // innerHTML. This is probably excessive for the email address, but
75 // belt-and-suspenders is cheap here.
76 $('managed-user-created-text').innerHTML =
77 loadTimeData.getStringF('managedUserCreatedText',
78 HTMLEscape(elidedName),
79 HTMLEscape(elide(info.custodianEmail,
80 MAX_LENGTH)));
81 },
82
83 /** @override */
84 canShowPage: function() {
85 return this.profileInfo_ != null;
86 },
87 };
88
89 // Forward public APIs to private implementations.
90 [
91 'setProfileInfo',
92 ].forEach(function(name) {
93 ManagedUserCreateConfirmOverlay[name] = function() {
94 var instance = ManagedUserCreateConfirmOverlay.getInstance();
95 return instance[name + '_'].apply(instance, arguments);
96 };
97 });
98
99 // Export
100 return {
101 ManagedUserCreateConfirmOverlay: ManagedUserCreateConfirmOverlay,
102 };
103 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698