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

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: Fix error when searching from About page. 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 attached: function() { 63 attached: function() {
63 document.addEventListener('toggle-advanced-page', function(e) { 64 document.addEventListener('toggle-advanced-page', function(e) {
64 this.showAdvancedPage_ = e.detail; 65 this.showAdvancedPage_ = e.detail;
65 this.isAdvancedMenuOpen_ = e.detail; 66 this.isAdvancedMenuOpen_ = e.detail;
66 if (this.showAdvancedPage_) { 67 if (this.showAdvancedPage_) {
67 scrollWhenReady( 68 scrollWhenReady(
68 function() { 69 function() {
69 return this.$$('settings-advanced-page'); 70 return this.$$('settings-advanced-page');
70 }.bind(this), 71 }.bind(this),
71 function() { 72 function() {
(...skipping 29 matching lines...) Expand all
101 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 102 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
102 newRoute.page == 'advanced'; 103 newRoute.page == 'advanced';
103 104
104 this.style.height = isSubpage ? '100%' : ''; 105 this.style.height = isSubpage ? '100%' : '';
105 }, 106 },
106 107
107 /** @private */ 108 /** @private */
108 toggleAdvancedPage_: function() { 109 toggleAdvancedPage_: function() {
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 110 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
110 }, 111 },
112
113 /**
114 * Navigates to the default search page (if necessary).
115 * @private
116 */
117 ensureInDefaultSearchPage_: function() {
118 if (this.currentRoute.page != 'basic' ||
119 this.currentRoute.section != '' ||
120 this.currentRoute.subpage.length != 0) {
121 this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''};
122 }
123 },
124
125 /**
126 * @param {string} query
127 */
128 searchContents: function(query) {
129 this.ensureInDefaultSearchPage_();
130
131 // Trigger rendering of the basic and advanced pages and search once ready.
132 // Even if those are already rendered, yield to the message loop before
133 // initiating searching.
134 this.showBasicPage_ = true;
135 setTimeout(function() {
136 settings.search(query, assert(this.$$('settings-basic-page')));
137 }.bind(this), 0);
138
139 this.showAdvancedPage_ = true;
140 setTimeout(function() {
141 settings.search(query, assert(this.$$('settings-advanced-page')));
142 }.bind(this), 0);
143 },
111 }); 144 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698