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

Unified Diff: ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js

Issue 2950943002: MD Settings: Stop using IronMenuBehavior from cr-profile-avatar-selector-grid. (Closed)
Patch Set: Added comment. Created 3 years, 6 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: 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;
+ },
});

Powered by Google App Engine
This is Rietveld 408576698