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

Side by Side Diff: chrome/browser/resources/md_user_manager/import_supervised_user.js

Issue 2223743003: MD User Manager: Changes to 'import supervised users' dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 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
OLDNEW
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 /**
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 }); 68 });
69 69
70 this.supervisedUserIndex_ = NO_USER_SELECTED; 70 this.supervisedUserIndex_ = NO_USER_SELECTED;
71 71
72 this.signedInUser_ = signedInUser || null; 72 this.signedInUser_ = signedInUser || null;
73 if (this.signedInUser_) 73 if (this.signedInUser_)
74 this.$.dialog.open(); 74 this.$.dialog.open();
75 }, 75 },
76 76
77 /** 77 /**
78 * Computed binding that returns the appropriate import message depending on
79 * whether or not there are any supervised users to import.
80 * @param {!Array<!SupervisedUser>} supervisedUsers
81 * @private
82 * @return {string}
83 */
84 getMessage_: function(supervisedUsers) {
85 return supervisedUsers.length > 0 ? this.i18n('supervisedUserImportText') :
86 this.i18n('noSupervisedUserImportText');
87 },
88
89 /**
90 * param {number} supervisedUserIndex Index of the selected supervised user. 78 * param {number} supervisedUserIndex Index of the selected supervised user.
91 * @private 79 * @private
92 * @return {boolean} Whether the 'Import' button should be disabled. 80 * @return {boolean} Whether the 'Import' button should be disabled.
93 */ 81 */
94 isImportDisabled_: function(supervisedUserIndex) { 82 isImportDisabled_: function(supervisedUserIndex) {
95 var disabled = supervisedUserIndex == NO_USER_SELECTED; 83 var disabled = supervisedUserIndex == NO_USER_SELECTED;
96 if (!disabled) { 84 if (!disabled) {
97 this.$.dialog.lastFocusableNode = this.$.import; 85 this.$.dialog.lastFocusableNode = this.$.import;
98 } 86 }
99 return disabled; 87 return disabled;
100 }, 88 },
101 89
102 /** 90 /**
103 * Called when the user clicks the 'Import' button. it proceeds with importing 91 * Called when the user clicks the 'Import' button. it proceeds with importing
104 * the supervised user. 92 * the supervised user.
105 * @private 93 * @private
106 */ 94 */
107 onImportTap_: function() { 95 onImportTap_: function() {
108 var supervisedUser = this.supervisedUsers_[this.supervisedUserIndex_]; 96 var supervisedUser = this.supervisedUsers_[this.supervisedUserIndex_];
109 if (this.signedInUser_ && supervisedUser) { 97 if (this.signedInUser_ && supervisedUser) {
110 this.$.dialog.close(); 98 this.$.dialog.close();
111 // Event is caught by create-profile. 99 // Event is caught by create-profile.
112 this.fire('import', {supervisedUser: supervisedUser, 100 this.fire('import', {supervisedUser: supervisedUser,
113 signedInUser: this.signedInUser_}); 101 signedInUser: this.signedInUser_});
114 } 102 }
115 } 103 }
116 }); 104 });
117 })(); 105 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698