| 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', |
| 11 | 11 |
| 12 behaviors: [MainPageBehavior], | 12 behaviors: [SettingsPageVisibility, MainPageBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** Preferences state. */ | 15 /** Preferences state. */ |
| 16 prefs: { | 16 prefs: { |
| 17 type: Object, | 17 type: Object, |
| 18 notify: true, | 18 notify: true, |
| 19 }, | 19 }, |
| 20 | 20 |
| 21 showAndroidApps: Boolean, |
| 22 |
| 21 /** | 23 /** |
| 22 * Dictionary defining page visibility. Controlled by settings-ui. | 24 * Dictionary defining page visibility. |
| 23 * @type {!PageVisibility|undefined} | 25 * @type {!GuestModePageVisibility} |
| 24 */ | 26 */ |
| 25 pageVisibility: Object, | 27 pageVisibility: Object, |
| 26 | 28 |
| 27 advancedToggleExpanded: { | 29 advancedToggleExpanded: { |
| 28 type: Boolean, | 30 type: Boolean, |
| 29 notify: true, | 31 notify: true, |
| 30 observer: 'advancedToggleExpandedChanged_', | 32 observer: 'advancedToggleExpandedChanged_', |
| 31 }, | 33 }, |
| 32 | 34 |
| 33 /** | 35 /** |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 didFindMatches: requests.every(function(r) { | 127 didFindMatches: requests.every(function(r) { |
| 126 return !r.didFindMatches(); | 128 return !r.didFindMatches(); |
| 127 }), | 129 }), |
| 128 // All requests correspond to the same user query, so only need to check | 130 // All requests correspond to the same user query, so only need to check |
| 129 // one of them. | 131 // one of them. |
| 130 wasClearSearch: requests[0].isSame(''), | 132 wasClearSearch: requests[0].isSame(''), |
| 131 }; | 133 }; |
| 132 }); | 134 }); |
| 133 }, | 135 }, |
| 134 | 136 |
| 135 /** | |
| 136 * @param {boolean|undefined} visibility | |
| 137 * @return {boolean} | |
| 138 * @private | |
| 139 */ | |
| 140 showPage_: function(visibility) { | |
| 141 return visibility !== false; | |
| 142 }, | |
| 143 | |
| 144 /** | |
| 145 * @param {string} subpage | |
| 146 * @return {!Object} | |
| 147 */ | |
| 148 getPageVisibility_: function(subpage) { | |
| 149 return /** @type {Object} */ (this.get(subpage, this.pageVisibility)) || {}; | |
| 150 }, | |
| 151 | |
| 152 // <if expr="chromeos"> | 137 // <if expr="chromeos"> |
| 153 /** | 138 /** |
| 154 * @return {boolean} | 139 * @return {boolean} |
| 155 * @private | 140 * @private |
| 156 */ | 141 */ |
| 157 computeShowSecondaryUserBanner_: function() { | 142 computeShowSecondaryUserBanner_: function() { |
| 158 return !this.hasExpandedSection_ && | 143 return !this.hasExpandedSection_ && |
| 159 loadTimeData.getBoolean('isSecondaryUser'); | 144 loadTimeData.getBoolean('isSecondaryUser'); |
| 160 }, | 145 }, |
| 161 // </if> | 146 // </if> |
| 162 | 147 |
| 163 /** @private */ | 148 /** @private */ |
| 164 onResetProfileBannerClosed_: function() { | 149 onResetProfileBannerClosed_: function() { |
| 165 this.showResetProfileBanner_ = false; | 150 this.showResetProfileBanner_ = false; |
| 166 }, | 151 }, |
| 167 | 152 |
| 168 /** | 153 /** |
| 154 * @return {boolean} |
| 155 * @private |
| 156 */ |
| 157 shouldShowAndroidApps_: function() { |
| 158 var visibility = /** @type {boolean|undefined} */ ( |
| 159 this.get('pageVisibility.androidApps')); |
| 160 return this.showAndroidApps && this.showPage(visibility); |
| 161 }, |
| 162 |
| 163 /** |
| 169 * Hides everything but the newly expanded subpage. | 164 * Hides everything but the newly expanded subpage. |
| 170 * @private | 165 * @private |
| 171 */ | 166 */ |
| 172 onSubpageExpanded_: function() { | 167 onSubpageExpanded_: function() { |
| 173 this.hasExpandedSection_ = true; | 168 this.hasExpandedSection_ = true; |
| 174 }, | 169 }, |
| 175 | 170 |
| 176 /** | 171 /** |
| 177 * Render the advanced page now (don't wait for idle). | 172 * Render the advanced page now (don't wait for idle). |
| 178 * @private | 173 * @private |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 * @private | 212 * @private |
| 218 */ | 213 */ |
| 219 showAdvancedPage_: function( | 214 showAdvancedPage_: function( |
| 220 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { | 215 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { |
| 221 return hasExpandedSection ? | 216 return hasExpandedSection ? |
| 222 settings.Route.ADVANCED.contains(currentRoute) : | 217 settings.Route.ADVANCED.contains(currentRoute) : |
| 223 advancedToggleExpanded || inSearchMode; | 218 advancedToggleExpanded || inSearchMode; |
| 224 }, | 219 }, |
| 225 | 220 |
| 226 /** | 221 /** |
| 222 * @param {(boolean|undefined)} visibility |
| 223 * @return {boolean} True unless visibility is false. |
| 224 * @private |
| 225 */ |
| 226 showAdvancedSettings_: function(visibility) { |
| 227 return visibility !== false; |
| 228 }, |
| 229 |
| 230 /** |
| 227 * @param {boolean} opened Whether the menu is expanded. | 231 * @param {boolean} opened Whether the menu is expanded. |
| 228 * @return {string} Icon name. | 232 * @return {string} Icon name. |
| 229 * @private | 233 * @private |
| 230 */ | 234 */ |
| 231 getArrowIcon_: function(opened) { | 235 getArrowIcon_: function(opened) { |
| 232 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; | 236 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 233 }, | 237 }, |
| 234 }); | 238 }); |
| OLD | NEW |