OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 shownPage = templateData['shown_page_type']; | 143 shownPage = templateData['shown_page_type']; |
144 shownPageIndex = templateData['shown_page_index']; | 144 shownPageIndex = templateData['shown_page_index']; |
145 | 145 |
146 // Request data on the apps so we can fill them in. | 146 // Request data on the apps so we can fill them in. |
147 // Note that this is kicked off asynchronously. 'getAppsCallback' will be | 147 // Note that this is kicked off asynchronously. 'getAppsCallback' will be |
148 // invoked at some point after this function returns. | 148 // invoked at some point after this function returns. |
149 chrome.send('getApps'); | 149 chrome.send('getApps'); |
150 | 150 |
151 chrome.send('initializeSyncLogin'); | 151 chrome.send('initializeSyncLogin'); |
152 $('login-container').addEventListener('click', function() { | 152 $('login-container').addEventListener('click', function() { |
153 chrome.send('showSyncLoginUI'); | 153 var rect = $('login-container').getBoundingClientRect(); |
| 154 chrome.send('showSyncLoginUI', |
| 155 [rect.left, rect.top, rect.width, rect.height]); |
154 }); | 156 }); |
155 | 157 |
156 // Prevent touch events from triggering any sort of native scrolling | 158 // Prevent touch events from triggering any sort of native scrolling |
157 document.addEventListener('touchmove', function(e) { | 159 document.addEventListener('touchmove', function(e) { |
158 e.preventDefault(); | 160 e.preventDefault(); |
159 }, true); | 161 }, true); |
160 | 162 |
161 tilePages = pageList.getElementsByClassName('tile-page'); | 163 tilePages = pageList.getElementsByClassName('tile-page'); |
162 appsPages = pageList.getElementsByClassName('apps-page'); | 164 appsPages = pageList.getElementsByClassName('apps-page'); |
163 | 165 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 var getAppsCallback = ntp4.getAppsCallback; | 895 var getAppsCallback = ntp4.getAppsCallback; |
894 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 896 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
895 var themeChanged = ntp4.themeChanged; | 897 var themeChanged = ntp4.themeChanged; |
896 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; | 898 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; |
897 var setMostVisitedPages = ntp4.setMostVisitedPages; | 899 var setMostVisitedPages = ntp4.setMostVisitedPages; |
898 var updateLogin = ntp4.updateLogin; | 900 var updateLogin = ntp4.updateLogin; |
899 | 901 |
900 document.addEventListener('DOMContentLoaded', ntp4.initialize); | 902 document.addEventListener('DOMContentLoaded', ntp4.initialize); |
901 window.addEventListener('online', ntp4.updateOfflineEnabledApps); | 903 window.addEventListener('online', ntp4.updateOfflineEnabledApps); |
902 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); | 904 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); |
OLD | NEW |