| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 */ | 48 */ |
| 49 browserProxy_: { | 49 browserProxy_: { |
| 50 type: Object, | 50 type: Object, |
| 51 value: function() { | 51 value: function() { |
| 52 return settings.ManageProfileBrowserProxyImpl.getInstance(); | 52 return settings.ManageProfileBrowserProxyImpl.getInstance(); |
| 53 }, | 53 }, |
| 54 }, | 54 }, |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * True if the profile shortcuts feature is enabled. | 57 * True if the profile shortcuts feature is enabled. |
| 58 * @private | |
| 59 */ | 58 */ |
| 60 isProfileShortcutsEnabled_: { | 59 isProfileShortcutSettingVisible_: Boolean, |
| 61 type: Boolean, | |
| 62 value: function() { | |
| 63 return loadTimeData.getBoolean('profileShortcutsEnabled'); | |
| 64 }, | |
| 65 readOnly: true, | |
| 66 }, | |
| 67 }, | 60 }, |
| 68 | 61 |
| 69 /** @override */ | 62 /** @override */ |
| 70 attached: function() { | 63 attached: function() { |
| 71 var setIcons = function(icons) { | 64 var setIcons = function(icons) { |
| 72 this.availableIcons = icons; | 65 this.availableIcons = icons; |
| 73 }.bind(this); | 66 }.bind(this); |
| 74 | 67 |
| 75 this.addWebUIListener('available-icons-changed', setIcons); | 68 this.addWebUIListener('available-icons-changed', setIcons); |
| 76 this.browserProxy_.getAvailableIcons().then(setIcons); | 69 this.browserProxy_.getAvailableIcons().then(setIcons); |
| 77 }, | 70 }, |
| 78 | 71 |
| 79 /** @protected */ | 72 /** @protected */ |
| 80 currentRouteChanged: function() { | 73 currentRouteChanged: function() { |
| 81 if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) { | 74 if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) { |
| 82 this.$.name.value = this.profileName; | 75 this.$.name.value = this.profileName; |
| 83 | 76 |
| 84 if (this.isProfileShortcutsEnabled_) { | 77 if (loadTimeData.getBoolean('profileShortcutsEnabled')) { |
| 85 var setHasProfileShortcut = function(hasProfileShortcut) { | 78 this.browserProxy_.getProfileShortcutStatus().then(function(status) { |
| 86 this.hasProfileShortcut_ = hasProfileShortcut; | 79 if (status == ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN) { |
| 87 }.bind(this); | 80 this.isProfileShortcutSettingVisible_ = false; |
| 88 this.browserProxy_.getHasProfileShortcut().then(setHasProfileShortcut); | 81 return; |
| 82 } |
| 83 |
| 84 this.isProfileShortcutSettingVisible_ = true; |
| 85 this.hasProfileShortcut_ = |
| 86 status == ProfileShortcutStatus.PROFILE_SHORTCUT_FOUND; |
| 87 }.bind(this)); |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 }, | 90 }, |
| 92 | 91 |
| 93 /** | 92 /** |
| 94 * Handler for when the profile name field is changed, then blurred. | 93 * Handler for when the profile name field is changed, then blurred. |
| 95 * @private | 94 * @private |
| 96 * @param {!Event} event | 95 * @param {!Event} event |
| 97 */ | 96 */ |
| 98 onProfileNameChanged_: function(event) { | 97 onProfileNameChanged_: function(event) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 128 * @private | 127 * @private |
| 129 */ | 128 */ |
| 130 onHasProfileShortcutChange_: function(event) { | 129 onHasProfileShortcutChange_: function(event) { |
| 131 if (this.hasProfileShortcut_) { | 130 if (this.hasProfileShortcut_) { |
| 132 this.browserProxy_.addProfileShortcut(); | 131 this.browserProxy_.addProfileShortcut(); |
| 133 } else { | 132 } else { |
| 134 this.browserProxy_.removeProfileShortcut(); | 133 this.browserProxy_.removeProfileShortcut(); |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 }); | 136 }); |
| OLD | NEW |