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 1a9f6e33e2869a4e62d8a42ee4456bd3c428bdb9..5d193b409744093bc2fbd1013276420a97dd5771 100644 |
--- a/chrome/browser/resources/options/managed_user_import.js |
+++ b/chrome/browser/resources/options/managed_user_import.js |
@@ -53,8 +53,11 @@ cr.define('options', function() { |
managedUserList.selectedItem.onCurrentDevice; |
}); |
+ var self = this; |
$('managed-user-import-cancel').onclick = function(event) { |
OptionsPage.closeOverlay(); |
+ self.updateImportInProgress_(false); |
+ |
// 'cancelCreateProfile' is handled by BrowserOptionsHandler. |
chrome.send('cancelCreateProfile'); |
}; |
@@ -73,6 +76,8 @@ cr.define('options', function() { |
*/ |
didShowPage: function() { |
chrome.send('requestExistingManagedUsers'); |
+ |
+ this.updateImportInProgress_(false); |
$('managed-user-import-error-bubble').hidden = true; |
$('managed-user-import-ok').disabled = true; |
$('select-avatar-grid').hidden = true; |
@@ -106,10 +111,11 @@ cr.define('options', function() { |
return; |
} |
- $('managed-user-import-ok').disabled = true; |
var avatarUrl = managedUser.needAvatar ? |
$('select-avatar-grid').selectedItem : managedUser.iconURL; |
+ this.updateImportInProgress_(true); |
+ |
// 'createProfile' is handled by BrowserOptionsHandler. |
chrome.send('createProfile', [managedUser.name, avatarUrl, |
false, true, managedUser.id]); |
@@ -137,6 +143,20 @@ cr.define('options', function() { |
}, |
/** |
+ * Updates the UI according to the importing state. |
+ * @param {boolean} inProgress True to indicate that |
+ * importing is in progress and false otherwise. |
+ * @private |
+ */ |
+ updateImportInProgress_: function(inProgress) { |
+ $('managed-user-import-ok').disabled = inProgress; |
+ $('managed-user-list').disabled = inProgress; |
+ $('select-avatar-grid').disabled = inProgress; |
+ $('create-new-user-link').disabled = inProgress; |
+ $('managed-user-import-throbber').hidden = !inProgress; |
+ }, |
+ |
+ /** |
* Adds all the existing |managedUsers| to the list. |
* @param {Array.<Object>} managedUsers An array of managed user objects. |
* Each object is of the form: |
@@ -170,6 +190,7 @@ cr.define('options', function() { |
var errorBubble = $('managed-user-import-error-bubble'); |
errorBubble.hidden = false; |
errorBubble.textContent = error; |
+ this.updateImportInProgress_(false); |
}, |
/** |
@@ -177,6 +198,7 @@ cr.define('options', function() { |
* @private |
*/ |
onSuccess_: function() { |
+ this.updateImportInProgress_(false); |
OptionsPage.closeOverlay(); |
}, |
}; |