| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 showBasicPage_: { | 50 showBasicPage_: { |
| 51 type: Boolean, | 51 type: Boolean, |
| 52 value: true, | 52 value: true, |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 /** @private */ | 55 /** @private */ |
| 56 showAboutPage_: { | 56 showAboutPage_: { |
| 57 type: Boolean, | 57 type: Boolean, |
| 58 value: false, | 58 value: false, |
| 59 }, | 59 }, |
| 60 |
| 61 /** |
| 62 * Dictionary defining page visibility. |
| 63 * @type {Object<boolean>} |
| 64 */ |
| 65 pageVisibility: { |
| 66 type: Object, |
| 67 value: function() { return {}; }, |
| 68 }, |
| 60 }, | 69 }, |
| 61 | 70 |
| 62 /** @override */ | 71 /** @override */ |
| 63 created: function() { | 72 created: function() { |
| 64 /** @private {!PromiseResolver} */ | 73 /** @private {!PromiseResolver} */ |
| 65 this.resolver_ = new PromiseResolver; | 74 this.resolver_ = new PromiseResolver; |
| 66 settings.main.rendered = this.resolver_.promise; | 75 settings.main.rendered = this.resolver_.promise; |
| 67 }, | 76 }, |
| 68 | 77 |
| 69 attached: function() { | 78 attached: function() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 this.currentRoute.section != '' || | 149 this.currentRoute.section != '' || |
| 141 this.currentRoute.subpage.length != 0) { | 150 this.currentRoute.subpage.length != 0) { |
| 142 this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''}; | 151 this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''}; |
| 143 } | 152 } |
| 144 }, | 153 }, |
| 145 | 154 |
| 146 /** | 155 /** |
| 147 * @param {string} query | 156 * @param {string} query |
| 148 */ | 157 */ |
| 149 searchContents: function(query) { | 158 searchContents: function(query) { |
| 159 assert(! /** @type {{hideToolbarSearchField: boolean}} */ |
| 160 (this.pageVisibility.hideToolbarSearchField)); |
| 161 |
| 150 this.ensureInDefaultSearchPage_(); | 162 this.ensureInDefaultSearchPage_(); |
| 151 | 163 |
| 152 // Trigger rendering of the basic and advanced pages and search once ready. | 164 // Trigger rendering of the basic and advanced pages and search once ready. |
| 153 // Even if those are already rendered, yield to the message loop before | 165 // Even if those are already rendered, yield to the message loop before |
| 154 // initiating searching. | 166 // initiating searching. |
| 155 this.showBasicPage_ = true; | 167 this.showBasicPage_ = true; |
| 156 setTimeout(function() { | 168 setTimeout(function() { |
| 157 settings.search(query, assert(this.$$('settings-basic-page'))); | 169 settings.search(query, assert(this.$$('settings-basic-page'))); |
| 158 }.bind(this), 0); | 170 }.bind(this), 0); |
| 159 | 171 |
| 160 this.showAdvancedPage_ = true; | 172 this.showAdvancedPage_ = true; |
| 161 setTimeout(function() { | 173 setTimeout(function() { |
| 162 settings.search(query, assert(this.$$('settings-advanced-page'))); | 174 settings.search(query, assert(this.$$('settings-advanced-page'))); |
| 163 }.bind(this), 0); | 175 }.bind(this), 0); |
| 164 }, | 176 }, |
| 165 }); | 177 }); |
| OLD | NEW |