| OLD | NEW |
| 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 4 | 6 * @fileoverview New tab page 4 |
| 7 * This is the main code for a previous version of the Chrome NTP ("NTP4"). | 7 * This is the main code for a previous version of the Chrome NTP ("NTP4"). |
| 8 * Some parts of this are still used for the chrome://apps page. | 8 * Some parts of this are still used for the chrome://apps page. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 if (!loadTimeData.getBoolean('showWebStoreIcon')) { | 98 if (!loadTimeData.getBoolean('showWebStoreIcon')) { |
| 99 var webStoreIcon = $('chrome-web-store-link'); | 99 var webStoreIcon = $('chrome-web-store-link'); |
| 100 // Not all versions of the NTP have a footer, so this may not exist. | 100 // Not all versions of the NTP have a footer, so this may not exist. |
| 101 if (webStoreIcon) | 101 if (webStoreIcon) |
| 102 webStoreIcon.hidden = true; | 102 webStoreIcon.hidden = true; |
| 103 } else { | 103 } else { |
| 104 var webStoreLink = loadTimeData.getString('webStoreLink'); | 104 var webStoreLink = loadTimeData.getString('webStoreLink'); |
| 105 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); | 105 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); |
| 106 $('chrome-web-store-link').href = url; | 106 $('chrome-web-store-link').href = url; |
| 107 $('chrome-web-store-link').addEventListener('auxclick', |
| 108 onChromeWebStoreButtonClick); |
| 107 $('chrome-web-store-link').addEventListener('click', | 109 $('chrome-web-store-link').addEventListener('click', |
| 108 onChromeWebStoreButtonClick); | 110 onChromeWebStoreButtonClick); |
| 109 } | 111 } |
| 110 | 112 |
| 111 // We need to wait for all the footer menu setup to be completed before | 113 // We need to wait for all the footer menu setup to be completed before |
| 112 // we can compute its layout. | 114 // we can compute its layout. |
| 113 layoutFooter(); | 115 layoutFooter(); |
| 114 | 116 |
| 115 if (loadTimeData.getString('login_status_message')) { | 117 if (loadTimeData.getString('login_status_message')) { |
| 116 loginBubble = new cr.ui.Bubble; | 118 loginBubble = new cr.ui.Bubble; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true); | 150 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true); |
| 149 document.documentElement.classList.remove('starting-up'); | 151 document.documentElement.classList.remove('starting-up'); |
| 150 | 152 |
| 151 startTime = Date.now(); | 153 startTime = Date.now(); |
| 152 }); | 154 }); |
| 153 } | 155 } |
| 154 | 156 |
| 155 /** | 157 /** |
| 156 * Launches the chrome web store app with the chrome-ntp-launcher | 158 * Launches the chrome web store app with the chrome-ntp-launcher |
| 157 * source. | 159 * source. |
| 158 * @param {Event} e The click event. | 160 * @param {Event} e The click/auxclick event. |
| 159 */ | 161 */ |
| 160 function onChromeWebStoreButtonClick(e) { | 162 function onChromeWebStoreButtonClick(e) { |
| 161 chrome.send('recordAppLaunchByURL', | 163 chrome.send('recordAppLaunchByURL', |
| 162 [encodeURIComponent(this.href), | 164 [encodeURIComponent(this.href), |
| 163 ntp.APP_LAUNCH.NTP_WEBSTORE_FOOTER]); | 165 ntp.APP_LAUNCH.NTP_WEBSTORE_FOOTER]); |
| 164 } | 166 } |
| 165 | 167 |
| 166 /** | 168 /** |
| 167 * The number of sections to wait on. | 169 * The number of sections to wait on. |
| 168 * @type {number} | 170 * @type {number} |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 setBookmarkBarAttached: setBookmarkBarAttached, | 448 setBookmarkBarAttached: setBookmarkBarAttached, |
| 447 setFaviconDominantColor: setFaviconDominantColor, | 449 setFaviconDominantColor: setFaviconDominantColor, |
| 448 themeChanged: themeChanged, | 450 themeChanged: themeChanged, |
| 449 updateLogin: updateLogin | 451 updateLogin: updateLogin |
| 450 }; | 452 }; |
| 451 }); | 453 }); |
| 452 | 454 |
| 453 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 455 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| 454 | 456 |
| 455 var toCssPx = cr.ui.toCssPx; | 457 var toCssPx = cr.ui.toCssPx; |
| OLD | NEW |