| Index: chrome/browser/resources/new_new_tab.js
|
| diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
|
| index e4720725b61b81502b720f210cf053627008af0d..99cb712c4e4616555d12a52617f772b87973c9d9 100644
|
| --- a/chrome/browser/resources/new_new_tab.js
|
| +++ b/chrome/browser/resources/new_new_tab.js
|
| @@ -9,8 +9,6 @@ var MAX_MINIVIEW_ITEMS = 15;
|
| // Extra spacing at the top of the layout.
|
| var LAYOUT_SPACING_TOP = 25;
|
|
|
| -var loading = true;
|
| -
|
| function updateSimpleSection(id, section) {
|
| var elm = $(id);
|
| var maxiview = getSectionMaxiview(elm);
|
| @@ -585,7 +583,7 @@ var localStrings = new LocalStrings();
|
| // Things we know are not needed at startup go below here
|
|
|
| function afterTransition(f) {
|
| - if (loading) {
|
| + if (!isDoneLoading()) {
|
| // Make sure we do not use a timer during load since it slows down the UI.
|
| f();
|
| } else {
|
| @@ -954,13 +952,11 @@ function mostVisitedPages(data, firstRun, hasBlacklistedUrls) {
|
| mostVisited.layout();
|
| layoutSections();
|
|
|
| - loading = false;
|
| -
|
| // Remove class name in a timeout so that changes done in this JS thread are
|
| // not animated.
|
| window.setTimeout(function() {
|
| mostVisited.ensureSmallGridCorrect();
|
| - document.body.classList.remove('loading');
|
| + maybeDoneLoading();
|
| }, 1);
|
|
|
| // Only show the first run notification if first run.
|
| @@ -968,3 +964,12 @@ function mostVisitedPages(data, firstRun, hasBlacklistedUrls) {
|
| showFirstRunNotification();
|
| }
|
| }
|
| +
|
| +function maybeDoneLoading() {
|
| + if (mostVisited.data && apps.loaded)
|
| + document.body.classList.remove('loading');
|
| +}
|
| +
|
| +function isDoneLoading() {
|
| + return !document.body.classList.contains('loading');
|
| +}
|
|
|