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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 137323005: Fixing endless loop when getting the active profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698