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

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

Issue 1773113002: Fixed a few places that incorrectly assumed that profile was initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 4 years, 9 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
« no previous file with comments | « chrome/browser/extensions/extension_garbage_collector_chromeos.cc ('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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // CrOS multi-profiles implementation is different so GetLastUsedProfile 507 // CrOS multi-profiles implementation is different so GetLastUsedProfile
508 // has custom implementation too. 508 // has custom implementation too.
509 base::FilePath profile_dir; 509 base::FilePath profile_dir;
510 // In case of multi-profiles we ignore "last used profile" preference 510 // In case of multi-profiles we ignore "last used profile" preference
511 // since it may refer to profile that has been in use in previous session. 511 // since it may refer to profile that has been in use in previous session.
512 // That profile dir may not be mounted in this session so instead return 512 // That profile dir may not be mounted in this session so instead return
513 // active profile from current session. 513 // active profile from current session.
514 profile_dir = chromeos::ProfileHelper::Get()->GetActiveUserProfileDir(); 514 profile_dir = chromeos::ProfileHelper::Get()->GetActiveUserProfileDir();
515 515
516 base::FilePath profile_path(user_data_dir); 516 base::FilePath profile_path(user_data_dir);
517 Profile* profile = GetProfile(profile_path.Append(profile_dir)); 517 Profile* profile = GetProfileByPath(profile_path.Append(profile_dir));
518 // If we get here, it means the user has logged in but the profile has not
519 // finished initializing, so treat the user as not having logged in.
520 if (!profile) {
521 DLOG(WARNING) << "Calling GetLastUsedProfile() before profile "
522 << "initialization is completed. Returning login profile.";
523 return GetActiveUserOrOffTheRecordProfileFromPath(user_data_dir);
524 }
518 return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : 525 return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() :
519 profile; 526 profile;
520 } 527 }
521 #endif 528 #else
522 529
523 return GetProfile(GetLastUsedProfileDir(user_data_dir)); 530 return GetProfile(GetLastUsedProfileDir(user_data_dir));
531 #endif
524 } 532 }
525 533
526 base::FilePath ProfileManager::GetLastUsedProfileDir( 534 base::FilePath ProfileManager::GetLastUsedProfileDir(
527 const base::FilePath& user_data_dir) { 535 const base::FilePath& user_data_dir) {
528 return user_data_dir.AppendASCII(GetLastUsedProfileName()); 536 return user_data_dir.AppendASCII(GetLastUsedProfileName());
529 } 537 }
530 538
531 std::string ProfileManager::GetLastUsedProfileName() { 539 std::string ProfileManager::GetLastUsedProfileName() {
532 PrefService* local_state = g_browser_process->local_state(); 540 PrefService* local_state = g_browser_process->local_state();
533 DCHECK(local_state); 541 DCHECK(local_state);
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 1563
1556 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1564 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1557 if (!original_callback.is_null()) 1565 if (!original_callback.is_null())
1558 original_callback.Run(loaded_profile, status); 1566 original_callback.Run(loaded_profile, status);
1559 } 1567 }
1560 #endif // !defined(OS_ANDROID) 1568 #endif // !defined(OS_ANDROID)
1561 1569
1562 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1570 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1563 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1571 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1564 } 1572 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_garbage_collector_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698