Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: chrome/browser/banners/app_banner_manager.cc

Issue 2900623002: Properly fall back to manifest short_name when name is empty. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/banners/app_banner_manager.cc
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc
index 318955b2386969b0737fca7c6d9ccac7db3147f0..79a453dc26ca3f6b4259ff9fa23ca8fafa67255a 100644
--- a/chrome/browser/banners/app_banner_manager.cc
+++ b/chrome/browser/banners/app_banner_manager.cc
@@ -219,8 +219,13 @@ void AppBannerManager::OnDidGetManifest(const InstallableData& data) {
manifest_url_ = data.manifest_url;
manifest_ = data.manifest;
- app_title_ = (manifest_.name.is_null()) ? manifest_.short_name.string()
- : manifest_.name.string();
+
+ // One of manifest_.name or manifest_.short_name must be non-null and
+ // non-empty if the error code was NO_ERROR_DETECTED.
+ if (manifest_.name.is_null() || manifest_.name.string().empty())
+ app_title_ = manifest_.short_name.string();
+ else
+ app_title_ = manifest_.name.string();
PerformInstallableCheck();
}

Powered by Google App Engine
This is Rietveld 408576698