Index: chrome/browser/resources/options/manage_profile_overlay.js |
diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js |
index a1bfab6a7ba80a70599a442e33aad3d265f350f4..05cc9d1e7c8b7bd6f567804c1775bcf993ee8d88 100644 |
--- a/chrome/browser/resources/options/manage_profile_overlay.js |
+++ b/chrome/browser/resources/options/manage_profile_overlay.js |
@@ -335,24 +335,39 @@ cr.define('options', function() { |
updateCreateOrImport_: function(mode) { |
// In 'create' mode, check for existing supervised users with the same |
// name. |
- if (mode == 'create' && $('create-profile-supervised').checked) { |
- options.SupervisedUserListData.requestExistingSupervisedUsers().then( |
- this.receiveExistingSupervisedUsers_.bind(this), |
- this.onSigninError_.bind(this)); |
+ if (mode == 'create') { |
+ this.requestExistingSupervisedUsers_(); |
} else { |
this.updateOkButton_(mode); |
} |
}, |
/** |
+ * Tries to get the list of existing supervised users and updates the UI |
+ * accordingly. |
+ * @private |
+ */ |
+ requestExistingSupervisedUsers_: function() { |
+ options.SupervisedUserListData.requestExistingSupervisedUsers().then( |
+ this.receiveExistingSupervisedUsers_.bind(this), |
+ this.onSigninError_.bind(this)); |
+ }, |
+ |
+ /** |
* Callback which receives the list of existing supervised users. Checks if |
* the currently entered name is the name of an already existing supervised |
* user. If yes, the user is prompted to import the existing supervised |
* user, and the create button is disabled. |
+ * If the received list is empty, hides the "import" link. |
* @param {Array.<Object>} The list of existing supervised users. |
* @private |
*/ |
receiveExistingSupervisedUsers_: function(supervisedUsers) { |
+ $('import-existing-supervised-user-link').hidden = |
+ supervisedUsers.length === 0; |
+ if (!$('create-profile-supervised').checked) |
+ return; |
+ |
var newName = $('create-profile-name').value; |
var i; |
for (i = 0; i < supervisedUsers.length; ++i) { |
@@ -787,6 +802,8 @@ cr.define('options', function() { |
} |
this.updateImportExistingSupervisedUserLink_(isSignedIn && !hasError); |
+ if (isSignedIn) |
+ this.requestExistingSupervisedUsers_(); |
}, |
/** |
@@ -799,7 +816,8 @@ cr.define('options', function() { |
updateImportExistingSupervisedUserLink_: function(enable) { |
var importSupervisedUserElement = |
$('import-existing-supervised-user-link'); |
- importSupervisedUserElement.hidden = false; |
+ if (!enable) |
Pam (message me for reviews)
2014/08/06 23:36:36
This check is backwards, and it's not quite what w
Marc Treib
2014/08/07 07:39:34
When we're not signed in, the link is disabled (i.
|
+ importSupervisedUserElement.hidden = false; |
importSupervisedUserElement.disabled = !enable || this.createInProgress_; |
importSupervisedUserElement.textContent = enable ? |
loadTimeData.getString('importExistingSupervisedUserLink') : |