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 | 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 loadTimeData.getString('suggestions'), | 166 loadTimeData.getString('suggestions'), |
167 false, | 167 false, |
168 (newTabView.appsPages.length > 0) ? | 168 (newTabView.appsPages.length > 0) ? |
169 newTabView.appsPages[0] : null); | 169 newTabView.appsPages[0] : null); |
170 chrome.send('getSuggestions'); | 170 chrome.send('getSuggestions'); |
171 cr.dispatchSimpleEvent(document, 'sectionready', true, true); | 171 cr.dispatchSimpleEvent(document, 'sectionready', true, true); |
172 }; | 172 }; |
173 document.querySelector('head').appendChild(suggestions_script); | 173 document.querySelector('head').appendChild(suggestions_script); |
174 } | 174 } |
175 | 175 |
176 var webStoreLink = loadTimeData.getString('webStoreLink'); | 176 if (!loadTimeData.getBoolean('showWebStoreIcon')) { |
177 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); | 177 var webStoreIcon = $('chrome-web-store-link'); |
178 $('chrome-web-store-link').href = url; | 178 // Not all versions of the NTP have a footer, so this may not exist. |
179 $('chrome-web-store-link').addEventListener('click', | 179 if (webStoreIcon) |
180 onChromeWebStoreButtonClick); | 180 webStoreIcon.classList.add('invisible'); |
| 181 } else { |
| 182 var webStoreLink = loadTimeData.getString('webStoreLink'); |
| 183 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); |
| 184 $('chrome-web-store-link').href = url; |
| 185 $('chrome-web-store-link').addEventListener('click', |
| 186 onChromeWebStoreButtonClick); |
| 187 } |
181 | 188 |
182 if (loadTimeData.getString('login_status_message')) { | 189 if (loadTimeData.getString('login_status_message')) { |
183 loginBubble = new cr.ui.Bubble; | 190 loginBubble = new cr.ui.Bubble; |
184 loginBubble.anchorNode = $('login-container'); | 191 loginBubble.anchorNode = $('login-container'); |
185 loginBubble.arrowLocation = cr.ui.ArrowLocation.TOP_END; | 192 loginBubble.arrowLocation = cr.ui.ArrowLocation.TOP_END; |
186 loginBubble.bubbleAlignment = | 193 loginBubble.bubbleAlignment = |
187 cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE; | 194 cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE; |
188 loginBubble.deactivateToDismissDelay = 2000; | 195 loginBubble.deactivateToDismissDelay = 2000; |
189 loginBubble.closeButtonVisible = false; | 196 loginBubble.closeButtonVisible = false; |
190 | 197 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 setFaviconDominantColor: setFaviconDominantColor, | 670 setFaviconDominantColor: setFaviconDominantColor, |
664 showNotification: showNotification, | 671 showNotification: showNotification, |
665 themeChanged: themeChanged, | 672 themeChanged: themeChanged, |
666 updateLogin: updateLogin | 673 updateLogin: updateLogin |
667 }; | 674 }; |
668 }); | 675 }); |
669 | 676 |
670 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 677 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
671 | 678 |
672 var toCssPx = cr.ui.toCssPx; | 679 var toCssPx = cr.ui.toCssPx; |
OLD | NEW |