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

Side by Side Diff: chrome/browser/resources/options/managed_user_import.js

Issue 132013002: Replace own callback handling with Promises. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var ArrayDataModel = cr.ui.ArrayDataModel; 7 var ArrayDataModel = cr.ui.ArrayDataModel;
8 8
9 /** 9 /**
10 * ManagedUserImportOverlay class. 10 * ManagedUserImportOverlay class.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 /** 161 /**
162 * Sets the data model of the managed user list to |managedUsers|. 162 * Sets the data model of the managed user list to |managedUsers|.
163 * @param {Array.<Object>} managedUsers An array of managed user objects. 163 * @param {Array.<Object>} managedUsers An array of managed user objects.
164 * Each object is of the form: 164 * Each object is of the form:
165 * managedUser = { 165 * managedUser = {
166 * id: "Managed User ID", 166 * id: "Managed User ID",
167 * name: "Managed User Name", 167 * name: "Managed User Name",
168 * iconURL: "chrome://path/to/icon/image", 168 * iconURL: "chrome://path/to/icon/image",
169 * onCurrentDevice: true or false, 169 * onCurrentDevice: true or false,
170 * nameConflict: true or false,
170 * needAvatar: true or false 171 * needAvatar: true or false
171 * } 172 * }
172 * @private 173 * @private
173 */ 174 */
174 receiveExistingManagedUsers_: function(managedUsers) { 175 receiveExistingManagedUsers_: function(managedUsers) {
175 managedUsers.sort(function(a, b) { 176 managedUsers.sort(function(a, b) {
177 if (a.onCurrentDevice != b.onCurrentDevice)
178 return a.onCurrentDevice ? 1 : -1;
179 if (a.nameConflict != b.nameConflict)
180 return a.nameConflict ? 1 : -1;
176 return a.name.localeCompare(b.name); 181 return a.name.localeCompare(b.name);
177 }); 182 });
178 183
179 $('managed-user-list').dataModel = new ArrayDataModel(managedUsers); 184 $('managed-user-list').dataModel = new ArrayDataModel(managedUsers);
180 if (managedUsers.length == 0) { 185 if (managedUsers.length == 0) {
181 this.onError_(loadTimeData.getString('noExistingManagedUsers')); 186 this.onError_(loadTimeData.getString('noExistingManagedUsers'));
182 $('managed-user-import-ok').disabled = true; 187 $('managed-user-import-ok').disabled = true;
183 } else { 188 } else {
184 // Hide the error bubble. 189 // Hide the error bubble.
185 $('managed-user-import-error-bubble').hidden = true; 190 $('managed-user-import-error-bubble').hidden = true;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 var instance = ManagedUserImportOverlay.getInstance(); 228 var instance = ManagedUserImportOverlay.getInstance();
224 return instance[name + '_'].apply(instance, arguments); 229 return instance[name + '_'].apply(instance, arguments);
225 }; 230 };
226 }); 231 });
227 232
228 // Export 233 // Export
229 return { 234 return {
230 ManagedUserImportOverlay: ManagedUserImportOverlay, 235 ManagedUserImportOverlay: ManagedUserImportOverlay,
231 }; 236 };
232 }); 237 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698