| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 /** @override */ | 82 /** @override */ |
| 83 attached: function() { | 83 attached: function() { |
| 84 document.addEventListener('toggle-advanced-page', function(e) { | 84 document.addEventListener('toggle-advanced-page', function(e) { |
| 85 this.showAdvancedPage_ = e.detail; | 85 this.showAdvancedPage_ = e.detail; |
| 86 this.isAdvancedMenuOpen_ = e.detail; | 86 this.isAdvancedMenuOpen_ = e.detail; |
| 87 this.currentRoute = { | 87 this.currentRoute = { |
| 88 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', | 88 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', |
| 89 section: '', | 89 section: '', |
| 90 subpage: [], | 90 subpage: [], |
| 91 }; | 91 }; |
| 92 if (this.showAdvancedPage_) { | |
| 93 doWhenReady( | |
| 94 function() { | |
| 95 var advancedPage = this.$$('settings-advanced-page'); | |
| 96 return !!advancedPage && advancedPage.scrollHeight > 0; | |
| 97 }.bind(this), | |
| 98 function() { | |
| 99 this.$$('#toggleContainer').scrollIntoView(); | |
| 100 }.bind(this)); | |
| 101 } | |
| 102 }.bind(this)); | 92 }.bind(this)); |
| 103 | 93 |
| 104 doWhenReady( | 94 doWhenReady( |
| 105 function() { | 95 function() { |
| 106 var basicPage = this.$$('settings-basic-page'); | 96 var basicPage = this.$$('settings-basic-page'); |
| 107 return !!basicPage && basicPage.scrollHeight > 0; | 97 return !!basicPage && basicPage.scrollHeight > 0; |
| 108 }.bind(this), | 98 }.bind(this), |
| 109 function() { | 99 function() { |
| 110 this.resolver_.resolve(); | 100 this.resolver_.resolve(); |
| 111 }.bind(this)); | 101 }.bind(this)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 query, assert(this.$$('settings-basic-page'))); | 162 query, assert(this.$$('settings-basic-page'))); |
| 173 }.bind(this), 0); | 163 }.bind(this), 0); |
| 174 | 164 |
| 175 this.showAdvancedPage_ = true; | 165 this.showAdvancedPage_ = true; |
| 176 setTimeout(function() { | 166 setTimeout(function() { |
| 177 settings.getSearchManager().search( | 167 settings.getSearchManager().search( |
| 178 query, assert(this.$$('settings-advanced-page'))); | 168 query, assert(this.$$('settings-advanced-page'))); |
| 179 }.bind(this), 0); | 169 }.bind(this), 0); |
| 180 }, | 170 }, |
| 181 }); | 171 }); |
| OLD | NEW |