Index: chrome/browser/resources/ntp_search/new_tab.js |
diff --git a/chrome/browser/resources/ntp_search/new_tab.js b/chrome/browser/resources/ntp_search/new_tab.js |
index ef5fb929c55fa2c4470a25c8b484e6b3cc029950..32402c3a2d68b30b8136ecb8c6bb83c2ce72db9a 100644 |
--- a/chrome/browser/resources/ntp_search/new_tab.js |
+++ b/chrome/browser/resources/ntp_search/new_tab.js |
@@ -326,7 +326,9 @@ cr.define('ntp', function() { |
document.addEventListener('dragstart', closeFunc); |
notificationContainer.hidden = false; |
- showNotificationOnCurrentPage(); |
+ window.setTimeout(function() { |
pedro (no code reviews)
2012/09/06 00:28:49
Do you really need this inside a setTimeout?
jeremycho
2012/09/06 04:40:08
Without it, the fade-in transition isn't seen.
|
+ notificationContainer.classList.remove('inactive'); |
+ }, 0); |
newTabView.cardSlider.frame.addEventListener( |
'cardSlider:card_change_ended', onCardChangeEnded); |
@@ -354,33 +356,12 @@ cr.define('ntp', function() { |
if (newTabView.cardSlider.currentCardValue.notification) |
return; |
- // Hide the notification the old page. |
+ // Fade the notification out then in whenever the card has changed. |
+ // TODO(jeremycho): Add card-changed as soon as the dot is clicked? |
notificationContainer.classList.add('card-changed'); |
- |
- showNotificationOnCurrentPage(); |
- } |
- |
- /** |
- * Move and show the notification on the current page. |
- */ |
- function showNotificationOnCurrentPage() { |
- var page = newTabView.cardSlider.currentCardValue; |
- doWhenAllSectionsReady(function() { |
- if (page != newTabView.cardSlider.currentCardValue) |
- return; |
- |
- // NOTE: This moves the notification to inside of the current page. |
- page.notification = notificationContainer; |
- |
- // Reveal the notification and instruct it to hide itself if ignored. |
- notificationContainer.classList.remove('inactive'); |
- |
- // Gives the browser time to apply this rule before we remove it (causing |
- // a transition). |
- window.setTimeout(function() { |
- notificationContainer.classList.remove('card-changed'); |
- }, 0); |
- }); |
+ window.setTimeout(function() { |
+ notificationContainer.classList.remove('card-changed'); |
+ }, 0); |
} |
/** |
@@ -394,11 +375,11 @@ cr.define('ntp', function() { |
} |
function setRecentlyClosedTabs(data) { |
- newTabView.recentlyClosedPage.data = data; |
+ newTabView.recentlyClosedPage.setData(data); |
} |
function setMostVisitedPages(data, hasBlacklistedUrls) { |
- newTabView.mostVisitedPage.data = data; |
+ newTabView.mostVisitedPage.setData(data); |
cr.dispatchSimpleEvent(document, 'sectionready', true, true); |
} |