| 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({ |
| 11 is: 'settings-manage-profile', | 11 is: 'settings-manage-profile', |
| 12 | 12 |
| 13 behaviors: [WebUIListenerBehavior], | 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 currently selected profile icon URL. May be a data URL. |
| 18 */ | 18 */ |
| 19 profileIconUrl: String, | 19 profileIconUrl: String, |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * The current profile name. | 22 * The current profile name. |
| 23 */ | 23 */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 /** @override */ | 52 /** @override */ |
| 53 attached: function() { | 53 attached: function() { |
| 54 var setIcons = function(icons) { | 54 var setIcons = function(icons) { |
| 55 this.availableIcons = icons; | 55 this.availableIcons = icons; |
| 56 }.bind(this); | 56 }.bind(this); |
| 57 | 57 |
| 58 this.addWebUIListener('available-icons-changed', setIcons); | 58 this.addWebUIListener('available-icons-changed', setIcons); |
| 59 this.browserProxy_.getAvailableIcons().then(setIcons); | 59 this.browserProxy_.getAvailableIcons().then(setIcons); |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 /** @protected */ |
| 63 currentRouteChanged: function() { |
| 64 if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) |
| 65 this.$.name.value = this.profileName; |
| 66 }, |
| 67 |
| 62 /** | 68 /** |
| 63 * Handler for when the profile name field is changed, then blurred. | 69 * Handler for when the profile name field is changed, then blurred. |
| 64 * @private | 70 * @private |
| 65 * @param {!Event} event | 71 * @param {!Event} event |
| 66 */ | 72 */ |
| 67 onProfileNameChanged_: function(event) { | 73 onProfileNameChanged_: function(event) { |
| 68 if (event.target.invalid) | 74 if (event.target.invalid) |
| 69 return; | 75 return; |
| 70 | 76 |
| 71 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, | 77 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 | 90 |
| 85 /** | 91 /** |
| 86 * @param {?settings.SyncStatus} syncStatus | 92 * @param {?settings.SyncStatus} syncStatus |
| 87 * @return {boolean} Whether the profile name field is disabled. | 93 * @return {boolean} Whether the profile name field is disabled. |
| 88 * @private | 94 * @private |
| 89 */ | 95 */ |
| 90 isProfileNameDisabled_: function(syncStatus) { | 96 isProfileNameDisabled_: function(syncStatus) { |
| 91 return !!syncStatus.supervisedUser && !syncStatus.childUser; | 97 return !!syncStatus.supervisedUser && !syncStatus.childUser; |
| 92 }, | 98 }, |
| 93 }); | 99 }); |
| OLD | NEW |