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-basic-page' is the settings page containing the actual settings. | 7 * 'settings-basic-page' is the settings page containing the actual settings. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-basic-page', | 10 is: 'settings-basic-page', |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 * True if the basic page should currently display the reset profile banner. | 46 * True if the basic page should currently display the reset profile banner. |
| 47 * @private {boolean} | 47 * @private {boolean} |
| 48 */ | 48 */ |
| 49 showResetProfileBanner_: { | 49 showResetProfileBanner_: { |
| 50 type: Boolean, | 50 type: Boolean, |
| 51 value: function() { | 51 value: function() { |
| 52 return loadTimeData.getBoolean('showResetProfileBanner'); | 52 return loadTimeData.getBoolean('showResetProfileBanner'); |
| 53 }, | 53 }, |
| 54 }, | 54 }, |
| 55 | 55 |
| 56 // <if expr="chromeos"> | |
| 57 /** @private Whether the user is a secondary user. */ | |
| 58 showSecondaryUserBanner_: { | |
| 59 type: Boolean, | |
| 60 computed: 'computeShowSecondaryUserBanner_(hasExpandedSection_)', | |
| 61 }, | |
| 62 // </if> | |
|
dschuyler
2017/02/11 02:54:56
Can this var be removed and computeShowSecondaryUs
stevenjb
2017/02/13 18:28:00
This needs to be computed after loadTimeData is av
| |
| 63 | |
| 56 /** @private {!settings.Route|undefined} */ | 64 /** @private {!settings.Route|undefined} */ |
| 57 currentRoute_: Object, | 65 currentRoute_: Object, |
| 58 }, | 66 }, |
| 59 | 67 |
| 60 listeners: { | 68 listeners: { |
| 61 'subpage-expand': 'onSubpageExpanded_', | 69 'subpage-expand': 'onSubpageExpanded_', |
| 62 }, | 70 }, |
| 63 | 71 |
| 64 /** @override */ | 72 /** @override */ |
| 65 attached: function() { | 73 attached: function() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 query, assert(this.$$('#basicPage'))); | 109 query, assert(this.$$('#basicPage'))); |
| 102 | 110 |
| 103 if (this.pageVisibility.advancedSettings !== false) { | 111 if (this.pageVisibility.advancedSettings !== false) { |
| 104 assert(whenSearchDone === settings.getSearchManager().search( | 112 assert(whenSearchDone === settings.getSearchManager().search( |
| 105 query, assert(this.$.advancedPageTemplate.get()))); | 113 query, assert(this.$.advancedPageTemplate.get()))); |
| 106 } | 114 } |
| 107 | 115 |
| 108 return whenSearchDone; | 116 return whenSearchDone; |
| 109 }, | 117 }, |
| 110 | 118 |
| 119 // <if expr="chromeos"> | |
| 120 /** | |
| 121 * @return {boolean} | |
| 122 * @private | |
| 123 */ | |
| 124 computeShowSecondaryUserBanner_: function() { | |
| 125 return !this.hasExpandedSection_ && | |
| 126 loadTimeData.getBoolean('isSecondaryUser'); | |
| 127 }, | |
| 128 // </if> | |
| 129 | |
| 111 /** @private */ | 130 /** @private */ |
| 112 onResetDone_: function() { | 131 onResetDone_: function() { |
| 113 this.showResetProfileBanner_ = false; | 132 this.showResetProfileBanner_ = false; |
| 114 }, | 133 }, |
| 115 | 134 |
| 116 /** | 135 /** |
| 117 * @return {boolean} | 136 * @return {boolean} |
| 118 * @private | 137 * @private |
| 119 */ | 138 */ |
| 120 shouldShowAndroidApps_: function() { | 139 shouldShowAndroidApps_: function() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 | 183 |
| 165 /** | 184 /** |
| 166 * @param {!settings.Route} currentRoute | 185 * @param {!settings.Route} currentRoute |
| 167 * @param {boolean} inSearchMode | 186 * @param {boolean} inSearchMode |
| 168 * @param {boolean} hasExpandedSection | 187 * @param {boolean} hasExpandedSection |
| 169 * @param {boolean} advancedToggleExpanded | 188 * @param {boolean} advancedToggleExpanded |
| 170 * @return {boolean} Whether to show the advanced page, taking into account | 189 * @return {boolean} Whether to show the advanced page, taking into account |
| 171 * both routing and search state. | 190 * both routing and search state. |
| 172 * @private | 191 * @private |
| 173 */ | 192 */ |
| 174 showAdvancedPage_: function(currentRoute, inSearchMode, hasExpandedSection, | 193 showAdvancedPage_: function( |
| 175 advancedToggleExpanded) { | 194 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { |
| 176 return hasExpandedSection ? | 195 return hasExpandedSection ? |
| 177 settings.Route.ADVANCED.contains(currentRoute) : | 196 settings.Route.ADVANCED.contains(currentRoute) : |
| 178 advancedToggleExpanded || inSearchMode; | 197 advancedToggleExpanded || inSearchMode; |
| 179 }, | 198 }, |
| 180 | 199 |
| 181 /** | 200 /** |
| 182 * @param {(boolean|undefined)} visibility | 201 * @param {(boolean|undefined)} visibility |
| 183 * @return {boolean} True unless visibility is false. | 202 * @return {boolean} True unless visibility is false. |
| 184 * @private | 203 * @private |
| 185 */ | 204 */ |
| 186 showAdvancedSettings_: function(visibility) { | 205 showAdvancedSettings_: function(visibility) { |
| 187 return visibility !== false; | 206 return visibility !== false; |
| 188 }, | 207 }, |
| 189 | 208 |
| 190 /** | 209 /** |
| 191 * @param {boolean} opened Whether the menu is expanded. | 210 * @param {boolean} opened Whether the menu is expanded. |
| 192 * @return {string} Icon name. | 211 * @return {string} Icon name. |
| 193 * @private | 212 * @private |
| 194 */ | 213 */ |
| 195 getArrowIcon_: function(opened) { | 214 getArrowIcon_: function(opened) { |
| 196 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; | 215 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 197 }, | 216 }, |
| 198 }); | 217 }); |
| OLD | NEW |