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 |