Chromium Code Reviews| 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 | 58 * @private {boolean} |
| 59 */ | 59 */ |
| 60 isProfileShortcutsEnabled_: { | 60 isProfileShortcutSettingVisible_: false, |
|
Dan Beam
2016/11/23 00:29:16
this should either be
isProfileShortcutSettingVis
tommycli
2016/11/23 19:00:46
Done.
| |
| 61 type: Boolean, | |
| 62 value: function() { | |
| 63 return loadTimeData.getBoolean('profileShortcutsEnabled'); | |
| 64 }, | |
| 65 readOnly: true, | |
| 66 }, | |
| 67 }, | 61 }, |
| 68 | 62 |
| 69 /** @override */ | 63 /** @override */ |
| 70 attached: function() { | 64 attached: function() { |
| 71 var setIcons = function(icons) { | 65 var setIcons = function(icons) { |
| 72 this.availableIcons = icons; | 66 this.availableIcons = icons; |
| 73 }.bind(this); | 67 }.bind(this); |
| 74 | 68 |
| 75 this.addWebUIListener('available-icons-changed', setIcons); | 69 this.addWebUIListener('available-icons-changed', setIcons); |
| 76 this.browserProxy_.getAvailableIcons().then(setIcons); | 70 this.browserProxy_.getAvailableIcons().then(setIcons); |
| 77 }, | 71 }, |
| 78 | 72 |
| 79 /** @protected */ | 73 /** @protected */ |
| 80 currentRouteChanged: function() { | 74 currentRouteChanged: function() { |
| 81 if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) { | 75 if (settings.getCurrentRoute() == settings.Route.MANAGE_PROFILE) { |
| 82 this.$.name.value = this.profileName; | 76 this.$.name.value = this.profileName; |
| 83 | 77 |
| 84 if (this.isProfileShortcutsEnabled_) { | 78 if (loadTimeData.getBoolean('profileShortcutsEnabled')) { |
| 85 var setHasProfileShortcut = function(hasProfileShortcut) { | 79 this.browserProxy_.getProfileShortcutStatus().then(function(status) { |
| 86 this.hasProfileShortcut_ = hasProfileShortcut; | 80 if (status == ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN) { |
| 87 }.bind(this); | 81 this.isProfileShortcutSettingVisible_ = false; |
| 88 this.browserProxy_.getHasProfileShortcut().then(setHasProfileShortcut); | 82 return; |
| 83 } | |
| 84 | |
| 85 this.isProfileShortcutSettingVisible_ = true; | |
| 86 this.hasProfileShortcut_ = | |
| 87 status == ProfileShortcutStatus.PROFILE_SHORTCUT_FOUND; | |
| 88 }.bind(this)); | |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Handler for when the profile name field is changed, then blurred. | 94 * Handler for when the profile name field is changed, then blurred. |
| 95 * @private | 95 * @private |
| 96 * @param {!Event} event | 96 * @param {!Event} event |
| 97 */ | 97 */ |
| 98 onProfileNameChanged_: function(event) { | 98 onProfileNameChanged_: function(event) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 128 * @private | 128 * @private |
| 129 */ | 129 */ |
| 130 onHasProfileShortcutChange_: function(event) { | 130 onHasProfileShortcutChange_: function(event) { |
| 131 if (this.hasProfileShortcut_) { | 131 if (this.hasProfileShortcut_) { |
| 132 this.browserProxy_.addProfileShortcut(); | 132 this.browserProxy_.addProfileShortcut(); |
| 133 } else { | 133 } else { |
| 134 this.browserProxy_.removeProfileShortcut(); | 134 this.browserProxy_.removeProfileShortcut(); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 }); | 137 }); |
| OLD | NEW |