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

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

Issue 2082793003: MD Settings: First iteration of searching within settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr_search_migration0
Patch Set: Address comments. 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }, 60 },
61 61
62 /** @override */
62 created: function() { 63 created: function() {
63 /** @private {!PromiseResolver} */ 64 /** @private {!PromiseResolver} */
64 this.resolver_ = new PromiseResolver; 65 this.resolver_ = new PromiseResolver;
65 settings.main.rendered = this.resolver_.promise; 66 settings.main.rendered = this.resolver_.promise;
66 }, 67 },
67 68
68 attached: function() { 69 attached: function() {
69 document.addEventListener('toggle-advanced-page', function(e) { 70 document.addEventListener('toggle-advanced-page', function(e) {
70 this.showAdvancedPage_ = e.detail; 71 this.showAdvancedPage_ = e.detail;
71 this.isAdvancedMenuOpen_ = e.detail; 72 this.isAdvancedMenuOpen_ = e.detail;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 123 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
123 newRoute.page == 'advanced'; 124 newRoute.page == 'advanced';
124 125
125 this.style.height = isSubpage ? '100%' : ''; 126 this.style.height = isSubpage ? '100%' : '';
126 }, 127 },
127 128
128 /** @private */ 129 /** @private */
129 toggleAdvancedPage_: function() { 130 toggleAdvancedPage_: function() {
130 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 131 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
131 }, 132 },
133
134 /**
135 * Navigates to the default search page (if necessary).
136 * @private
137 */
138 ensureInDefaultSearchPage_: function() {
139 if (this.currentRoute.page != 'basic' ||
140 this.currentRoute.section != '' ||
141 this.currentRoute.subpage.length != 0) {
142 this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''};
143 }
144 },
145
146 /**
147 * @param {string} query
148 */
149 searchContents: function(query) {
150 this.ensureInDefaultSearchPage_();
151
152 // 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
154 // initiating searching.
155 this.showBasicPage_ = true;
156 setTimeout(function() {
157 settings.search(query, assert(this.$$('settings-basic-page')));
158 }.bind(this), 0);
159
160 this.showAdvancedPage_ = true;
161 setTimeout(function() {
162 settings.search(query, assert(this.$$('settings-advanced-page')));
163 }.bind(this), 0);
164 },
132 }); 165 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698