| OLD | NEW |
| 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({ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 this.isProfileShortcutSettingVisible_ = true; | 84 this.isProfileShortcutSettingVisible_ = true; |
| 85 this.hasProfileShortcut_ = | 85 this.hasProfileShortcut_ = |
| 86 status == ProfileShortcutStatus.PROFILE_SHORTCUT_FOUND; | 86 status == ProfileShortcutStatus.PROFILE_SHORTCUT_FOUND; |
| 87 }.bind(this)); | 87 }.bind(this)); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 }, | 90 }, |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * Handler for when the profile name field is changed, then blurred. | 93 * Handler for when the profile name field is changed, then blurred. |
| 94 * @param {!Event} event |
| 94 * @private | 95 * @private |
| 95 * @param {!Event} event | |
| 96 */ | 96 */ |
| 97 onProfileNameChanged_: function(event) { | 97 onProfileNameChanged_: function(event) { |
| 98 if (event.target.invalid) | 98 if (event.target.invalid) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, | 101 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, |
| 102 event.target.value); | 102 event.target.value); |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Handler for profile name keydowns. |
| 107 * @param {!Event} event |
| 108 * @private |
| 109 */ |
| 110 onProfileNameKeydown_: function(event) { |
| 111 if (event.key == 'Escape') { |
| 112 event.target.value = this.profileName; |
| 113 event.target.blur(); |
| 114 } |
| 115 }, |
| 116 |
| 117 /** |
| 106 * Handler for when an avatar is activated. | 118 * Handler for when an avatar is activated. |
| 107 * @param {!Event} event | 119 * @param {!Event} event |
| 108 * @private | 120 * @private |
| 109 */ | 121 */ |
| 110 onIconActivate_: function(event) { | 122 onIconActivate_: function(event) { |
| 111 this.browserProxy_.setProfileIconAndName(event.detail.selected, | 123 this.browserProxy_.setProfileIconAndName(event.detail.selected, |
| 112 this.profileName); | 124 this.profileName); |
| 113 }, | 125 }, |
| 114 | 126 |
| 115 /** | 127 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 127 * @private | 139 * @private |
| 128 */ | 140 */ |
| 129 onHasProfileShortcutChange_: function(event) { | 141 onHasProfileShortcutChange_: function(event) { |
| 130 if (this.hasProfileShortcut_) { | 142 if (this.hasProfileShortcut_) { |
| 131 this.browserProxy_.addProfileShortcut(); | 143 this.browserProxy_.addProfileShortcut(); |
| 132 } else { | 144 } else { |
| 133 this.browserProxy_.removeProfileShortcut(); | 145 this.browserProxy_.removeProfileShortcut(); |
| 134 } | 146 } |
| 135 } | 147 } |
| 136 }); | 148 }); |
| OLD | NEW |