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..a182a6a9b8d4892df1d82fe51effbef9f7b00578 100644 |
--- a/chrome/browser/resources/options/managed_user_import.js |
+++ b/chrome/browser/resources/options/managed_user_import.js |
@@ -36,6 +36,8 @@ cr.define('options', function() { |
// Call base class implementation to start preference initialization. |
OptionsPage.prototype.initializePage.call(this); |
+ var self = this; |
Sergiu
2013/09/16 08:46:04
I'd move this just before the onclick handler, it'
ibra
2013/09/16 09:04:15
Done.
|
+ |
var managedUserList = $('managed-user-list'); |
options.managedUserOptions.ManagedUserList.decorate(managedUserList); |
@@ -55,6 +57,8 @@ cr.define('options', function() { |
$('managed-user-import-cancel').onclick = function(event) { |
OptionsPage.closeOverlay(); |
+ self.updateImportInProgress_(false); |
+ |
// 'cancelCreateProfile' is handled by BrowserOptionsHandler. |
chrome.send('cancelCreateProfile'); |
}; |
@@ -84,6 +88,8 @@ cr.define('options', function() { |
loadTimeData.getString('managedUserImportText'); |
$('managed-user-import-title').textContent = |
loadTimeData.getString('managedUserImportTitle'); |
+ |
+ this.updateImportInProgress_(false); |
}, |
/** |
@@ -106,10 +112,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 +144,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 +191,7 @@ cr.define('options', function() { |
var errorBubble = $('managed-user-import-error-bubble'); |
errorBubble.hidden = false; |
errorBubble.textContent = error; |
+ this.updateImportInProgress_(false); |
}, |
/** |
@@ -177,6 +199,7 @@ cr.define('options', function() { |
* @private |
*/ |
onSuccess_: function() { |
+ this.updateImportInProgress_(false); |
OptionsPage.closeOverlay(); |
}, |
}; |