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

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

Issue 1113333003: Don't create a new profile when cleaning up stale ephemeral profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fix Created 5 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/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..9913d15bc09b48f09ecbce11a7ef5559928d7239 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -131,6 +131,10 @@ class ProfileStoreImpl : public ProfileStore {
return profile_manager_->user_data_dir();
}
+ std::string GetLastUsedProfileName() override {
+ return profile_manager_->GetLastUsedProfileName();
+ }
+
bool IsProfileSupervised(const base::FilePath& profile_path) override {
ProfileInfoCache& profile_info =
g_browser_process->profile_manager()->GetProfileInfoCache();
@@ -285,22 +289,7 @@ void AppListServiceImpl::Init(Profile* initial_profile) {}
base::FilePath AppListServiceImpl::GetProfilePath(
const base::FilePath& user_data_dir) {
- std::string app_list_profile;
- if (local_state_->HasPrefPath(prefs::kAppListProfile))
- app_list_profile = local_state_->GetString(prefs::kAppListProfile);
-
- // If the user has no profile preference for the app launcher, default to the
- // last browser profile used.
- if (app_list_profile.empty() &&
- 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())
- app_list_profile = chrome::kInitialProfile;
-
- return user_data_dir.AppendASCII(app_list_profile);
+ return user_data_dir.AppendASCII(GetProfileName());
}
void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) {
@@ -311,6 +300,17 @@ void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) {
void AppListServiceImpl::CreateShortcut() {}
+std::string AppListServiceImpl::GetProfileName() {
+ const std::string app_list_profile =
+ local_state_->GetString(prefs::kAppListProfile);
+ if (!app_list_profile.empty())
+ return app_list_profile;
+
+ // If the user has no profile preference for the app launcher, default to the
+ // last browser profile used.
+ return profile_store_->GetLastUsedProfileName();
+}
+
void AppListServiceImpl::OnProfileWillBeRemoved(
const base::FilePath& profile_path) {
// We need to watch for profile removal to keep kAppListProfile updated, for
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_impl.h ('k') | chrome/browser/ui/app_list/app_list_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698