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

Unified Diff: chrome/browser/ui/app_list/app_list_service_impl.cc

Issue 1106453002: Fixed app launcher crashing trying to load guest profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/ui/app_list/app_list_service_impl.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc
index 57397697e8fd66d3db61fcb57c1763253a74ae02..67636fce338dbed53b6cd411de20d0f36d21536a 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -206,6 +206,16 @@ void RecordAppListDiscoverability(PrefService* local_state,
AppListService::ENABLE_NUM_ENABLE_SOURCES);
}
+// Checks whether a profile name is valid for the app list. Returns false if the
+// name is empty, or represents a guest profile.
+bool IsValidProfileName(const std::string& profile_name) {
+ if (profile_name.empty())
+ return false;
+
+ return profile_name !=
+ base::FilePath(chrome::kGuestProfileDir).AsUTF8Unsafe();
+}
+
} // namespace
void AppListServiceImpl::RecordAppListLaunch() {
@@ -291,13 +301,13 @@ base::FilePath AppListServiceImpl::GetProfilePath(
// If the user has no profile preference for the app launcher, default to the
// last browser profile used.
- if (app_list_profile.empty() &&
+ if (!IsValidProfileName(app_list_profile) &&
local_state_->HasPrefPath(prefs::kProfileLastUsed)) {
app_list_profile = local_state_->GetString(prefs::kProfileLastUsed);
}
// If there is no last used profile recorded, use the initial profile.
- if (app_list_profile.empty())
+ if (!IsValidProfileName(app_list_profile))
app_list_profile = chrome::kInitialProfile;
return user_data_dir.AppendASCII(app_list_profile);

Powered by Google App Engine
This is Rietveld 408576698