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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 SupervisedUserListData.prototype.removeObserver_ = function(observer) { | 127 SupervisedUserListData.prototype.removeObserver_ = function(observer) { |
128 for (var i = 0; i < this.observers_.length; ++i) { | 128 for (var i = 0; i < this.observers_.length; ++i) { |
129 if (this.observers_[i] == observer) { | 129 if (this.observers_[i] == observer) { |
130 this.observers_.splice(i, 1); | 130 this.observers_.splice(i, 1); |
131 return; | 131 return; |
132 } | 132 } |
133 } | 133 } |
134 }; | 134 }; |
135 | 135 |
136 // Forward public APIs to private implementations. | 136 // Forward public APIs to private implementations. |
137 [ | 137 cr.makePublic(SupervisedUserListData, [ |
138 'addObserver', | 138 'addObserver', |
139 'onSigninError', | 139 'onSigninError', |
140 'receiveExistingSupervisedUsers', | 140 'receiveExistingSupervisedUsers', |
141 'removeObserver', | 141 'removeObserver', |
142 'requestExistingSupervisedUsers', | 142 'requestExistingSupervisedUsers', |
143 'resetPromise', | 143 'resetPromise', |
144 ].forEach(function(name) { | 144 ]); |
145 SupervisedUserListData[name] = function() { | |
146 var instance = SupervisedUserListData.getInstance(); | |
147 return instance[name + '_'].apply(instance, arguments); | |
148 }; | |
149 }); | |
150 | 145 |
151 // Export | 146 // Export |
152 return { | 147 return { |
153 SupervisedUserListData: SupervisedUserListData, | 148 SupervisedUserListData: SupervisedUserListData, |
154 }; | 149 }; |
155 }); | 150 }); |
OLD | NEW |