Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 /** | 61 /** |
| 62 * The time in milliseconds for most transitions. This should match what's | 62 * The time in milliseconds for most transitions. This should match what's |
| 63 * in new_tab.css. Unfortunately there's no better way to try to time | 63 * in new_tab.css. Unfortunately there's no better way to try to time |
| 64 * something to occur until after a transition has completed. | 64 * something to occur until after a transition has completed. |
| 65 * @type {number} | 65 * @type {number} |
| 66 * @const | 66 * @const |
| 67 */ | 67 */ |
| 68 var DEFAULT_TRANSITION_TIME = 500; | 68 var DEFAULT_TRANSITION_TIME = 500; |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * See description for these values in ntp_stats.h. | |
| 72 * @enum {number} | |
| 73 */ | |
| 74 var NtpFollowAction = { | |
| 75 CLICKED_TILE: 11, | |
| 76 CLICKED_OTHER_NTP_PANE: 12, | |
| 77 OTHER: 13 | |
| 78 }; | |
| 79 | |
| 80 /** | |
| 71 * Creates a NewTabView object. NewTabView extends PageListView with | 81 * Creates a NewTabView object. NewTabView extends PageListView with |
| 72 * new tab UI specific logics. | 82 * new tab UI specific logics. |
| 73 * @constructor | 83 * @constructor |
| 74 * @extends {PageListView} | 84 * @extends {PageListView} |
| 75 */ | 85 */ |
| 76 function NewTabView() { | 86 function NewTabView() { |
| 77 var pageSwitcherStart = null; | 87 var pageSwitcherStart = null; |
| 78 var pageSwitcherEnd = null; | 88 var pageSwitcherEnd = null; |
| 79 if (templateData.showApps) { | 89 if (templateData.showApps) { |
| 80 pageSwitcherStart = getRequiredElement('page-switcher-start'); | 90 pageSwitcherStart = getRequiredElement('page-switcher-start'); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 return node.tagName == 'IMG' && | 234 return node.tagName == 'IMG' && |
| 225 /^data\:image\/(?:png|gif|jpe?g)/.test(value); | 235 /^data\:image\/(?:png|gif|jpe?g)/.test(value); |
| 226 }, | 236 }, |
| 227 }; | 237 }; |
| 228 showNotification(parseHtmlSubset(promo, tags, attrs), [], function() { | 238 showNotification(parseHtmlSubset(promo, tags, attrs), [], function() { |
| 229 chrome.send('closeNotificationPromo'); | 239 chrome.send('closeNotificationPromo'); |
| 230 }, 60000); | 240 }, 60000); |
| 231 chrome.send('notificationPromoViewed'); | 241 chrome.send('notificationPromoViewed'); |
| 232 } | 242 } |
| 233 | 243 |
| 244 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true); | |
| 234 document.documentElement.classList.remove('starting-up'); | 245 document.documentElement.classList.remove('starting-up'); |
| 235 }); | 246 }); |
| 236 } | 247 } |
| 237 | 248 |
| 238 /** | 249 /** |
| 239 * Launches the chrome web store app with the chrome-ntp-launcher | 250 * Launches the chrome web store app with the chrome-ntp-launcher |
| 240 * source. | 251 * source. |
| 241 * @param {Event} e The click event. | 252 * @param {Event} e The click event. |
| 242 */ | 253 */ |
| 243 function onChromeWebStoreButtonClick(e) { | 254 function onChromeWebStoreButtonClick(e) { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 saveAppPageName: saveAppPageName, | 622 saveAppPageName: saveAppPageName, |
| 612 setAppToBeHighlighted: setAppToBeHighlighted, | 623 setAppToBeHighlighted: setAppToBeHighlighted, |
| 613 setBookmarkBarAttached: setBookmarkBarAttached, | 624 setBookmarkBarAttached: setBookmarkBarAttached, |
| 614 setForeignSessions: setForeignSessions, | 625 setForeignSessions: setForeignSessions, |
| 615 setMostVisitedPages: setMostVisitedPages, | 626 setMostVisitedPages: setMostVisitedPages, |
| 616 setSuggestionsPages: setSuggestionsPages, | 627 setSuggestionsPages: setSuggestionsPages, |
| 617 setRecentlyClosedTabs: setRecentlyClosedTabs, | 628 setRecentlyClosedTabs: setRecentlyClosedTabs, |
| 618 setStripeColor: setStripeColor, | 629 setStripeColor: setStripeColor, |
| 619 showNotification: showNotification, | 630 showNotification: showNotification, |
| 620 themeChanged: themeChanged, | 631 themeChanged: themeChanged, |
| 621 updateLogin: updateLogin | 632 updateLogin: updateLogin, |
| 633 NtpFollowAction: NtpFollowAction | |
|
Evan Stade
2012/04/26 21:13:05
alphabetical (case insensitive)
macourteau
2012/04/26 21:51:33
Done.
| |
| 622 }; | 634 }; |
| 623 }); | 635 }); |
| 624 | 636 |
| 625 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 637 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| OLD | NEW |