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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 local_state->GetString(prefs::kProfileLastUsed); | 646 local_state->GetString(prefs::kProfileLastUsed); |
647 | 647 |
648 if (last_used_profile == profile_dir.BaseName().MaybeAsASCII() || | 648 if (last_used_profile == profile_dir.BaseName().MaybeAsASCII() || |
649 last_used_profile == GetGuestProfilePath().BaseName().MaybeAsASCII()) { | 649 last_used_profile == GetGuestProfilePath().BaseName().MaybeAsASCII()) { |
650 // Update the last used profile pref before closing browser windows. This | 650 // Update the last used profile pref before closing browser windows. This |
651 // way the correct last used profile is set for any notification observers. | 651 // way the correct last used profile is set for any notification observers. |
652 base::FilePath last_non_supervised_profile_path; | 652 base::FilePath last_non_supervised_profile_path; |
653 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 653 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
654 base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i); | 654 base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i); |
655 // Make sure that this profile is not pending deletion. | 655 // Make sure that this profile is not pending deletion. |
656 if (cur_path != profile_dir && !cache.ProfileIsSupervisedAtIndex(i) && | 656 if (cur_path != profile_dir && |
| 657 !cache.ProfileIsLegacySupervisedAtIndex(i) && |
657 !IsProfileMarkedForDeletion(cur_path)) { | 658 !IsProfileMarkedForDeletion(cur_path)) { |
658 last_non_supervised_profile_path = cur_path; | 659 last_non_supervised_profile_path = cur_path; |
659 break; | 660 break; |
660 } | 661 } |
661 } | 662 } |
662 | 663 |
663 // If we're deleting the last (non-supervised) profile, then create a new | 664 // If we're deleting the last (non-supervised) profile, then create a new |
664 // profile in its place. | 665 // profile in its place. |
665 const std::string last_non_supervised_profile = | 666 const std::string last_non_supervised_profile = |
666 last_non_supervised_profile_path.BaseName().MaybeAsASCII(); | 667 last_non_supervised_profile_path.BaseName().MaybeAsASCII(); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1348 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
1348 FinishDeletingProfile(profile_to_delete_path); | 1349 FinishDeletingProfile(profile_to_delete_path); |
1349 } | 1350 } |
1350 } | 1351 } |
1351 } | 1352 } |
1352 #endif | 1353 #endif |
1353 | 1354 |
1354 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1355 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1355 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1356 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1356 } | 1357 } |
OLD | NEW |