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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (infoBubble) | 101 if (infoBubble) |
102 window.setTimeout(infoBubble.reposition.bind(infoBubble), 0); | 102 window.setTimeout(infoBubble.reposition.bind(infoBubble), 0); |
103 } | 103 } |
104 }; | 104 }; |
105 | 105 |
106 /** | 106 /** |
107 * Invoked at startup once the DOM is available to initialize the app. | 107 * Invoked at startup once the DOM is available to initialize the app. |
108 */ | 108 */ |
109 function onLoad() { | 109 function onLoad() { |
110 sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1; | 110 sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1; |
111 if (loadTimeData.getBoolean('isSuggestionsPageEnabled')) | 111 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) |
112 sectionsToWaitFor++; | 112 sectionsToWaitFor++; |
113 measureNavDots(); | 113 measureNavDots(); |
114 | 114 |
115 // Load the current theme colors. | 115 // Load the current theme colors. |
116 themeChanged(); | 116 themeChanged(); |
117 | 117 |
118 newTabView = new NewTabView(); | 118 newTabView = new NewTabView(); |
119 | 119 |
120 notificationContainer = getRequiredElement('notification-container'); | 120 notificationContainer = getRequiredElement('notification-container'); |
121 notificationContainer.addEventListener( | 121 notificationContainer.addEventListener( |
(...skipping 11 matching lines...) Expand all Loading... |
133 var mostVisited = new ntp.MostVisitedPage(); | 133 var mostVisited = new ntp.MostVisitedPage(); |
134 // Move the footer into the most visited page if we are in "bare minimum" | 134 // Move the footer into the most visited page if we are in "bare minimum" |
135 // mode. | 135 // mode. |
136 if (document.body.classList.contains('bare-minimum')) | 136 if (document.body.classList.contains('bare-minimum')) |
137 mostVisited.appendFooter(getRequiredElement('footer')); | 137 mostVisited.appendFooter(getRequiredElement('footer')); |
138 newTabView.appendTilePage(mostVisited, | 138 newTabView.appendTilePage(mostVisited, |
139 loadTimeData.getString('mostvisited'), | 139 loadTimeData.getString('mostvisited'), |
140 false); | 140 false); |
141 chrome.send('getMostVisited'); | 141 chrome.send('getMostVisited'); |
142 | 142 |
143 if (loadTimeData.getBoolean('isSuggestionsPageEnabled')) { | 143 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) { |
144 var suggestions_script = document.createElement('script'); | 144 var suggestions_script = document.createElement('script'); |
145 suggestions_script.src = 'suggestions_page.js'; | 145 suggestions_script.src = 'suggestions_page.js'; |
146 suggestions_script.onload = function() { | 146 suggestions_script.onload = function() { |
147 newTabView.appendTilePage(new ntp.SuggestionsPage(), | 147 newTabView.appendTilePage(new ntp.SuggestionsPage(), |
148 loadTimeData.getString('suggestions'), | 148 loadTimeData.getString('suggestions'), |
149 false, | 149 false, |
150 (newTabView.appsPages.length > 0) ? | 150 (newTabView.appsPages.length > 0) ? |
151 newTabView.appsPages[0] : null); | 151 newTabView.appsPages[0] : null); |
152 chrome.send('getSuggestions'); | 152 chrome.send('getSuggestions'); |
153 cr.dispatchSimpleEvent(document, 'sectionready', true, true); | 153 cr.dispatchSimpleEvent(document, 'sectionready', true, true); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 setStripeColor: setStripeColor, | 586 setStripeColor: setStripeColor, |
587 showNotification: showNotification, | 587 showNotification: showNotification, |
588 themeChanged: themeChanged, | 588 themeChanged: themeChanged, |
589 updateLogin: updateLogin | 589 updateLogin: updateLogin |
590 }; | 590 }; |
591 }); | 591 }); |
592 | 592 |
593 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 593 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
594 | 594 |
595 var toCssPx = cr.ui.toCssPx; | 595 var toCssPx = cr.ui.toCssPx; |
OLD | NEW |