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

Side by Side Diff: chrome/browser/resources/new_new_tab.js

Issue 4708002: Add a histogram for tracking web store promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: incorporate feedback Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more 5 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more
6 // than this many items in the miniview. 6 // than this many items in the miniview.
7 var MAX_MINIVIEW_ITEMS = 15; 7 var MAX_MINIVIEW_ITEMS = 15;
8 8
9 // Extra spacing at the top of the layout. 9 // Extra spacing at the top of the layout.
10 var LAYOUT_SPACING_TOP = 25; 10 var LAYOUT_SPACING_TOP = 25;
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 saveShownSections(); 901 saveShownSections();
902 } 902 }
903 903
904 function handleIfEnterKey(f) { 904 function handleIfEnterKey(f) {
905 return function(e) { 905 return function(e) {
906 if (e.keyIdentifier == 'Enter') 906 if (e.keyIdentifier == 'Enter')
907 f(e); 907 f(e);
908 }; 908 };
909 } 909 }
910 910
911 function handleIfMiddleClick(f) {
912 return function(e) {
913 if (e.button == 1)
914 f(e);
915 };
916 }
917
911 function maybeReopenTab(e) { 918 function maybeReopenTab(e) {
912 var el = findAncestor(e.target, function(el) { 919 var el = findAncestor(e.target, function(el) {
913 return el.sessionId !== undefined; 920 return el.sessionId !== undefined;
914 }); 921 });
915 if (el) { 922 if (el) {
916 chrome.send('reopenTab', [String(el.sessionId)]); 923 chrome.send('reopenTab', [String(el.sessionId)]);
917 e.preventDefault(); 924 e.preventDefault();
918 925
919 setWindowTooltipTimeout(); 926 setWindowTooltipTimeout();
920 } 927 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 1202
1196 function maybeDoneLoading() { 1203 function maybeDoneLoading() {
1197 if (mostVisited.data && apps.loaded) 1204 if (mostVisited.data && apps.loaded)
1198 document.body.classList.remove('loading'); 1205 document.body.classList.remove('loading');
1199 } 1206 }
1200 1207
1201 function isDoneLoading() { 1208 function isDoneLoading() {
1202 return !document.body.classList.contains('loading'); 1209 return !document.body.classList.contains('loading');
1203 } 1210 }
1204 1211
1212 function recordWebStoreLaunch() {
1213 chrome.send('recordWebStoreLaunch', []);
1214 }
1215
1205 // Initialize the apps promo. 1216 // Initialize the apps promo.
1206 document.addEventListener('DOMContentLoaded', function() { 1217 document.addEventListener('DOMContentLoaded', function() {
1207 var promoText1 = $('apps-promo-text1'); 1218 var promoText1 = $('apps-promo-text1');
1208 promoText1.innerHTML = promoText1.textContent; 1219 promoText1.innerHTML = promoText1.textContent;
1209 promoText1.querySelector('a').href = localStrings.getString('web_store_url'); 1220 promoText1.querySelector('a').href = localStrings.getString('web_store_url');
1210 1221
1222 var promoLink = promoText1.querySelector('a');
1223 promoLink.onclick = recordWebStoreLaunch;
1224 promoLink.onmousedown = handleIfMiddleClick(recordWebStoreLaunch);
1225
1211 $('apps-promo-hide').addEventListener('click', function() { 1226 $('apps-promo-hide').addEventListener('click', function() {
1212 chrome.send('hideAppsPromo', []); 1227 chrome.send('hideAppsPromo', []);
1213 document.documentElement.classList.remove('apps-promo-visible'); 1228 document.documentElement.classList.remove('apps-promo-visible');
1214 layoutSections(); 1229 layoutSections();
1215 }); 1230 });
1216 }); 1231 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698