diff options
author | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 05:04:08 +0000 |
---|---|---|
committer | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 05:04:08 +0000 |
commit | c691a593ac199d774a43f239342cd85c80ca1a2a (patch) | |
tree | acb08f525354dcd80f5a0725fa94cd9f09faa3e2 /chrome/browser | |
parent | e52957b44ee877cf8be7f58732d8fff8b89d5403 (diff) | |
download | chromium_src-c691a593ac199d774a43f239342cd85c80ca1a2a.zip chromium_src-c691a593ac199d774a43f239342cd85c80ca1a2a.tar.gz chromium_src-c691a593ac199d774a43f239342cd85c80ca1a2a.tar.bz2 |
Fix Apps on the NTP failing to display.
This fixes the case where an app that we wish to display on the NTP has an
invalid page index value, as well as adding the chrome web store app to the
ordinal index (so that it gets a valid index value).
BUG=107440
TEST=Users should be able to launch chrome and navigate to the apps panel on the NTP
Review URL: http://codereview.chromium.org/8961016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extension_prefs.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/app_launcher_handler.cc | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index a49f934..c70e268 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -1708,7 +1708,17 @@ void ExtensionPrefs::InitializePageOrdinalMap( for (ExtensionIdSet::const_iterator ext_it = extension_ids.begin(); ext_it != extension_ids.end(); ++ext_it) { UpdatePageOrdinalMap(StringOrdinal(), GetPageOrdinal(*ext_it)); + + // Ensure that the web store app still isn't found in this list, since + // it is added after this loop. + DCHECK(*ext_it != extension_misc::kWebStoreAppId); } + + // Include the Web Store App since it is displayed on the NTP. + StringOrdinal web_store_app_page = + GetPageOrdinal(extension_misc::kWebStoreAppId); + if (web_store_app_page.IsValid()) + UpdatePageOrdinalMap(StringOrdinal(), web_store_app_page); } void ExtensionPrefs::UpdatePageOrdinalMap(const StringOrdinal& old_value, diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index a494a9c..893fb0b 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -173,8 +173,8 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension, // We convert the page_ordinal to an integer because the pages are referenced // from within an array in the javascript code, which can't be easily // changed to handle the StringOrdinal values, so we do the conversion here. - value->SetInteger("page_index", - prefs->PageStringOrdinalAsInteger(page_ordinal)); + int page_index = prefs->PageStringOrdinalAsInteger(page_ordinal); + value->SetInteger("page_index", page_index >= 0 ? page_index : 0); StringOrdinal app_launch_ordinal = prefs->GetAppLaunchOrdinal(extension->id()); |