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

Side by Side Diff: chrome/browser/resources/settings/people_page/manage_profile.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-manage-profile' is the settings subpage containing controls to 7 * 'settings-manage-profile' is the settings subpage containing controls to
8 * edit a profile's name, icon, and desktop shortcut. 8 * edit a profile's name, icon, and desktop shortcut.
9 */ 9 */
10 Polymer({ 10 Polymer({
11 is: 'settings-manage-profile', 11 is: 'settings-manage-profile',
12 12
13 behaviors: [WebUIListenerBehavior, settings.RouteObserverBehavior], 13 behaviors: [WebUIListenerBehavior, settings.RouteObserverBehavior],
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * The currently selected profile icon URL. May be a data URL. 17 * The newly selected avatar. Populated only if the user manually changes
18 * the avatar selection. The observer ensures that the changes are
19 * propagated to the C++.
20 * @private
18 */ 21 */
19 profileIconUrl: String, 22 profileAvatar_: {
23 type: Object,
24 observer: 'profileAvatarChanged_',
25 },
20 26
21 /** 27 /**
22 * The current profile name. 28 * The current profile name.
23 */ 29 */
24 profileName: String, 30 profileName: String,
25 31
26 /** 32 /**
27 * True if the current profile has a shortcut. 33 * True if the current profile has a shortcut.
28 */ 34 */
29 hasProfileShortcut_: Boolean, 35 hasProfileShortcut_: Boolean,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 * @private 113 * @private
108 */ 114 */
109 onProfileNameKeydown_: function(event) { 115 onProfileNameKeydown_: function(event) {
110 if (event.key == 'Escape') { 116 if (event.key == 'Escape') {
111 event.target.value = this.profileName; 117 event.target.value = this.profileName;
112 event.target.blur(); 118 event.target.blur();
113 } 119 }
114 }, 120 },
115 121
116 /** 122 /**
117 * Handler for when an avatar is activated. 123 * Handler for when the profile avatar is changed by the user.
118 * @param {!Event} event
119 * @private 124 * @private
120 */ 125 */
121 onIconActivate_: function(event) { 126 profileAvatarChanged_: function() {
122 // Explicitly test against undefined, because even when an element has the 127 if (this.profileAvatar_.isGaiaAvatar)
123 // data-is-gaia-avatar attribute, dataset.isGaiaAvatar returns an empty
124 // string, which is falsy.
125 var isGaiaAvatar = event.detail.item.dataset.isGaiaAvatar !== undefined;
126
127 if (isGaiaAvatar)
128 this.browserProxy_.setProfileIconToGaiaAvatar(); 128 this.browserProxy_.setProfileIconToGaiaAvatar();
129 else 129 else
130 this.browserProxy_.setProfileIconToDefaultAvatar(event.detail.selected); 130 this.browserProxy_.setProfileIconToDefaultAvatar(this.profileAvatar_.url);
131 }, 131 },
132 132
133 /** 133 /**
134 * @param {?settings.SyncStatus} syncStatus 134 * @param {?settings.SyncStatus} syncStatus
135 * @return {boolean} Whether the profile name field is disabled. 135 * @return {boolean} Whether the profile name field is disabled.
136 * @private 136 * @private
137 */ 137 */
138 isProfileNameDisabled_: function(syncStatus) { 138 isProfileNameDisabled_: function(syncStatus) {
139 return !!syncStatus.supervisedUser && !syncStatus.childUser; 139 return !!syncStatus.supervisedUser && !syncStatus.childUser;
140 }, 140 },
141 141
142 /** 142 /**
143 * Handler for when the profile shortcut toggle is changed. 143 * Handler for when the profile shortcut toggle is changed.
144 * @param {!Event} event 144 * @param {!Event} event
145 * @private 145 * @private
146 */ 146 */
147 onHasProfileShortcutChange_: function(event) { 147 onHasProfileShortcutChange_: function(event) {
148 if (this.hasProfileShortcut_) { 148 if (this.hasProfileShortcut_) {
149 this.browserProxy_.addProfileShortcut(); 149 this.browserProxy_.addProfileShortcut();
150 } else { 150 } else {
151 this.browserProxy_.removeProfileShortcut(); 151 this.browserProxy_.removeProfileShortcut();
152 } 152 }
153 } 153 }
154 }); 154 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698