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

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

Issue 23875002: Correctly update enabled state of the "create managed user" checkbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
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 200fcca26ae805f8959dde90dff384e7fd781501..8ba25f47aa0f5e5b6e0c36fe657a0473f493e99e 100644
--- a/chrome/browser/resources/options/manage_profile_overlay.js
+++ b/chrome/browser/resources/options/manage_profile_overlay.js
@@ -514,10 +514,12 @@ cr.define('options', function() {
* @private
*/
updateCreateInProgress_: function(inProgress) {
+ this.createInProgress_ = inProgress;
+ this.updateCreateManagedUserCheckbox_();
+
$('create-profile-icon-grid').disabled = inProgress;
$('create-profile-name').disabled = inProgress;
$('create-shortcut').disabled = inProgress;
- $('create-profile-managed').disabled = inProgress;
$('create-profile-ok').disabled = inProgress;
$('create-profile-throbber').hidden = !inProgress;
@@ -620,7 +622,7 @@ cr.define('options', function() {
},
/**
- * Updates the status of the "create managed user" checkbox. Called by the
+ * Sets whether creating managed users is allowed or not. Called by the
* handler in response to the 'requestCreateProfileUpdate' message or a
* change in the (policy-controlled) pref that prohibits creating managed
* users, after the signed-in status has been updated.
@@ -629,9 +631,8 @@ cr.define('options', function() {
* @private
*/
updateManagedUsersAllowed_: function(allowed) {
- var isSignedIn = this.signedInEmail_ !== '';
- $('create-profile-managed').disabled =
- !isSignedIn || !allowed || this.hasError_;
+ this.managedUsersAllowed_ = allowed;
+ this.updateCreateManagedUserCheckbox_();
$('create-profile-managed-not-signed-in-link').hidden = !allowed;
if (!allowed) {
@@ -641,6 +642,19 @@ cr.define('options', function() {
$('create-profile-managed-indicator').removeAttribute('controlled-by');
}
},
+
+ /**
+ * Updates the status of the "create managed user" checkbox. Called from
+ * updateManagedUsersAllowed_() or updateCreateInProgress_().
+ * updateSignedInStatus_() does not call this method directly, because it
+ * will be followed by a call to updateManagedUsersAllowed_().
+ * @private
+ */
+ updateCreateManagedUserCheckbox_: function() {
+ $('create-profile-managed').disabled =
+ !this.managedUsersAllowed_ || this.createInProgress_ ||
+ this.signedInEmail_ == '' || this.hasError_;
+ },
};
// Forward public APIs to private implementations.

Powered by Google App Engine
This is Rietveld 408576698