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

Side by Side Diff: chrome/browser/resources/contextual_search/promo.js

Issue 587803003: [Search] Add a header image to the promo flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using finch parameter for hiding the header Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 /* Copyright 2014 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 <include src="../../../../ui/webui/resources/js/util.js">
7 <include src="../../../../ui/webui/resources/js/load_time_data.js">
8
9 // Used to indicate whether we've treated the header image for possible
10 // deletion.
11 var treatedHeader = false;
12
6 /** 13 /**
7 * On load, registers the handler to add the 'hide' class to the container 14 * On load, registers the handler to add the 'hide' class to the container
8 * element in order to hide it. 15 * element in order to hide it.
9 */ 16 */
10 window.onload = function() { 17 window.onload = function() {
18 possiblyRemoveHeader();
pedro (no code reviews) 2014/09/22 18:25:20 If we pass the finch config to not render the head
Mathieu 2014/09/22 21:35:06 Done. I think so too, thanks.
11 $('optin-label').addEventListener('click', function() { 19 $('optin-label').addEventListener('click', function() {
12 $('container').classList.add('hide'); 20 $('container').classList.add('hide');
13 }); 21 });
14 }; 22 };
15 23
16 /** 24 /**
25 * Depending on the configuration value, we may need to remove the header image.
26 */
27 function possiblyRemoveHeader() {
28 if (treatedHeader) {
29 return;
30 }
31 treatedHeader = true;
32
33 if (config['hideHeader']) {
34 $('container').removeChild($('header-image'));
35 }
36 }
37
38 /**
17 * Returns the height of the content. Method called from Chrome to properly size 39 * Returns the height of the content. Method called from Chrome to properly size
18 * the view embedding it. 40 * the view embedding it.
19 * @return {number} The height of the content, in pixels. 41 * @return {number} The height of the content, in pixels.
20 */ 42 */
21 function getContentHeight() { 43 function getContentHeight() {
44 possiblyRemoveHeader();
pedro (no code reviews) 2014/09/22 18:25:20 I think if you use DOMContentLoaded you will not n
Mathieu 2014/09/22 21:35:06 Done.
22 return $('container').clientHeight; 45 return $('container').clientHeight;
23 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698