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

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: Remove name conflict checks. 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 $('create-new-user-link').onclick = function(event) { 68 $('create-new-user-link').onclick = function(event) {
69 OptionsPage.closeOverlay(); 69 OptionsPage.closeOverlay();
70 OptionsPage.navigateToPage('createProfile'); 70 OptionsPage.navigateToPage('createProfile');
71 }; 71 };
72 }, 72 },
73 73
74 /** 74 /**
75 * @override 75 * @override
76 */ 76 */
77 didShowPage: function() { 77 didShowPage: function() {
78 options.ManagedUserListData.requestExistingManagedUsers( 78 options.ManagedUserListData.requestExistingManagedUsers().then(
79 this.receiveExistingManagedUsers_, this.onSigninError_.bind(this)); 79 this.receiveExistingManagedUsers_, this.onSigninError_.bind(this));
80 80
81 this.updateImportInProgress_(false); 81 this.updateImportInProgress_(false);
82 $('managed-user-import-error-bubble').hidden = true; 82 $('managed-user-import-error-bubble').hidden = true;
83 $('managed-user-import-ok').disabled = true; 83 $('managed-user-import-ok').disabled = true;
84 $('select-avatar-grid').hidden = true; 84 $('select-avatar-grid').hidden = true;
85 $('managed-user-list').hidden = false; 85 $('managed-user-list').hidden = false;
86 86
87 $('managed-user-import-ok').textContent = 87 $('managed-user-import-ok').textContent =
88 loadTimeData.getString('managedUserImportOk'); 88 loadTimeData.getString('managedUserImportOk');
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 * needAvatar: true or false 170 * needAvatar: true or false
171 * } 171 * }
172 * @private 172 * @private
173 */ 173 */
174 receiveExistingManagedUsers_: function(managedUsers) { 174 receiveExistingManagedUsers_: function(managedUsers) {
175 managedUsers.sort(function(a, b) { 175 managedUsers.sort(function(a, b) {
176 if (a.onCurrentDevice != b.onCurrentDevice)
177 return a.onCurrentDevice ? 1 : -1;
176 return a.name.localeCompare(b.name); 178 return a.name.localeCompare(b.name);
177 }); 179 });
178 180
179 $('managed-user-list').dataModel = new ArrayDataModel(managedUsers); 181 $('managed-user-list').dataModel = new ArrayDataModel(managedUsers);
180 if (managedUsers.length == 0) { 182 if (managedUsers.length == 0) {
181 this.onError_(loadTimeData.getString('noExistingManagedUsers')); 183 this.onError_(loadTimeData.getString('noExistingManagedUsers'));
182 $('managed-user-import-ok').disabled = true; 184 $('managed-user-import-ok').disabled = true;
183 } else { 185 } else {
184 // Hide the error bubble. 186 // Hide the error bubble.
185 $('managed-user-import-error-bubble').hidden = true; 187 $('managed-user-import-error-bubble').hidden = true;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 var instance = ManagedUserImportOverlay.getInstance(); 225 var instance = ManagedUserImportOverlay.getInstance();
224 return instance[name + '_'].apply(instance, arguments); 226 return instance[name + '_'].apply(instance, arguments);
225 }; 227 };
226 }); 228 });
227 229
228 // Export 230 // Export
229 return { 231 return {
230 ManagedUserImportOverlay: ManagedUserImportOverlay, 232 ManagedUserImportOverlay: ManagedUserImportOverlay,
231 }; 233 };
232 }); 234 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698