OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profile_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // static | 297 // static |
298 Profile* ProfileManager::GetActiveUserProfile() { | 298 Profile* ProfileManager::GetActiveUserProfile() { |
299 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 299 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
300 #if defined(OS_CHROMEOS) | 300 #if defined(OS_CHROMEOS) |
301 if (!chromeos::UserManager::IsMultipleProfilesAllowed() || | 301 if (!chromeos::UserManager::IsMultipleProfilesAllowed() || |
302 !profile_manager->IsLoggedIn() || | 302 !profile_manager->IsLoggedIn() || |
303 !chromeos::UserManager::IsInitialized()) | 303 !chromeos::UserManager::IsInitialized()) |
304 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( | 304 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( |
305 profile_manager->user_data_dir()); | 305 profile_manager->user_data_dir()); |
306 chromeos::UserManager* manager = chromeos::UserManager::Get(); | 306 chromeos::UserManager* manager = chromeos::UserManager::Get(); |
307 // Note: The user manager will take care of guest profiles. | 307 const chromeos::User* user = manager->GetActiveUser(); |
308 return manager->GetProfileByUser(manager->GetActiveUser()); | 308 // To avoid an endless loop (crbug.com/334098) we have to additionally check |
309 #else | 309 // if the profile of the user was already created. If the profile was not yet |
| 310 // created we load the profile using the profile directly. |
| 311 // TODO: This should be cleaned up with the new profile manager. |
| 312 if (user && user->is_profile_created()) |
| 313 return manager->GetProfileByUser(user); |
| 314 #endif |
310 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( | 315 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( |
311 profile_manager->user_data_dir()); | 316 profile_manager->user_data_dir()); |
312 #endif | |
313 } | 317 } |
314 | 318 |
315 Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) { | 319 Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) { |
316 TRACE_EVENT0("browser", "ProfileManager::GetProfile") | 320 TRACE_EVENT0("browser", "ProfileManager::GetProfile") |
317 // If the profile is already loaded (e.g., chrome.exe launched twice), just | 321 // If the profile is already loaded (e.g., chrome.exe launched twice), just |
318 // return it. | 322 // return it. |
319 Profile* profile = GetProfileByPath(profile_dir); | 323 Profile* profile = GetProfileByPath(profile_dir); |
320 if (NULL != profile) | 324 if (NULL != profile) |
321 return profile; | 325 return profile; |
322 | 326 |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 last_non_managed_profile_path.BaseName().MaybeAsASCII()); | 1228 last_non_managed_profile_path.BaseName().MaybeAsASCII()); |
1225 FinishDeletingProfile(profile_to_delete_path); | 1229 FinishDeletingProfile(profile_to_delete_path); |
1226 } | 1230 } |
1227 } | 1231 } |
1228 } | 1232 } |
1229 #endif | 1233 #endif |
1230 | 1234 |
1231 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1235 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1232 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1236 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1233 } | 1237 } |
OLD | NEW |