| 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 16 matching lines...) Expand all Loading... |
| 27 * True if the current profile has a shortcut. | 27 * True if the current profile has a shortcut. |
| 28 */ | 28 */ |
| 29 hasProfileShortcut_: Boolean, | 29 hasProfileShortcut_: Boolean, |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * The available icons for selection. | 32 * The available icons for selection. |
| 33 * @type {!Array<string>} | 33 * @type {!Array<string>} |
| 34 */ | 34 */ |
| 35 availableIcons: { | 35 availableIcons: { |
| 36 type: Array, | 36 type: Array, |
| 37 value: function() { return []; }, | 37 value: function() { |
| 38 return []; |
| 39 }, |
| 38 }, | 40 }, |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * The current sync status. | 43 * The current sync status. |
| 42 * @type {?settings.SyncStatus} | 44 * @type {?settings.SyncStatus} |
| 43 */ | 45 */ |
| 44 syncStatus: Object, | 46 syncStatus: Object, |
| 45 | 47 |
| 46 /** | 48 /** |
| 47 * @private {!settings.ManageProfileBrowserProxy} | 49 * @private {!settings.ManageProfileBrowserProxy} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 93 |
| 92 /** | 94 /** |
| 93 * Handler for when the profile name field is changed, then blurred. | 95 * Handler for when the profile name field is changed, then blurred. |
| 94 * @private | 96 * @private |
| 95 * @param {!Event} event | 97 * @param {!Event} event |
| 96 */ | 98 */ |
| 97 onProfileNameChanged_: function(event) { | 99 onProfileNameChanged_: function(event) { |
| 98 if (event.target.invalid) | 100 if (event.target.invalid) |
| 99 return; | 101 return; |
| 100 | 102 |
| 101 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, | 103 this.browserProxy_.setProfileIconAndName( |
| 102 event.target.value); | 104 this.profileIconUrl, event.target.value); |
| 103 }, | 105 }, |
| 104 | 106 |
| 105 /** | 107 /** |
| 106 * Handler for when an avatar is activated. | 108 * Handler for when an avatar is activated. |
| 107 * @param {!Event} event | 109 * @param {!Event} event |
| 108 * @private | 110 * @private |
| 109 */ | 111 */ |
| 110 onIconActivate_: function(event) { | 112 onIconActivate_: function(event) { |
| 111 this.browserProxy_.setProfileIconAndName(event.detail.selected, | 113 this.browserProxy_.setProfileIconAndName( |
| 112 this.profileName); | 114 event.detail.selected, this.profileName); |
| 113 }, | 115 }, |
| 114 | 116 |
| 115 /** | 117 /** |
| 116 * @param {?settings.SyncStatus} syncStatus | 118 * @param {?settings.SyncStatus} syncStatus |
| 117 * @return {boolean} Whether the profile name field is disabled. | 119 * @return {boolean} Whether the profile name field is disabled. |
| 118 * @private | 120 * @private |
| 119 */ | 121 */ |
| 120 isProfileNameDisabled_: function(syncStatus) { | 122 isProfileNameDisabled_: function(syncStatus) { |
| 121 return !!syncStatus.supervisedUser && !syncStatus.childUser; | 123 return !!syncStatus.supervisedUser && !syncStatus.childUser; |
| 122 }, | 124 }, |
| 123 | 125 |
| 124 /** | 126 /** |
| 125 * Handler for when the profile shortcut toggle is changed. | 127 * Handler for when the profile shortcut toggle is changed. |
| 126 * @param {!Event} event | 128 * @param {!Event} event |
| 127 * @private | 129 * @private |
| 128 */ | 130 */ |
| 129 onHasProfileShortcutChange_: function(event) { | 131 onHasProfileShortcutChange_: function(event) { |
| 130 if (this.hasProfileShortcut_) { | 132 if (this.hasProfileShortcut_) { |
| 131 this.browserProxy_.addProfileShortcut(); | 133 this.browserProxy_.addProfileShortcut(); |
| 132 } else { | 134 } else { |
| 133 this.browserProxy_.removeProfileShortcut(); | 135 this.browserProxy_.removeProfileShortcut(); |
| 134 } | 136 } |
| 135 } | 137 } |
| 136 }); | 138 }); |
| OLD | NEW |