Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/manage_profile.js |
| diff --git a/chrome/browser/resources/settings/people_page/manage_profile.js b/chrome/browser/resources/settings/people_page/manage_profile.js |
| index 740d4b3eeae7307e7968b8962e5132c954d5f81d..0dd3e4b478eef1c2403e6f5d6fb9319ac33aa787 100644 |
| --- a/chrome/browser/resources/settings/people_page/manage_profile.js |
| +++ b/chrome/browser/resources/settings/people_page/manage_profile.js |
| @@ -24,6 +24,11 @@ Polymer({ |
| profileName: String, |
| /** |
| + * True if the current profile has a shortcut. |
| + */ |
| + hasProfileShortcut_: Boolean, |
| + |
| + /** |
| * The available icons for selection. |
| * @type {!Array<string>} |
| */ |
| @@ -47,6 +52,18 @@ Polymer({ |
| return settings.ManageProfileBrowserProxyImpl.getInstance(); |
| }, |
| }, |
| + |
| + /** |
| + * True if the profile shortcuts feature is enabled. |
| + * @private |
| + */ |
| + isProfileShortcutsEnabled_: { |
| + type: Boolean, |
| + value: function() { |
| + return loadTimeData.getBoolean('profileShortcutsEnabled'); |
| + }, |
| + readOnly: true, |
| + }, |
| }, |
| /** @override */ |
| @@ -61,8 +78,16 @@ Polymer({ |
| /** @protected */ |
| currentRouteChanged: function() { |
| - if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) |
| + if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) { |
| this.$.name.value = this.profileName; |
| + |
| + if (this.isProfileShortcutsEnabled_) { |
| + var setHasProfileShortcut = function(hasProfileShortcut) { |
| + this.hasProfileShortcut_ = hasProfileShortcut; |
| + }.bind(this); |
| + this.browserProxy_.hasProfileShortcut().then(setHasProfileShortcut); |
| + } |
| + } |
|
tommycli
2016/11/15 01:59:50
It looks like the UI state won't be synchronized a
Moe
2016/11/15 16:03:10
I doesn't seem to be synced in the old settings pa
tommycli
2016/11/15 16:18:37
We're "good". hehe. That being said, I think it's
|
| }, |
| /** |
| @@ -96,4 +121,17 @@ Polymer({ |
| isProfileNameDisabled_: function(syncStatus) { |
| return !!syncStatus.supervisedUser && !syncStatus.childUser; |
| }, |
| + |
| + /** |
| + * Handler for when the profile shortcut toggle is changed. |
| + * @param {!Event} event |
| + * @private |
| + */ |
| + onHasProfileShortcutChange_: function(event) { |
| + if (this.hasProfileShortcut_) { |
| + this.browserProxy_.addProfileShortcut(); |
| + } else { |
| + this.browserProxy_.removeProfileShortcut(); |
| + } |
| + } |
| }); |