Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
index 53c68cf8f26dfb7e8275ee04e5dd6694acd457dc..157c020ff70c32ac07967d48387ddc49edab2d9a 100644 |
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
@@ -162,10 +162,14 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension, |
value->SetInteger("app_launch_index", app_launch_index); |
int page_index = prefs->GetPageIndex(extension->id()); |
- if (page_index >= 0) { |
- // Only provide a value if one is stored |
- value->SetInteger("page_index", page_index); |
- } |
+ if (page_index < 0) { |
+ // Make sure every app has a page index (some predate the page index). |
+ // The webstore app should be on the first page. |
+ page_index = extension->id() == extension_misc::kWebStoreAppId ? |
+ 0 : prefs->GetNaturalAppPageIndex(); |
+ prefs->SetPageIndex(extension->id(), page_index); |
+ } |
+ value->SetInteger("page_index", page_index); |
} |
// TODO(estade): remove this. We record app launches via js calls rather than |