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

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

Issue 2184863002: MD Settings: Remove paper-header-panel, use IntersectionObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 3 years, 8 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-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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 googleDrive: false, 153 googleDrive: false,
154 }, 154 },
155 // </if> 155 // </if>
156 }; 156 };
157 } 157 }
158 158
159 this.showAndroidApps_ = loadTimeData.valueExists('androidAppsAllowed') && 159 this.showAndroidApps_ = loadTimeData.valueExists('androidAppsAllowed') &&
160 loadTimeData.getBoolean('androidAppsAllowed'); 160 loadTimeData.getBoolean('androidAppsAllowed');
161 }, 161 },
162 162
163 intersectionObserver_: null,
scottchen 2017/03/28 22:06:55 Do you need @private here?
dpapad 2017/03/28 22:10:57 This needs "@private {?IntersectionObserver}", but
dpapad 2017/03/29 22:17:10 Done.
164
163 /** @override */ 165 /** @override */
164 attached: function() { 166 attached: function() {
165 setTimeout(function() { 167 setTimeout(function() {
166 chrome.send( 168 chrome.send(
167 'metricsHandler:recordTime', 169 'metricsHandler:recordTime',
168 ['Settings.TimeUntilInteractive', window.performance.now()]); 170 ['Settings.TimeUntilInteractive', window.performance.now()]);
169 }); 171 });
170 // Preload bold Roboto so it doesn't load and flicker the first time used. 172 // Preload bold Roboto so it doesn't load and flicker the first time used.
171 document.fonts.load('bold 12px Roboto'); 173 document.fonts.load('bold 12px Roboto');
172 settings.setGlobalScrollTarget(this.$.headerPanel.scroller); 174 settings.setGlobalScrollTarget(this.$.container);
175
176 this.setupDropShadow_();
Dan Beam 2017/03/29 13:19:55 just make this part of attached rather than a sepa
dpapad 2017/03/29 22:17:10 Done.
177 },
178
179 /** @private */
180 setupDropShadow_: function() {
181 var callback = function(entries) {
182 assert(entries.length == 1);
183 entries[0].intersectionRatio == 0 ?
184 this.$.dropShadow.classList.add('has-shadow') :
185 this.$.dropShadow.classList.remove('has-shadow');
Dan Beam 2017/03/29 13:19:55 this.$.dropShadow.classList.toggle('has-shadow', e
dpapad 2017/03/29 22:17:10 Done.
186 }.bind(this);
187
188 this.intersectionObserver_ = new IntersectionObserver(callback, {
189 root: this.$.container,
190 threshold: 0,
191 });
192 this.intersectionObserver_.observe(this.$.intersectionProbe);
173 }, 193 },
174 194
175 /** @override */ 195 /** @override */
176 detached: function() { 196 detached: function() {
177 settings.resetRouteForTesting(); 197 settings.resetRouteForTesting();
198 this.intersectionObserver_.disconnect();
199 this.intersectionObserver_ = null;
178 }, 200 },
179 201
180 /** @param {!settings.Route} route */ 202 /** @param {!settings.Route} route */
181 currentRouteChanged: function(route) { 203 currentRouteChanged: function(route) {
182 var urlSearchQuery = settings.getQueryParameters().get('search') || ''; 204 var urlSearchQuery = settings.getQueryParameters().get('search') || '';
183 if (urlSearchQuery == this.lastSearchQuery_) 205 if (urlSearchQuery == this.lastSearchQuery_)
184 return; 206 return;
185 207
186 this.lastSearchQuery_ = urlSearchQuery; 208 this.lastSearchQuery_ = urlSearchQuery;
187 209
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 onMenuButtonTap_: function() { 264 onMenuButtonTap_: function() {
243 this.$.drawer.toggle(); 265 this.$.drawer.toggle();
244 }, 266 },
245 267
246 /** @private */ 268 /** @private */
247 directionDelegateChanged_: function() { 269 directionDelegateChanged_: function() {
248 this.$.drawer.align = this.directionDelegate.isRtl() ? 270 this.$.drawer.align = this.directionDelegate.isRtl() ?
249 'right' : 'left'; 271 'right' : 'left';
250 }, 272 },
251 }); 273 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698