| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 /** | 431 /** |
| 432 * Timeout ID. | 432 * Timeout ID. |
| 433 * @type {number} | 433 * @type {number} |
| 434 */ | 434 */ |
| 435 var notificationTimeout = 0; | 435 var notificationTimeout = 0; |
| 436 | 436 |
| 437 /** | 437 /** |
| 438 * Shows the notification bubble. | 438 * Shows the notification bubble. |
| 439 * @param {string|Node} message The notification message or node to use as | 439 * @param {string|Node} message The notification message or node to use as |
| 440 * message. | 440 * message. |
| 441 * @param {Array.<{text: string, action: function()}>} links An array of | 441 * @param {Array<{text: string, action: function()}>} links An array of |
| 442 * records describing the links in the notification. Each record should | 442 * records describing the links in the notification. Each record should |
| 443 * have a 'text' attribute (the display string) and an 'action' attribute | 443 * have a 'text' attribute (the display string) and an 'action' attribute |
| 444 * (a function to run when the link is activated). | 444 * (a function to run when the link is activated). |
| 445 * @param {Function=} opt_closeHandler The callback invoked if the user | 445 * @param {Function=} opt_closeHandler The callback invoked if the user |
| 446 * manually dismisses the notification. | 446 * manually dismisses the notification. |
| 447 * @param {number=} opt_timeout | 447 * @param {number=} opt_timeout |
| 448 */ | 448 */ |
| 449 function showNotification(message, links, opt_closeHandler, opt_timeout) { | 449 function showNotification(message, links, opt_closeHandler, opt_timeout) { |
| 450 window.clearTimeout(notificationTimeout); | 450 window.clearTimeout(notificationTimeout); |
| 451 | 451 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (notificationContainer.classList.contains('inactive')) | 546 if (notificationContainer.classList.contains('inactive')) |
| 547 notificationContainer.hidden = true; | 547 notificationContainer.hidden = true; |
| 548 } | 548 } |
| 549 | 549 |
| 550 function setRecentlyClosedTabs(dataItems) { | 550 function setRecentlyClosedTabs(dataItems) { |
| 551 $('recently-closed-menu-button').dataItems = dataItems; | 551 $('recently-closed-menu-button').dataItems = dataItems; |
| 552 layoutFooter(); | 552 layoutFooter(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 /** | 555 /** |
| 556 * @param {Array.<PageData>} data | 556 * @param {Array<PageData>} data |
| 557 * @param {boolean} hasBlacklistedUrls | 557 * @param {boolean} hasBlacklistedUrls |
| 558 */ | 558 */ |
| 559 function setMostVisitedPages(data, hasBlacklistedUrls) { | 559 function setMostVisitedPages(data, hasBlacklistedUrls) { |
| 560 newTabView.mostVisitedPage.data = data; | 560 newTabView.mostVisitedPage.data = data; |
| 561 cr.dispatchSimpleEvent(document, 'sectionready', true, true); | 561 cr.dispatchSimpleEvent(document, 'sectionready', true, true); |
| 562 } | 562 } |
| 563 | 563 |
| 564 function setSuggestionsPages(data, hasBlacklistedUrls) { | 564 function setSuggestionsPages(data, hasBlacklistedUrls) { |
| 565 newTabView.suggestionsPage.data = data; | 565 newTabView.suggestionsPage.data = data; |
| 566 } | 566 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 setFaviconDominantColor: setFaviconDominantColor, | 781 setFaviconDominantColor: setFaviconDominantColor, |
| 782 showNotification: showNotification, | 782 showNotification: showNotification, |
| 783 themeChanged: themeChanged, | 783 themeChanged: themeChanged, |
| 784 updateLogin: updateLogin | 784 updateLogin: updateLogin |
| 785 }; | 785 }; |
| 786 }); | 786 }); |
| 787 | 787 |
| 788 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 788 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| 789 | 789 |
| 790 var toCssPx = cr.ui.toCssPx; | 790 var toCssPx = cr.ui.toCssPx; |
| OLD | NEW |