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

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: 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 | « no previous file | 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 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.
310 // TODO: This should be cleaned up with the new profile manager.
311 if (user && user->is_profile_created())
Nikita (slow) 2014/01/14 12:23:15 So if user profile is not created yet, GetActiveUs
312 return manager->GetProfileByUser(manager->GetActiveUser());
Nikita (slow) 2014/01/14 12:23:15 nit: pass |user| as an argument.
Mr4D (OOO till 08-26) 2014/01/14 18:44:37 Done.
313 #endif
310 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( 314 return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath(
311 profile_manager->user_data_dir()); 315 profile_manager->user_data_dir());
312 #endif
313 } 316 }
314 317
315 Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) { 318 Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) {
316 TRACE_EVENT0("browser", "ProfileManager::GetProfile") 319 TRACE_EVENT0("browser", "ProfileManager::GetProfile")
317 // If the profile is already loaded (e.g., chrome.exe launched twice), just 320 // If the profile is already loaded (e.g., chrome.exe launched twice), just
318 // return it. 321 // return it.
319 Profile* profile = GetProfileByPath(profile_dir); 322 Profile* profile = GetProfileByPath(profile_dir);
320 if (NULL != profile) 323 if (NULL != profile)
321 return profile; 324 return profile;
322 325
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 last_non_managed_profile_path.BaseName().MaybeAsASCII()); 1227 last_non_managed_profile_path.BaseName().MaybeAsASCII());
1225 FinishDeletingProfile(profile_to_delete_path); 1228 FinishDeletingProfile(profile_to_delete_path);
1226 } 1229 }
1227 } 1230 }
1228 } 1231 }
1229 #endif 1232 #endif
1230 1233
1231 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1234 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1232 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1235 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1233 } 1236 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698