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

Side by Side Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 11230014: Use UMA_HISTOGRAM_ENUMERATION instead of UMA_HISTOGRAM_BOOLEAN (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: set PROMO_VIEWED to 0 Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/new_tab_page_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 New tab page 6 * @fileoverview New tab page
7 * This is the main code for the new tab page used by touch-enabled Chrome 7 * This is the main code for the new tab page used by touch-enabled Chrome
8 * browsers. For now this is still a prototype. 8 * browsers. For now this is still a prototype.
9 */ 9 */
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 chrome.send('initializeSyncLogin'); 220 chrome.send('initializeSyncLogin');
221 221
222 doWhenAllSectionsReady(function() { 222 doWhenAllSectionsReady(function() {
223 // Tell the slider about the pages. 223 // Tell the slider about the pages.
224 newTabView.updateSliderCards(); 224 newTabView.updateSliderCards();
225 // Mark the current page. 225 // Mark the current page.
226 newTabView.cardSlider.currentCardValue.navigationDot.classList.add( 226 newTabView.cardSlider.currentCardValue.navigationDot.classList.add(
227 'selected'); 227 'selected');
228 228
229 if (loadTimeData.valueExists('notificationPromoText')) { 229 if (loadTimeData.valueExists('notificationPromoText')) {
230 var promo = loadTimeData.getString('notificationPromoText'); 230 var promoText = loadTimeData.getString('notificationPromoText');
231 var tags = ['IMG']; 231 var tags = ['IMG'];
232 var attrs = { 232 var attrs = {
233 src: function(node, value) { 233 src: function(node, value) {
234 return node.tagName == 'IMG' && 234 return node.tagName == 'IMG' &&
235 /^data\:image\/(?:png|gif|jpe?g)/.test(value); 235 /^data\:image\/(?:png|gif|jpe?g)/.test(value);
236 }, 236 },
237 }; 237 };
238 showNotification(parseHtmlSubset(promo, tags, attrs), [], function() { 238
239 var promo = parseHtmlSubset(promoText, tags, attrs);
240 var promoLink = promo.querySelector('a');
241 if (promoLink) {
242 promoLink.addEventListener('click', function(e) {
243 chrome.send('notificationPromoLinkClicked');
244 });
245 }
246
247 showNotification(promo, [], function() {
239 chrome.send('notificationPromoClosed'); 248 chrome.send('notificationPromoClosed');
240 }, 60000); 249 }, 60000);
241 chrome.send('notificationPromoViewed'); 250 chrome.send('notificationPromoViewed');
242 } 251 }
243 252
244 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true); 253 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true);
245 document.documentElement.classList.remove('starting-up'); 254 document.documentElement.classList.remove('starting-up');
246 255
247 startTime = Date.now(); 256 startTime = Date.now();
248 }); 257 });
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 setFaviconDominantColor: setFaviconDominantColor, 642 setFaviconDominantColor: setFaviconDominantColor,
634 showNotification: showNotification, 643 showNotification: showNotification,
635 themeChanged: themeChanged, 644 themeChanged: themeChanged,
636 updateLogin: updateLogin 645 updateLogin: updateLogin
637 }; 646 };
638 }); 647 });
639 648
640 document.addEventListener('DOMContentLoaded', ntp.onLoad); 649 document.addEventListener('DOMContentLoaded', ntp.onLoad);
641 650
642 var toCssPx = cr.ui.toCssPx; 651 var toCssPx = cr.ui.toCssPx;
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/new_tab_page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698