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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // mode. | 163 // mode. |
164 if (document.body.classList.contains('bare-minimum')) | 164 if (document.body.classList.contains('bare-minimum')) |
165 mostVisited.appendFooter(getRequiredElement('footer')); | 165 mostVisited.appendFooter(getRequiredElement('footer')); |
166 newTabView.appendTilePage(mostVisited, | 166 newTabView.appendTilePage(mostVisited, |
167 loadTimeData.getString('mostvisited'), | 167 loadTimeData.getString('mostvisited'), |
168 false); | 168 false); |
169 chrome.send('getMostVisited'); | 169 chrome.send('getMostVisited'); |
170 } | 170 } |
171 | 171 |
172 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) { | 172 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) { |
173 var suggestions_script = document.createElement('script'); | 173 var suggestionsScript = document.createElement('script'); |
174 suggestions_script.src = 'suggestions_page.js'; | 174 suggestionsScript.src = 'suggestions_page.js'; |
175 suggestions_script.onload = function() { | 175 suggestionsScript.onload = function() { |
176 newTabView.appendTilePage(new ntp.SuggestionsPage(), | 176 newTabView.appendTilePage(new ntp.SuggestionsPage(), |
177 loadTimeData.getString('suggestions'), | 177 loadTimeData.getString('suggestions'), |
178 false, | 178 false, |
179 (newTabView.appsPages.length > 0) ? | 179 (newTabView.appsPages.length > 0) ? |
180 newTabView.appsPages[0] : null); | 180 newTabView.appsPages[0] : null); |
181 chrome.send('getSuggestions'); | 181 chrome.send('getSuggestions'); |
182 cr.dispatchSimpleEvent(document, 'sectionready', true, true); | 182 cr.dispatchSimpleEvent(document, 'sectionready', true, true); |
183 }; | 183 }; |
184 document.querySelector('head').appendChild(suggestions_script); | 184 document.querySelector('head').appendChild(suggestionsScript); |
185 } | 185 } |
186 | 186 |
187 if (!loadTimeData.getBoolean('showWebStoreIcon')) { | 187 if (!loadTimeData.getBoolean('showWebStoreIcon')) { |
188 var webStoreIcon = $('chrome-web-store-link'); | 188 var webStoreIcon = $('chrome-web-store-link'); |
189 // Not all versions of the NTP have a footer, so this may not exist. | 189 // Not all versions of the NTP have a footer, so this may not exist. |
190 if (webStoreIcon) | 190 if (webStoreIcon) |
191 webStoreIcon.classList.add('invisible'); | 191 webStoreIcon.classList.add('invisible'); |
192 } else { | 192 } else { |
193 var webStoreLink = loadTimeData.getString('webStoreLink'); | 193 var webStoreLink = loadTimeData.getString('webStoreLink'); |
194 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); | 194 var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher'); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 setFaviconDominantColor: setFaviconDominantColor, | 689 setFaviconDominantColor: setFaviconDominantColor, |
690 showNotification: showNotification, | 690 showNotification: showNotification, |
691 themeChanged: themeChanged, | 691 themeChanged: themeChanged, |
692 updateLogin: updateLogin | 692 updateLogin: updateLogin |
693 }; | 693 }; |
694 }); | 694 }); |
695 | 695 |
696 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 696 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
697 | 697 |
698 var toCssPx = cr.ui.toCssPx; | 698 var toCssPx = cr.ui.toCssPx; |
OLD | NEW |