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

Unified Diff: chrome/browser/resources/options/managed_user_import.js

Issue 23533047: Add spinner to the 'managed user import' overlay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@choose_avatar_one_overlay
Patch Set: sergiu@ Created 7 years, 3 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
« no previous file with comments | « chrome/browser/resources/options/managed_user_import.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
},
};
« no previous file with comments | « chrome/browser/resources/options/managed_user_import.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698