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

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: Nits. Created 4 years, 6 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 23 matching lines...) Expand all
34 observer: 'currentRouteChanged_', 34 observer: 'currentRouteChanged_',
35 }, 35 },
36 36
37 /** @private */ 37 /** @private */
38 showAdvancedPage_: { 38 showAdvancedPage_: {
39 type: Boolean, 39 type: Boolean,
40 value: false, 40 value: false,
41 }, 41 },
42 42
43 /** @private */ 43 /** @private */
44 whenAdvancedPageReady_: {
45 type: Object,
46 value: new PromiseResolver(),
michaelpg 2016/06/27 23:00:04 i know this is sort of a singleton, but for the sa
dpapad 2016/06/27 23:37:26 Done.
47 },
48
49 /** @private */
44 showAdvancedToggle_: { 50 showAdvancedToggle_: {
45 type: Boolean, 51 type: Boolean,
46 value: true, 52 value: true,
47 }, 53 },
48 54
49 /** @private */ 55 /** @private */
50 showBasicPage_: { 56 showBasicPage_: {
51 type: Boolean, 57 type: Boolean,
52 value: true, 58 value: true,
53 }, 59 },
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 107 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
102 newRoute.page == 'advanced'; 108 newRoute.page == 'advanced';
103 109
104 this.style.height = isSubpage ? '100%' : ''; 110 this.style.height = isSubpage ? '100%' : '';
105 }, 111 },
106 112
107 /** @private */ 113 /** @private */
108 toggleAdvancedPage_: function() { 114 toggleAdvancedPage_: function() {
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 115 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
110 }, 116 },
117
118 /** @private */
119 onAdvancedPageReady_: function() {
120 this.whenAdvancedPageReady_.resolve();
121 },
122
123 /**
124 * Navigates to the default search page (if necessary).
125 * @private
126 */
127 ensureInDefaultSearchPage_: function() {
128 if (this.currentRoute.page != 'basic' ||
129 this.currentRoute.section != '' ||
130 this.currentRoute.subpage.length != 0) {
131 this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''};
132 }
133 },
134
135 /**
136 * @param {string} query
137 */
138 searchContents: function(query) {
139 this.ensureInDefaultSearchPage_();
140
141 // Search basic page immediately.
142 settings.search(query, assert(this.$$('settings-basic-page')));
143
144 // Force the advanced page to be rendered and search once ready.
145 this.showAdvancedPage_ = true;
michaelpg 2016/06/27 23:00:04 without using a PromiseResolver: var searchAdvanc
dpapad 2016/06/27 23:37:27 What is the benefit of not using PromiseResolver h
michaelpg 2016/06/29 01:18:57 PromiseResolver is sugar for creating a Promise wh
dpapad 2016/06/29 18:20:12 Yes, added a comment for the current intention. Ke
michaelpg 2016/06/29 19:40:51 Makes sense. Polymer queues effects like dom-if's
146 this.whenAdvancedPageReady_.promise.then(function() {
147 settings.search(query, assert(this.$$('settings-advanced-page')));
148 }.bind(this));
149 },
111 }); 150 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698