OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profiles_state.h" | 5 #include "chrome/browser/profiles/profiles_state.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 if (active_profile->IsGuestSession()) | 178 if (active_profile->IsGuestSession()) |
179 return active_profile; | 179 return active_profile; |
180 | 180 |
181 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 181 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
182 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 182 const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
183 size_t index = cache.GetIndexOfProfileWithPath(active_profile->GetPath()); | 183 size_t index = cache.GetIndexOfProfileWithPath(active_profile->GetPath()); |
184 if (!cache.ProfileIsSigninRequiredAtIndex(index)) | 184 if (!cache.ProfileIsSigninRequiredAtIndex(index)) |
185 return NULL; | 185 return NULL; |
186 | 186 |
187 // The guest profile must have been loaded already. | 187 // Profile loads synchronously if it was not previously created. |
188 Profile* guest_profile = profile_manager->GetProfile( | 188 Profile* guest_profile = profile_manager->GetProfile( |
189 ProfileManager::GetGuestProfilePath()); | 189 ProfileManager::GetGuestProfilePath()); |
190 DCHECK(guest_profile); | 190 DCHECK(guest_profile); |
191 | 191 |
192 PrefService* local_state = g_browser_process->local_state(); | 192 PrefService* local_state = g_browser_process->local_state(); |
193 DCHECK(local_state); | 193 DCHECK(local_state); |
194 local_state->SetString(prefs::kProfileLastUsed, | 194 local_state->SetString(prefs::kProfileLastUsed, |
195 guest_profile->GetPath().BaseName().MaybeAsASCII()); | 195 guest_profile->GetPath().BaseName().MaybeAsASCII()); |
196 return guest_profile; | 196 return guest_profile; |
197 } | 197 } |
198 | 198 |
199 } // namespace profiles | 199 } // namespace profiles |
OLD | NEW |