| 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 toolbarSpinnerActive: { |
| 62 type: Boolean, |
| 63 value: false, |
| 64 notify: true, |
| 65 }, |
| 60 }, | 66 }, |
| 61 | 67 |
| 62 /** @override */ | 68 /** @override */ |
| 63 created: function() { | 69 created: function() { |
| 64 /** @private {!PromiseResolver} */ | 70 /** @private {!PromiseResolver} */ |
| 65 this.resolver_ = new PromiseResolver; | 71 this.resolver_ = new PromiseResolver; |
| 66 settings.main.rendered = this.resolver_.promise; | 72 settings.main.rendered = this.resolver_.promise; |
| 67 }, | 73 }, |
| 68 | 74 |
| 75 /** @override */ |
| 76 ready: function() { |
| 77 settings.getSearchManager().setCallback(function(isRunning) { |
| 78 this.toolbarSpinnerActive = isRunning; |
| 79 }.bind(this)); |
| 80 }, |
| 81 |
| 82 /** @override */ |
| 69 attached: function() { | 83 attached: function() { |
| 70 document.addEventListener('toggle-advanced-page', function(e) { | 84 document.addEventListener('toggle-advanced-page', function(e) { |
| 71 this.showAdvancedPage_ = e.detail; | 85 this.showAdvancedPage_ = e.detail; |
| 72 this.isAdvancedMenuOpen_ = e.detail; | 86 this.isAdvancedMenuOpen_ = e.detail; |
| 73 this.currentRoute = { | 87 this.currentRoute = { |
| 74 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', | 88 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', |
| 75 section: '', | 89 section: '', |
| 76 subpage: [], | 90 subpage: [], |
| 77 }; | 91 }; |
| 78 if (this.showAdvancedPage_) { | 92 if (this.showAdvancedPage_) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 * @param {string} query | 161 * @param {string} query |
| 148 */ | 162 */ |
| 149 searchContents: function(query) { | 163 searchContents: function(query) { |
| 150 this.ensureInDefaultSearchPage_(); | 164 this.ensureInDefaultSearchPage_(); |
| 151 | 165 |
| 152 // Trigger rendering of the basic and advanced pages and search once ready. | 166 // 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 | 167 // Even if those are already rendered, yield to the message loop before |
| 154 // initiating searching. | 168 // initiating searching. |
| 155 this.showBasicPage_ = true; | 169 this.showBasicPage_ = true; |
| 156 setTimeout(function() { | 170 setTimeout(function() { |
| 157 settings.search(query, assert(this.$$('settings-basic-page'))); | 171 settings.getSearchManager().search( |
| 172 query, assert(this.$$('settings-basic-page'))); |
| 158 }.bind(this), 0); | 173 }.bind(this), 0); |
| 159 | 174 |
| 160 this.showAdvancedPage_ = true; | 175 this.showAdvancedPage_ = true; |
| 161 setTimeout(function() { | 176 setTimeout(function() { |
| 162 settings.search(query, assert(this.$$('settings-advanced-page'))); | 177 settings.getSearchManager().search( |
| 178 query, assert(this.$$('settings-advanced-page'))); |
| 163 }.bind(this), 0); | 179 }.bind(this), 0); |
| 164 }, | 180 }, |
| 165 }); | 181 }); |
| OLD | NEW |