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

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

Issue 2942043002: cros: Tighten profile loading (Closed)
Patch Set: update SystemClock header Created 3 years, 6 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
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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 // has custom implementation too. 635 // has custom implementation too.
636 base::FilePath profile_dir; 636 base::FilePath profile_dir;
637 // In case of multi-profiles we ignore "last used profile" preference 637 // In case of multi-profiles we ignore "last used profile" preference
638 // since it may refer to profile that has been in use in previous session. 638 // since it may refer to profile that has been in use in previous session.
639 // That profile dir may not be mounted in this session so instead return 639 // That profile dir may not be mounted in this session so instead return
640 // active profile from current session. 640 // active profile from current session.
641 profile_dir = chromeos::ProfileHelper::Get()->GetActiveUserProfileDir(); 641 profile_dir = chromeos::ProfileHelper::Get()->GetActiveUserProfileDir();
642 642
643 base::FilePath profile_path(user_data_dir); 643 base::FilePath profile_path(user_data_dir);
644 Profile* profile = GetProfileByPath(profile_path.Append(profile_dir)); 644 Profile* profile = GetProfileByPath(profile_path.Append(profile_dir));
645 // If we get here, it means the user has logged in but the profile has not 645
646 // finished initializing, so treat the user as not having logged in. 646 // Accessing a user profile before it is loaded may lead to policy exploit.
647 if (!profile) { 647 // See http://crbug.com/689206.
648 LOG(WARNING) << "Calling GetLastUsedProfile() before profile " 648 LOG_IF(FATAL, !profile) << "Calling GetLastUsedProfile() before profile "
649 << "initialization is completed. Returning login profile."; 649 << "initialization is completed.";
650 return GetActiveUserOrOffTheRecordProfileFromPath(user_data_dir); 650
651 }
652 return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : 651 return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() :
653 profile; 652 profile;
654 } 653 }
655 #else 654 #else
656 655
657 return GetProfile(GetLastUsedProfileDir(user_data_dir)); 656 return GetProfile(GetLastUsedProfileDir(user_data_dir));
658 #endif 657 #endif
659 } 658 }
660 659
661 base::FilePath ProfileManager::GetLastUsedProfileDir( 660 base::FilePath ProfileManager::GetLastUsedProfileDir(
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 1771
1773 const base::FilePath new_active_profile_dir = 1772 const base::FilePath new_active_profile_dir =
1774 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); 1773 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath();
1775 FinishDeletingProfile(profile_dir, new_active_profile_dir); 1774 FinishDeletingProfile(profile_dir, new_active_profile_dir);
1776 } 1775 }
1777 #endif // !defined(OS_ANDROID) 1776 #endif // !defined(OS_ANDROID)
1778 1777
1779 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1778 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1780 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1779 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1781 } 1780 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/tray_accessibility_browsertest.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698