Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2153013003: MD Settings: Show/hide spinner when searching starts/ends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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().setObserver(this);
78 },
79
80 /**
81 * Observer method called by SearchManager whenever a search is
82 * started/finished.
83 * @param {boolean} isRunning
84 */
85 onSearchStatusChanged: function(isRunning) {
86 this.toolbarSpinnerActive = isRunning;
87 },
88
69 attached: function() { 89 attached: function() {
70 document.addEventListener('toggle-advanced-page', function(e) { 90 document.addEventListener('toggle-advanced-page', function(e) {
71 this.showAdvancedPage_ = e.detail; 91 this.showAdvancedPage_ = e.detail;
72 this.isAdvancedMenuOpen_ = e.detail; 92 this.isAdvancedMenuOpen_ = e.detail;
73 this.currentRoute = { 93 this.currentRoute = {
74 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', 94 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic',
75 section: '', 95 section: '',
76 subpage: [], 96 subpage: [],
77 }; 97 };
78 if (this.showAdvancedPage_) { 98 if (this.showAdvancedPage_) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 * @param {string} query 167 * @param {string} query
148 */ 168 */
149 searchContents: function(query) { 169 searchContents: function(query) {
150 this.ensureInDefaultSearchPage_(); 170 this.ensureInDefaultSearchPage_();
151 171
152 // Trigger rendering of the basic and advanced pages and search once ready. 172 // 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 173 // Even if those are already rendered, yield to the message loop before
154 // initiating searching. 174 // initiating searching.
155 this.showBasicPage_ = true; 175 this.showBasicPage_ = true;
156 setTimeout(function() { 176 setTimeout(function() {
157 settings.search(query, assert(this.$$('settings-basic-page'))); 177 settings.getSearchManager().search(
178 query, assert(this.$$('settings-basic-page')));
158 }.bind(this), 0); 179 }.bind(this), 0);
159 180
160 this.showAdvancedPage_ = true; 181 this.showAdvancedPage_ = true;
161 setTimeout(function() { 182 setTimeout(function() {
162 settings.search(query, assert(this.$$('settings-advanced-page'))); 183 settings.getSearchManager().search(
184 query, assert(this.$$('settings-advanced-page')));
163 }.bind(this), 0); 185 }.bind(this), 0);
164 }, 186 },
165 }); 187 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698