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

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

Issue 9303005: [NTP4] Experiment for adding Chrome Web Store link to footer. (Closed)
Patch Set: rebase Created 8 years, 10 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 (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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 'webkitTransitionEnd', onNotificationTransitionEnd); 106 'webkitTransitionEnd', onNotificationTransitionEnd);
107 107
108 cr.ui.decorate($('recently-closed-menu-button'), ntp4.RecentMenuButton); 108 cr.ui.decorate($('recently-closed-menu-button'), ntp4.RecentMenuButton);
109 chrome.send('getRecentlyClosedTabs'); 109 chrome.send('getRecentlyClosedTabs');
110 110
111 newTabView.appendTilePage(new ntp4.MostVisitedPage(), 111 newTabView.appendTilePage(new ntp4.MostVisitedPage(),
112 localStrings.getString('mostvisited'), 112 localStrings.getString('mostvisited'),
113 false); 113 false);
114 chrome.send('getMostVisited'); 114 chrome.send('getMostVisited');
115 115
116 if (templateData.isWebStoreExperimentEnabled) {
117 var webstoreLink = localStrings.getString('webStoreLink');
118 var url = appendParam(webstoreLink, 'utm_source', 'chrome-ntp-launcher');
119 $('chrome-web-store-href').href = url;
120
121 $('chrome-web-store-href').addEventListener('click',
122 onChromeWebStoreButtonClick);
123
124 $('footer-content').classList.add('enable-cws-experiment');
125 }
126
116 if (localStrings.getString('login_status_message')) { 127 if (localStrings.getString('login_status_message')) {
117 loginBubble = new cr.ui.Bubble; 128 loginBubble = new cr.ui.Bubble;
118 loginBubble.anchorNode = $('login-container'); 129 loginBubble.anchorNode = $('login-container');
119 loginBubble.setArrowLocation(cr.ui.ArrowLocation.TOP_END); 130 loginBubble.setArrowLocation(cr.ui.ArrowLocation.TOP_END);
120 loginBubble.bubbleAlignment = 131 loginBubble.bubbleAlignment =
121 cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE; 132 cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE;
122 loginBubble.deactivateToDismissDelay = 2000; 133 loginBubble.deactivateToDismissDelay = 2000;
123 loginBubble.setCloseButtonVisible(false); 134 loginBubble.setCloseButtonVisible(false);
124 135
125 $('login-status-learn-more').href = 136 $('login-status-learn-more').href =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 var loginContainer = getRequiredElement('login-container'); 177 var loginContainer = getRequiredElement('login-container');
167 loginContainer.addEventListener('click', function() { 178 loginContainer.addEventListener('click', function() {
168 var rect = loginContainer.getBoundingClientRect(); 179 var rect = loginContainer.getBoundingClientRect();
169 chrome.send('showSyncLoginUI', 180 chrome.send('showSyncLoginUI',
170 [rect.left, rect.top, rect.width, rect.height]); 181 [rect.left, rect.top, rect.width, rect.height]);
171 }); 182 });
172 chrome.send('initializeSyncLogin'); 183 chrome.send('initializeSyncLogin');
173 } 184 }
174 185
175 /** 186 /**
187 * Launches the chrome web store app with the chrome-ntp-launcher
188 * source.
189 * @param {Event} e The click event.
190 */
191 function onChromeWebStoreButtonClick(e) {
192 chrome.send('recordAppLaunchByURL',
193 [encodeURIComponent(this.href),
194 ntp4.APP_LAUNCH.NTP_WEBSTORE_FOOTER]);
195 }
196
197 /**
176 * Fills in an invisible div with the 'Most Visited' string so that 198 * Fills in an invisible div with the 'Most Visited' string so that
177 * its length may be measured and the nav dots sized accordingly. 199 * its length may be measured and the nav dots sized accordingly.
178 */ 200 */
179 function measureNavDots() { 201 function measureNavDots() {
180 var measuringDiv = $('fontMeasuringDiv'); 202 var measuringDiv = $('fontMeasuringDiv');
181 measuringDiv.textContent = localStrings.getString('mostvisited'); 203 measuringDiv.textContent = localStrings.getString('mostvisited');
182 var pxWidth = Math.max(measuringDiv.clientWidth * 1.15, 80); 204 var pxWidth = Math.max(measuringDiv.clientWidth * 1.15, 80);
183 205
184 var styleElement = document.createElement('style'); 206 var styleElement = document.createElement('style');
185 styleElement.type = 'text/css'; 207 styleElement.type = 'text/css';
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // TODO(estade): update the content handlers to use ntp namespace instead of 447 // TODO(estade): update the content handlers to use ntp namespace instead of
426 // making these global. 448 // making these global.
427 var getAppsCallback = ntp4.getAppsCallback; 449 var getAppsCallback = ntp4.getAppsCallback;
428 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; 450 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback;
429 var themeChanged = ntp4.themeChanged; 451 var themeChanged = ntp4.themeChanged;
430 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; 452 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs;
431 var setMostVisitedPages = ntp4.setMostVisitedPages; 453 var setMostVisitedPages = ntp4.setMostVisitedPages;
432 var updateLogin = ntp4.updateLogin; 454 var updateLogin = ntp4.updateLogin;
433 455
434 document.addEventListener('DOMContentLoaded', ntp4.onLoad); 456 document.addEventListener('DOMContentLoaded', ntp4.onLoad);
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/resources/ntp4/recently_closed.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698