| 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-main' displays the selected settings page. | 7 * 'settings-main' displays the selected settings page. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-main', | 10 is: 'settings-main', |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 * Dictionary defining page visibility. | 65 * Dictionary defining page visibility. |
| 66 * @type {!GuestModePageVisibility} | 66 * @type {!GuestModePageVisibility} |
| 67 */ | 67 */ |
| 68 pageVisibility: { | 68 pageVisibility: { |
| 69 type: Object, | 69 type: Object, |
| 70 value: function() { return {}; }, | 70 value: function() { return {}; }, |
| 71 }, | 71 }, |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 /** @override */ | 74 /** @override */ |
| 75 created: function() { | |
| 76 /** @private {!PromiseResolver} */ | |
| 77 this.resolver_ = new PromiseResolver; | |
| 78 settings.main.rendered = this.resolver_.promise; | |
| 79 }, | |
| 80 | |
| 81 /** @override */ | |
| 82 attached: function() { | 75 attached: function() { |
| 83 document.addEventListener('toggle-advanced-page', function(e) { | 76 document.addEventListener('toggle-advanced-page', function(e) { |
| 84 this.advancedToggleExpanded_ = e.detail; | 77 this.advancedToggleExpanded_ = e.detail; |
| 85 settings.navigateTo(this.advancedToggleExpanded_ ? | 78 settings.navigateTo(this.advancedToggleExpanded_ ? |
| 86 settings.Route.ADVANCED : settings.Route.BASIC); | 79 settings.Route.ADVANCED : settings.Route.BASIC); |
| 87 }.bind(this)); | 80 }.bind(this)); |
| 88 | |
| 89 doWhenReady( | |
| 90 function() { | |
| 91 var basicPage = this.$$('settings-basic-page'); | |
| 92 return !!basicPage && basicPage.scrollHeight > 0; | |
| 93 }.bind(this), | |
| 94 function() { | |
| 95 this.resolver_.resolve(); | |
| 96 }.bind(this)); | |
| 97 }, | 81 }, |
| 98 | 82 |
| 99 /** | 83 /** |
| 100 * @param {boolean} opened Whether the menu is expanded. | 84 * @param {boolean} opened Whether the menu is expanded. |
| 101 * @return {string} Which icon to use. | 85 * @return {string} Which icon to use. |
| 102 * @private | 86 * @private |
| 103 */ | 87 */ |
| 104 arrowState_: function(opened) { | 88 arrowState_: function(opened) { |
| 105 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 89 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 106 }, | 90 }, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 225 |
| 242 /** | 226 /** |
| 243 * @param {(boolean|undefined)} visibility | 227 * @param {(boolean|undefined)} visibility |
| 244 * @return {boolean} True unless visibility is false. | 228 * @return {boolean} True unless visibility is false. |
| 245 * @private | 229 * @private |
| 246 */ | 230 */ |
| 247 showAdvancedSettings_: function(visibility) { | 231 showAdvancedSettings_: function(visibility) { |
| 248 return visibility !== false; | 232 return visibility !== false; |
| 249 }, | 233 }, |
| 250 }); | 234 }); |
| OLD | NEW |