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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/contextual_search/promo.js
diff --git a/chrome/browser/resources/contextual_search/promo.js b/chrome/browser/resources/contextual_search/promo.js
index 1168db2f0dbd256e702db48191900283f6e7973a..41d48b14b4a4dbeb9092f1e1c1fe5fae22f2534a 100644
--- a/chrome/browser/resources/contextual_search/promo.js
+++ b/chrome/browser/resources/contextual_search/promo.js
@@ -3,21 +3,44 @@
found in the LICENSE file.
*/
+<include src="../../../../ui/webui/resources/js/util.js">
+<include src="../../../../ui/webui/resources/js/load_time_data.js">
+
+// Used to indicate whether we've treated the header image for possible
+// deletion.
+var treatedHeader = false;
+
/**
* On load, registers the handler to add the 'hide' class to the container
* element in order to hide it.
*/
window.onload = function() {
+ 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.
$('optin-label').addEventListener('click', function() {
$('container').classList.add('hide');
});
};
/**
+ * Depending on the configuration value, we may need to remove the header image.
+ */
+function possiblyRemoveHeader() {
+ if (treatedHeader) {
+ return;
+ }
+ treatedHeader = true;
+
+ if (config['hideHeader']) {
+ $('container').removeChild($('header-image'));
+ }
+}
+
+/**
* Returns the height of the content. Method called from Chrome to properly size
* the view embedding it.
* @return {number} The height of the content, in pixels.
*/
function getContentHeight() {
+ 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.
return $('container').clientHeight;
}

Powered by Google App Engine
This is Rietveld 408576698