Index: ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js |
diff --git a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js |
index aca65d6834e8f4ac834219f6f2776702b5942567..c09ce7936561a38b3d17d3afb65040bff7d4f55e 100644 |
--- a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js |
+++ b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js |
@@ -30,10 +30,16 @@ Polymer({ |
}, |
/** |
- * The currently selected profile avatar URL. May be a data URI. |
- * @type {string} |
+ * The currently selected profile avatar icon, if any. |
+ * @type {?AvatarIcon} |
*/ |
- selectedAvatarUrl: {type: String, notify: true}, |
+ selectedAvatar: { |
+ type: Object, |
+ notify: true, |
+ }, |
+ |
+ /** @private {?HTMLElement} */ |
+ selectedAvatarElement_: Object, |
ignoreModifiedKeyEvents: { |
type: Boolean, |
@@ -49,4 +55,20 @@ Polymer({ |
getIconImageset_: function(iconUrl) { |
return cr.icon.getImage(iconUrl); |
}, |
+ |
+ /** |
+ * @param {!Event} e |
+ * @private |
+ */ |
+ onAvatarTap_: function(e) { |
+ // TODO(dpapad): Rename 'iron-selected' to 'selected' now that this CSS |
+ // class is not assigned by any iron-* behavior. |
+ if (this.selectedAvatarElement_) |
+ this.selectedAvatarElement_.classList.remove('iron-selected'); |
+ |
+ this.selectedAvatarElement_ = /** @type {!HTMLElement} */ (e.target); |
+ this.selectedAvatarElement_.classList.add('iron-selected'); |
+ this.selectedAvatar = |
+ /** @type {!{model: {item: !AvatarIcon}}} */ (e).model.item; |
+ }, |
}); |