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

Unified 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: Address review comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/managed_user_import.js
diff --git a/chrome/browser/resources/options/managed_user_import.js b/chrome/browser/resources/options/managed_user_import.js
index 0152169cb6be4bc018ee41e72983e626d595bbf6..8ab2b96b78e9ef73f1b8885e78d8b3b5f860cd35 100644
--- a/chrome/browser/resources/options/managed_user_import.js
+++ b/chrome/browser/resources/options/managed_user_import.js
@@ -50,7 +50,8 @@ cr.define('options', function() {
return;
$('managed-user-import-ok').disabled =
- managedUserList.selectedItem.onCurrentDevice;
+ managedUserList.selectedItem.onCurrentDevice ||
+ managedUserList.selectedItem.nameConflict;
});
var self = this;
@@ -75,7 +76,7 @@ cr.define('options', function() {
* @override
*/
didShowPage: function() {
- options.ManagedUserListData.requestExistingManagedUsers(
+ options.ManagedUserListData.requestExistingManagedUsers().then(
this.receiveExistingManagedUsers_, this.onSigninError_.bind(this));
this.updateImportInProgress_(false);
@@ -167,12 +168,17 @@ cr.define('options', function() {
* name: "Managed User Name",
* iconURL: "chrome://path/to/icon/image",
* onCurrentDevice: true or false,
+ * nameConflict: true or false,
* needAvatar: true or false
* }
* @private
*/
receiveExistingManagedUsers_: function(managedUsers) {
managedUsers.sort(function(a, b) {
+ if (a.onCurrentDevice != b.onCurrentDevice)
+ return a.onCurrentDevice ? 1 : -1;
+ if (a.nameConflict != b.nameConflict)
+ return a.nameConflict ? 1 : -1;
return a.name.localeCompare(b.name);
});

Powered by Google App Engine
This is Rietveld 408576698