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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Profile* profile = GetProfileByPath(profile_dir); | 643 Profile* profile = GetProfileByPath(profile_dir); |
644 if (profile) { | 644 if (profile) { |
645 DownloadService* service = | 645 DownloadService* service = |
646 DownloadServiceFactory::GetForBrowserContext(profile); | 646 DownloadServiceFactory::GetForBrowserContext(profile); |
647 service->CancelDownloads(); | 647 service->CancelDownloads(); |
648 } | 648 } |
649 | 649 |
650 PrefService* local_state = g_browser_process->local_state(); | 650 PrefService* local_state = g_browser_process->local_state(); |
651 ProfileInfoCache& cache = GetProfileInfoCache(); | 651 ProfileInfoCache& cache = GetProfileInfoCache(); |
652 | 652 |
653 if (profile_dir.BaseName().MaybeAsASCII() == | 653 const std::string last_used_profile = |
654 local_state->GetString(prefs::kProfileLastUsed)) { | 654 local_state->GetString(prefs::kProfileLastUsed); |
| 655 |
| 656 if (last_used_profile == profile_dir.BaseName().MaybeAsASCII() || |
| 657 last_used_profile == GetGuestProfilePath().BaseName().MaybeAsASCII()) { |
655 // Update the last used profile pref before closing browser windows. This | 658 // Update the last used profile pref before closing browser windows. This |
656 // way the correct last used profile is set for any notification observers. | 659 // way the correct last used profile is set for any notification observers. |
657 base::FilePath last_non_supervised_profile_path; | 660 base::FilePath last_non_supervised_profile_path; |
658 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 661 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
659 base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i); | 662 base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i); |
660 // Make sure that this profile is not pending deletion. | 663 // Make sure that this profile is not pending deletion. |
661 if (cur_path != profile_dir && !cache.ProfileIsSupervisedAtIndex(i) && | 664 if (cur_path != profile_dir && !cache.ProfileIsSupervisedAtIndex(i) && |
662 !IsProfileMarkedForDeletion(cur_path)) { | 665 !IsProfileMarkedForDeletion(cur_path)) { |
663 last_non_supervised_profile_path = cur_path; | 666 last_non_supervised_profile_path = cur_path; |
664 break; | 667 break; |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1310 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
1308 FinishDeletingProfile(profile_to_delete_path); | 1311 FinishDeletingProfile(profile_to_delete_path); |
1309 } | 1312 } |
1310 } | 1313 } |
1311 } | 1314 } |
1312 #endif | 1315 #endif |
1313 | 1316 |
1314 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1317 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1315 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1318 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1316 } | 1319 } |
OLD | NEW |