| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 601     appAdded: appAdded, | 612     appAdded: appAdded, | 
| 602     appMoved: appMoved, | 613     appMoved: appMoved, | 
| 603     appRemoved: appRemoved, | 614     appRemoved: appRemoved, | 
| 604     appsPrefChangeCallback: appsPrefChangeCallback, | 615     appsPrefChangeCallback: appsPrefChangeCallback, | 
| 605     enterRearrangeMode: enterRearrangeMode, | 616     enterRearrangeMode: enterRearrangeMode, | 
| 606     getAppsCallback: getAppsCallback, | 617     getAppsCallback: getAppsCallback, | 
| 607     getAppsPageIndex: getAppsPageIndex, | 618     getAppsPageIndex: getAppsPageIndex, | 
| 608     getCardSlider: getCardSlider, | 619     getCardSlider: getCardSlider, | 
| 609     onLoad: onLoad, | 620     onLoad: onLoad, | 
| 610     leaveRearrangeMode: leaveRearrangeMode, | 621     leaveRearrangeMode: leaveRearrangeMode, | 
|  | 622     NtpFollowAction: NtpFollowAction, | 
| 611     saveAppPageName: saveAppPageName, | 623     saveAppPageName: saveAppPageName, | 
| 612     setAppToBeHighlighted: setAppToBeHighlighted, | 624     setAppToBeHighlighted: setAppToBeHighlighted, | 
| 613     setBookmarkBarAttached: setBookmarkBarAttached, | 625     setBookmarkBarAttached: setBookmarkBarAttached, | 
| 614     setForeignSessions: setForeignSessions, | 626     setForeignSessions: setForeignSessions, | 
| 615     setMostVisitedPages: setMostVisitedPages, | 627     setMostVisitedPages: setMostVisitedPages, | 
| 616     setSuggestionsPages: setSuggestionsPages, | 628     setSuggestionsPages: setSuggestionsPages, | 
| 617     setRecentlyClosedTabs: setRecentlyClosedTabs, | 629     setRecentlyClosedTabs: setRecentlyClosedTabs, | 
| 618     setStripeColor: setStripeColor, | 630     setStripeColor: setStripeColor, | 
| 619     showNotification: showNotification, | 631     showNotification: showNotification, | 
| 620     themeChanged: themeChanged, | 632     themeChanged: themeChanged, | 
| 621     updateLogin: updateLogin | 633     updateLogin: updateLogin | 
| 622   }; | 634   }; | 
| 623 }); | 635 }); | 
| 624 | 636 | 
| 625 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 637 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 
| OLD | NEW | 
|---|