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 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 this.inProgress_ = inProgress; | 168 this.inProgress_ = inProgress; |
169 $('supervised-user-import-ok').disabled = inProgress; | 169 $('supervised-user-import-ok').disabled = inProgress; |
170 $('supervised-user-select-avatar-ok').disabled = inProgress; | 170 $('supervised-user-select-avatar-ok').disabled = inProgress; |
171 $('supervised-user-list').disabled = inProgress; | 171 $('supervised-user-list').disabled = inProgress; |
172 $('select-avatar-grid').disabled = inProgress; | 172 $('select-avatar-grid').disabled = inProgress; |
173 $('supervised-user-import-throbber').hidden = !inProgress; | 173 $('supervised-user-import-throbber').hidden = !inProgress; |
174 }, | 174 }, |
175 | 175 |
176 /** | 176 /** |
177 * Sets the data model of the supervised user list to |supervisedUsers|. | 177 * Sets the data model of the supervised user list to |supervisedUsers|. |
178 * @param {Array.<Object>} supervisedUsers Array of supervised user objects. | 178 * @param {Array.<{id: string, name: string, iconURL: string, |
179 * Each object is of the form: | 179 * onCurrentDevice: boolean, needAvatar: boolean}>} supervisedUsers |
180 * supervisedUser = { | 180 * Array of supervised user objects. |
181 * id: "Supervised User ID", | |
182 * name: "Supervised User Name", | |
183 * iconURL: "chrome://path/to/icon/image", | |
184 * onCurrentDevice: true or false, | |
185 * needAvatar: true or false | |
186 * } | |
187 * @private | 181 * @private |
188 */ | 182 */ |
189 receiveExistingSupervisedUsers_: function(supervisedUsers) { | 183 receiveExistingSupervisedUsers_: function(supervisedUsers) { |
190 supervisedUsers.sort(function(a, b) { | 184 supervisedUsers.sort(function(a, b) { |
191 if (a.onCurrentDevice != b.onCurrentDevice) | 185 if (a.onCurrentDevice != b.onCurrentDevice) |
192 return a.onCurrentDevice ? 1 : -1; | 186 return a.onCurrentDevice ? 1 : -1; |
193 return a.name.localeCompare(b.name); | 187 return a.name.localeCompare(b.name); |
194 }); | 188 }); |
195 | 189 |
196 $('supervised-user-list').dataModel = new ArrayDataModel(supervisedUsers); | 190 $('supervised-user-list').dataModel = new ArrayDataModel(supervisedUsers); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Forward public APIs to private implementations. | 232 // Forward public APIs to private implementations. |
239 cr.makePublic(SupervisedUserImportOverlay, [ | 233 cr.makePublic(SupervisedUserImportOverlay, [ |
240 'onSuccess', | 234 'onSuccess', |
241 ]); | 235 ]); |
242 | 236 |
243 // Export | 237 // Export |
244 return { | 238 return { |
245 SupervisedUserImportOverlay: SupervisedUserImportOverlay, | 239 SupervisedUserImportOverlay: SupervisedUserImportOverlay, |
246 }; | 240 }; |
247 }); | 241 }); |
OLD | NEW |