| 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 /** | 6 /** |
| 7 * SupervisedUserListData class. | 7 * SupervisedUserListData class. |
| 8 * Handles requests for retrieving a list of existing supervised users which | 8 * Handles requests for retrieving a list of existing supervised users which |
| 9 * are supervised by the current profile. For each request a promise is | 9 * are supervised by the current profile. For each request a promise is |
| 10 * returned, which is cached in order to reuse the retrieved supervised users | 10 * returned, which is cached in order to reuse the retrieved supervised users |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * Each object is of the form: | 24 * Each object is of the form: |
| 25 * supervisedUser = { | 25 * supervisedUser = { |
| 26 * id: "Supervised User ID", | 26 * id: "Supervised User ID", |
| 27 * name: "Supervised User Name", | 27 * name: "Supervised User Name", |
| 28 * iconURL: "chrome://path/to/icon/image", | 28 * iconURL: "chrome://path/to/icon/image", |
| 29 * onCurrentDevice: true or false, | 29 * onCurrentDevice: true or false, |
| 30 * needAvatar: true or false | 30 * needAvatar: true or false |
| 31 * } | 31 * } |
| 32 * @private | 32 * @private |
| 33 */ | 33 */ |
| 34 SupervisedUserListData.prototype.receiveExistingSupervisedUsers_ = | 34 SupervisedUserListData.prototype.receiveExistingSupervisedUsers_ = function( |
| 35 function(supervisedUsers) { | 35 supervisedUsers) { |
| 36 if (!this.promise_) { | 36 if (!this.promise_) { |
| 37 this.onDataChanged_(supervisedUsers); | 37 this.onDataChanged_(supervisedUsers); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 this.resolve_(supervisedUsers); | 40 this.resolve_(supervisedUsers); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Called when there is a signin error when retrieving the list of supervised | 44 * Called when there is a signin error when retrieving the list of supervised |
| 45 * users. Rejects the promise and resets the cached promise to null. | 45 * users. Rejects the promise and resets the cached promise to null. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 'removeObserver', | 141 'removeObserver', |
| 142 'requestExistingSupervisedUsers', | 142 'requestExistingSupervisedUsers', |
| 143 'resetPromise', | 143 'resetPromise', |
| 144 ]); | 144 ]); |
| 145 | 145 |
| 146 // Export | 146 // Export |
| 147 return { | 147 return { |
| 148 SupervisedUserListData: SupervisedUserListData, | 148 SupervisedUserListData: SupervisedUserListData, |
| 149 }; | 149 }; |
| 150 }); | 150 }); |
| OLD | NEW |