Apps that don't appear on the NTP shouldn't contribute to NTP page overflow.


BUG=175377
TEST=Start chrome with a fresh profile (eg: --user-data-dir=new-dir), then keep installing apps from the Chrome Web Store until you have 18. All 18 apps should appear on the same (first) page.

Review URL: https://chromiumcodereview.appspot.com/12331003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184833 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 9b52fc3b..91d901b 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -2104,6 +2104,10 @@
     // All apps that are displayed in the launcher are ordered by their ordinals
     // so we must ensure they have valid ordinals.
     if (extension->RequiresSortOrdinal()) {
+      if (!extension->ShouldDisplayInNewTabPage()) {
+        extension_prefs_->extension_sorting()->MarkExtensionAsHidden(
+            extension->id());
+      }
       extension_prefs_->extension_sorting()->EnsureValidOrdinals(
           extension->id(), syncer::StringOrdinal());
     }