Index: chrome/browser/resources/md_user_manager/create_profile.js |
diff --git a/chrome/browser/resources/md_user_manager/create_profile.js b/chrome/browser/resources/md_user_manager/create_profile.js |
index 1469f1a38e077e8a2fc574567c90dc561a827a28..cc5a0c3f5e7e78353538a66700f58a06bcacf973 100644 |
--- a/chrome/browser/resources/md_user_manager/create_profile.js |
+++ b/chrome/browser/resources/md_user_manager/create_profile.js |
@@ -41,10 +41,10 @@ Polymer({ |
}, |
/** |
- * The currently selected profile icon URL. May be a data URL. |
- * @private {string} |
+ * The currently selected profile avatar, if any. |
+ * @private {?AvatarIcon} |
*/ |
- profileIconUrl_: {type: String, value: ''}, |
+ selectedAvatar_: Object, |
/** |
* True if the existing supervised users are being loaded. |
@@ -142,8 +142,9 @@ Polymer({ |
'create-profile-warning', this.handleMessage_.bind(this)); |
this.addWebUIListener( |
'create-profile-error', this.handleMessage_.bind(this)); |
- this.addWebUIListener( |
- 'profile-icons-received', this.handleProfileIcons_.bind(this)); |
+ this.addWebUIListener('profile-icons-received', function(icons) { |
+ this.availableIcons_ = icons; |
+ }.bind(this)); |
this.addWebUIListener( |
'profile-defaults-received', this.handleProfileDefaults_.bind(this)); |
this.addWebUIListener( |
@@ -182,16 +183,6 @@ Polymer({ |
} |
}, |
- /** |
- * Handler for when the profile icons are pushed from the browser. |
- * @param {!Array<!AvatarIcon>} icons |
- * @private |
- */ |
- handleProfileIcons_: function(icons) { |
- this.availableIcons_ = icons; |
- this.profileIconUrl_ = icons[0].url; |
- }, |
- |
/** |
* Handler for when the profile defaults are pushed from the browser. |
* @param {!ProfileInfo} profileInfo Default Info for the new profile. |
@@ -365,8 +356,10 @@ Polymer({ |
this.createInProgress_ = true; |
var createShortcut = |
this.isProfileShortcutsEnabled_ && this.createShortcut_; |
+ // Select the 1st avatar if none selected. |
+ var selectedAvatar = this.selectedAvatar_ || this.availableIcons_[0]; |
this.browserProxy_.createProfile( |
- this.profileName_, this.profileIconUrl_, createShortcut, |
+ this.profileName_, selectedAvatar.url, createShortcut, |
this.isSupervised_, '', custodianProfilePath); |
}, |
@@ -469,17 +462,6 @@ Polymer({ |
return this.i18nAdvanced(id, opts); |
}, |
- /** |
- * Computed binding determining which profile icon button is toggled on. |
- * @param {string} iconUrl icon URL of a given icon button. |
- * @param {string} profileIconUrl Currently selected icon URL. |
- * @return {boolean} |
- * @private |
- */ |
- isActiveIcon_: function(iconUrl, profileIconUrl) { |
- return iconUrl == profileIconUrl; |
- }, |
- |
/** |
* Computed binding determining whether the paper-spinner is active. |
* @param {boolean} createInProgress Is create in progress? |