| Index: chrome/browser/resources/options/supervised_user_list_data.js
|
| diff --git a/chrome/browser/resources/options/managed_user_list_data.js b/chrome/browser/resources/options/supervised_user_list_data.js
|
| similarity index 51%
|
| rename from chrome/browser/resources/options/managed_user_list_data.js
|
| rename to chrome/browser/resources/options/supervised_user_list_data.js
|
| index 91619ede6a83cb923920f0da8fa8eff6e5d1d946..407634778bf64f6236be10f19fc01684f79079b9 100644
|
| --- a/chrome/browser/resources/options/managed_user_list_data.js
|
| +++ b/chrome/browser/resources/options/supervised_user_list_data.js
|
| @@ -4,77 +4,78 @@
|
|
|
| cr.define('options', function() {
|
| /**
|
| - * ManagedUserListData class.
|
| - * Handles requests for retrieving a list of existing managed users which are
|
| - * supervised by the current profile. For each request a promise is returned,
|
| - * which is cached in order to reuse the retrieved managed users for future
|
| - * requests. The first request will be handled asynchronously.
|
| + * SupervisedUserListData class.
|
| + * Handles requests for retrieving a list of existing supervised users which
|
| + * are supervised by the current profile. For each request a promise is
|
| + * returned, which is cached in order to reuse the retrieved supervised users
|
| + * for future requests. The first request will be handled asynchronously.
|
| * @constructor
|
| * @class
|
| */
|
| - function ManagedUserListData() {
|
| + function SupervisedUserListData() {
|
| this.observers_ = [];
|
| };
|
|
|
| - cr.addSingletonGetter(ManagedUserListData);
|
| + cr.addSingletonGetter(SupervisedUserListData);
|
|
|
| /**
|
| - * Receives a list of managed users and resolves the promise.
|
| - * @param {Array.<Object>} managedUsers An array of managed user objects.
|
| + * Receives a list of supervised users and resolves the promise.
|
| + * @param {Array.<Object>} supervisedUsers Array of supervised user objects.
|
| * Each object is of the form:
|
| - * managedUser = {
|
| - * id: "Managed User ID",
|
| - * name: "Managed User Name",
|
| + * supervisedUser = {
|
| + * id: "Supervised User ID",
|
| + * name: "Supervised User Name",
|
| * iconURL: "chrome://path/to/icon/image",
|
| * onCurrentDevice: true or false,
|
| * needAvatar: true or false
|
| * }
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.receiveExistingManagedUsers_ = function(
|
| - managedUsers) {
|
| + SupervisedUserListData.prototype.receiveExistingSupervisedUsers_ = function(
|
| + supervisedUsers) {
|
| if (!this.promise_) {
|
| - this.onDataChanged_(managedUsers);
|
| + this.onDataChanged_(supervisedUsers);
|
| return;
|
| }
|
| - this.resolve_(managedUsers);
|
| + this.resolve_(supervisedUsers);
|
| };
|
|
|
| /**
|
| - * Called when there is a signin error when retrieving the list of managed
|
| + * Called when there is a signin error when retrieving the list of supervised
|
| * users. Rejects the promise and resets the cached promise to null.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.onSigninError_ = function() {
|
| + SupervisedUserListData.prototype.onSigninError_ = function() {
|
| assert(this.promise_);
|
| this.reject_();
|
| this.resetPromise_();
|
| };
|
|
|
| /**
|
| - * Handles the request for the list of existing managed users by returning a
|
| - * promise for the requested data. If there is no cached promise yet, a new
|
| + * Handles the request for the list of existing supervised users by returning
|
| + * a promise for the requested data. If there is no cached promise yet, a new
|
| * one will be created.
|
| - * @return {Promise} The promise containing the list of managed users.
|
| + * @return {Promise} The promise containing the list of supervised users.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.requestExistingManagedUsers_ = function() {
|
| + SupervisedUserListData.prototype.requestExistingSupervisedUsers_ =
|
| + function() {
|
| if (this.promise_)
|
| return this.promise_;
|
| this.promise_ = this.createPromise_();
|
| - chrome.send('requestManagedUserImportUpdate');
|
| + chrome.send('requestSupervisedUserImportUpdate');
|
| return this.promise_;
|
| };
|
|
|
| /**
|
| - * Creates the promise containing the list of managed users. The promise is
|
| - * resolved in receiveExistingManagedUsers_() or rejected in
|
| + * Creates the promise containing the list of supervised users. The promise is
|
| + * resolved in receiveExistingSupervisedUsers_() or rejected in
|
| * onSigninError_(). The promise is cached, so that for future requests it can
|
| * be resolved immediately.
|
| - * @return {Promise} The promise containing the list of managed users.
|
| + * @return {Promise} The promise containing the list of supervised users.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.createPromise_ = function() {
|
| + SupervisedUserListData.prototype.createPromise_ = function() {
|
| var self = this;
|
| return new Promise(function(resolve, reject) {
|
| self.resolve_ = resolve;
|
| @@ -87,22 +88,22 @@ cr.define('options', function() {
|
| * request, a new promise will be created.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.resetPromise_ = function() {
|
| + SupervisedUserListData.prototype.resetPromise_ = function() {
|
| this.promise_ = null;
|
| };
|
|
|
| /**
|
| * Initializes |promise| with the new data and also passes the new data to
|
| * observers.
|
| - * @param {Array.<Object>} managedUsers An array of managed user objects.
|
| - * For the format of the objects, see receiveExistingManagedUsers_().
|
| + * @param {Array.<Object>} supervisedUsers Array of supervised user objects.
|
| + * For the format of the objects, see receiveExistingSupervisedUsers_().
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.onDataChanged_ = function(managedUsers) {
|
| + SupervisedUserListData.prototype.onDataChanged_ = function(supervisedUsers) {
|
| this.promise_ = this.createPromise_();
|
| - this.resolve_(managedUsers);
|
| + this.resolve_(supervisedUsers);
|
| for (var i = 0; i < this.observers_.length; ++i)
|
| - this.observers_[i].receiveExistingManagedUsers_(managedUsers);
|
| + this.observers_[i].receiveExistingSupervisedUsers_(supervisedUsers);
|
| };
|
|
|
| /**
|
| @@ -110,7 +111,7 @@ cr.define('options', function() {
|
| * @param {Object} observer The observer to be added.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.addObserver_ = function(observer) {
|
| + SupervisedUserListData.prototype.addObserver_ = function(observer) {
|
| for (var i = 0; i < this.observers_.length; ++i)
|
| assert(this.observers_[i] != observer);
|
| this.observers_.push(observer);
|
| @@ -121,7 +122,7 @@ cr.define('options', function() {
|
| * @param {Object} observer The observer to be removed.
|
| * @private
|
| */
|
| - ManagedUserListData.prototype.removeObserver_ = function(observer) {
|
| + SupervisedUserListData.prototype.removeObserver_ = function(observer) {
|
| for (var i = 0; i < this.observers_.length; ++i) {
|
| if (this.observers_[i] == observer) {
|
| this.observers_.splice(i, 1);
|
| @@ -134,19 +135,19 @@ cr.define('options', function() {
|
| [
|
| 'addObserver',
|
| 'onSigninError',
|
| - 'receiveExistingManagedUsers',
|
| + 'receiveExistingSupervisedUsers',
|
| 'removeObserver',
|
| - 'requestExistingManagedUsers',
|
| + 'requestExistingSupervisedUsers',
|
| 'resetPromise',
|
| ].forEach(function(name) {
|
| - ManagedUserListData[name] = function() {
|
| - var instance = ManagedUserListData.getInstance();
|
| + SupervisedUserListData[name] = function() {
|
| + var instance = SupervisedUserListData.getInstance();
|
| return instance[name + '_'].apply(instance, arguments);
|
| };
|
| });
|
|
|
| // Export
|
| return {
|
| - ManagedUserListData: ManagedUserListData,
|
| + SupervisedUserListData: SupervisedUserListData,
|
| };
|
| });
|
|
|