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

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

Issue 2469393004: MD Settings: Preserve search URL param in subpages. (Closed)
Patch Set: Update params. Created 4 years, 1 month 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-ui' implements the UI for the Settings page. 7 * 'settings-ui' implements the UI for the Settings page.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 /** @override */ 116 /** @override */
117 attached: function() { 117 attached: function() {
118 // Preload bold Roboto so it doesn't load and flicker the first time used. 118 // Preload bold Roboto so it doesn't load and flicker the first time used.
119 document.fonts.load('bold 12px Roboto'); 119 document.fonts.load('bold 12px Roboto');
120 settings.setGlobalScrollTarget(this.$.headerPanel.scroller); 120 settings.setGlobalScrollTarget(this.$.headerPanel.scroller);
121 }, 121 },
122 122
123 /** @param {!settings.Route} route */ 123 /** @param {!settings.Route} route */
124 currentRouteChanged: function(route) { 124 currentRouteChanged: function(route) {
125 // New searches always take place on the BASIC route. Navigations into
126 // subpages are either non-searches, or continuations of an existing search.
127 //
128 // TODO(dpapad): Address corner-case where the user:
129 // 1) Visits a subpage first.
130 // 2) Triggers a search.
131 // 3) Clicks the "back" button.
132 // Currently nothing happens. Should clear search results and navigate to
133 // the subpage instead.
134 if (route.isSubpage())
135 return;
136
137 var urlSearchQuery = settings.getQueryParameters().get('search') || ''; 125 var urlSearchQuery = settings.getQueryParameters().get('search') || '';
138 if (urlSearchQuery == this.lastSearchQuery_) 126 if (urlSearchQuery == this.lastSearchQuery_)
139 return; 127 return;
140 128
141 this.lastSearchQuery_ = urlSearchQuery; 129 this.lastSearchQuery_ = urlSearchQuery;
142 130
143 var toolbar = /** @type {!CrToolbarElement} */ (this.$$('cr-toolbar')); 131 var toolbar = /** @type {!CrToolbarElement} */ (this.$$('cr-toolbar'));
144 var searchField = /** @type {CrToolbarSearchFieldElement} */ ( 132 var searchField = /** @type {CrToolbarSearchFieldElement} */ (
145 toolbar.getSearchField()); 133 toolbar.getSearchField());
146 134
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 onMenuButtonTap_: function() { 169 onMenuButtonTap_: function() {
182 this.$$('app-drawer').toggle(); 170 this.$$('app-drawer').toggle();
183 }, 171 },
184 172
185 /** @private */ 173 /** @private */
186 directionDelegateChanged_: function() { 174 directionDelegateChanged_: function() {
187 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? 175 this.$$('app-drawer').align = this.directionDelegate.isRtl() ?
188 'right' : 'left'; 176 'right' : 'left';
189 }, 177 },
190 }); 178 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698