Chromium Code Reviews| Index: chrome/browser/profiles/profiles_state.cc |
| diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc |
| index 3aa232ab99925c7cdc5d2d67d77067344e8bbecf..efe1d231e82eb7395faff149c036b41e5c1a84e6 100644 |
| --- a/chrome/browser/profiles/profiles_state.cc |
| +++ b/chrome/browser/profiles/profiles_state.cc |
| @@ -171,29 +171,23 @@ SigninErrorController* GetSigninErrorController(Profile* profile) { |
| return SigninErrorControllerFactory::GetForProfile(profile); |
| } |
| -Profile* SetActiveProfileToGuestIfLocked() { |
| - Profile* active_profile = ProfileManager::GetLastUsedProfile(); |
| - DCHECK(active_profile); |
| +void SetActiveProfileToGuestIfLocked() { |
| + ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| - if (active_profile->IsGuestSession()) |
| - return active_profile; |
| + const base::FilePath& active_profile_path = |
| + profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); |
| + if (active_profile_path == ProfileManager::GetGuestProfilePath()) |
| + return; |
| - ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
| - size_t index = cache.GetIndexOfProfileWithPath(active_profile->GetPath()); |
| + size_t index = cache.GetIndexOfProfileWithPath(active_profile_path); |
| if (!cache.ProfileIsSigninRequiredAtIndex(index)) |
| - return NULL; |
| - |
| - // Profile loads synchronously if it was not previously created. |
| - Profile* guest_profile = profile_manager->GetProfile( |
| - ProfileManager::GetGuestProfilePath()); |
| - DCHECK(guest_profile); |
| + return; |
| PrefService* local_state = g_browser_process->local_state(); |
| DCHECK(local_state); |
| local_state->SetString(prefs::kProfileLastUsed, |
| - guest_profile->GetPath().BaseName().MaybeAsASCII()); |
| - return guest_profile; |
| + active_profile_path.BaseName().MaybeAsASCII()); |
|
noms (inactive)
2015/01/28 19:17:19
Shouldn't this be guest_profile_path or something?
Mike Lerman
2015/01/28 20:19:44
The best no-op ever!!!
Changed :)
|
| } |
| } // namespace profiles |