Chromium Code Reviews| Index: chrome/browser/resources/options/manage_profile_overlay.js |
| =================================================================== |
| --- chrome/browser/resources/options/manage_profile_overlay.js (revision 202001) |
| +++ chrome/browser/resources/options/manage_profile_overlay.js (working copy) |
| @@ -48,6 +48,13 @@ |
| self.registerCommonEventHandlers_('manage', |
| self.submitManageChanges_.bind(self)); |
| + // Override the create-profile-ok handler, to avoid closing the overlay |
| + // until we finish creating the profile. |
|
Andrew T Wilson (Slow)
2013/05/27 12:02:43
Do we need to guard against multiple clicks by dis
Pam (message me for reviews)
2013/05/27 14:34:37
I'd been pondering that. I don't think there's act
|
| + $('create-profile-ok').onclick = function(event) { |
| + ManageProfileOverlay.getInstance().hideErrorBubble_('create'); |
| + self.submitCreateProfile_(); |
| + }; |
| + |
| if (loadTimeData.getBoolean('managedUsersEnabled')) { |
| $('create-profile-limited-container').hidden = false; |
| } |
| @@ -231,12 +238,13 @@ |
| * 'manage'). |
|
Andrew T Wilson (Slow)
2013/05/27 12:02:43
document new parameter.
|
| * @private |
| */ |
| - showErrorBubble_: function(errorText, mode) { |
| + showErrorBubble_: function(errorText, mode, disableOKButton) { |
| var nameErrorEl = $(mode + '-profile-error-bubble'); |
| nameErrorEl.hidden = false; |
| nameErrorEl.textContent = loadTimeData.getString(errorText); |
| - $(mode + '-profile-ok').disabled = true; |
| + if (disableOKButton) |
| + $(mode + '-profile-ok').disabled = true; |
| }, |
| /** |
| @@ -266,7 +274,7 @@ |
| if (newName == oldName) { |
| this.hideErrorBubble_(mode); |
| } else if (this.profileNames_[newName] != undefined) { |
| - this.showErrorBubble_('manageProfilesDuplicateNameError', mode); |
| + this.showErrorBubble_('manageProfilesDuplicateNameError', mode, true); |
| } else { |
| this.hideErrorBubble_(mode); |
| @@ -300,6 +308,8 @@ |
| var iconUrl = $('create-profile-icon-grid').selectedItem; |
| var createShortcut = $('create-shortcut').checked; |
| var isManaged = $('create-profile-limited').checked; |
| + |
| + // 'createProfile' is handled by the BrowserOptionsHandler. |
| chrome.send('createProfile', |
| [name, iconUrl, createShortcut, isManaged]); |
| }, |
| @@ -418,7 +428,7 @@ |
| $('manage-profile-overlay-delete').hidden = true; |
| $('create-profile-instructions').textContent = |
| loadTimeData.getStringF('createProfileInstructions'); |
| - ManageProfileOverlay.getInstance().hideErrorBubble_('create'); |
| + this.hideErrorBubble_(); |
| var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); |
| $('create-shortcut-container').hidden = !shortcutsEnabled; |
| @@ -429,7 +439,42 @@ |
| $('create-profile-ok').disabled = true; |
| }, |
| + /** @override */ |
| + showErrorBubble_: function(errorText) { |
| + ManageProfileOverlay.getInstance().showErrorBubble_(errorText, |
| + 'create', |
| + false); |
| + }, |
| + |
| + /** @override */ |
| + hideErrorBubble_: function() { |
| + ManageProfileOverlay.getInstance().hideErrorBubble_('create'); |
| + }, |
| + |
| /** |
| + * Shows an error message describing a local error (most likely a disk |
| + * error) when creating a new profile. Called by BrowserOptions via the |
| + * BrowserOptionsHandler. |
| + * @private |
| + */ |
| + onLocalError_: function() { |
| + this.showErrorBubble_('createProfileLocalError'); |
| + }, |
| + |
| + /** |
| + * For new limited users, shows a confirmation page after successfully |
| + * creating a new profile; otherwise, the handler will open a new window. |
| + * @private |
| + */ |
| + onSuccess_: function(is_managed) { |
|
Pam (message me for reviews)
2013/05/27 08:17:25
I will change this to isManaged before committing.
|
| + OptionsPage.closeOverlay(); |
| + if (is_managed) { |
| + // TODO(pamg): Fill out this stub. |
| + console.log('Success - show confirmation'); |
| + } |
| + }, |
| + |
| + /** |
| * Updates the signed-in or not-signed-in UI when in create mode. Called by |
| * the handler in response to the 'requestSignedInText' message. |
| * @param {string} text The text to show for a signed-in user. An empty |
| @@ -448,6 +493,8 @@ |
| // Forward public APIs to private implementations. |
| [ |
| + 'onLocalError', |
| + 'onSuccess', |
| 'updateSignedInStatus', |
| ].forEach(function(name) { |
| CreateProfileOverlay[name] = function() { |