OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 local_state->SetString( | 664 local_state->SetString( |
665 prefs::kProfileLastUsed, cur_path.BaseName().MaybeAsASCII()); | 665 prefs::kProfileLastUsed, cur_path.BaseName().MaybeAsASCII()); |
666 break; | 666 break; |
667 } | 667 } |
668 } | 668 } |
669 } | 669 } |
670 | 670 |
671 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we | 671 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we |
672 // start deleting the profile instance we need to close background apps too. | 672 // start deleting the profile instance we need to close background apps too. |
673 Profile* profile = GetProfileByPath(profile_dir); | 673 Profile* profile = GetProfileByPath(profile_dir); |
674 if (profile) | 674 if (profile) { |
675 BrowserList::CloseAllBrowsersWithProfile(profile); | 675 BrowserList::CloseAllBrowsersWithProfile(profile); |
676 | 676 |
| 677 // Disable sync for doomed profile. |
| 678 if (profile->HasProfileSyncService()) |
| 679 profile->GetProfileSyncService()->DisableForUser(); |
| 680 } |
| 681 |
677 QueueProfileDirectoryForDeletion(profile_dir); | 682 QueueProfileDirectoryForDeletion(profile_dir); |
678 cache.DeleteProfileFromCache(profile_dir); | 683 cache.DeleteProfileFromCache(profile_dir); |
679 } | 684 } |
680 | 685 |
681 // static | 686 // static |
682 bool ProfileManager::IsMultipleProfilesEnabled() { | 687 bool ProfileManager::IsMultipleProfilesEnabled() { |
683 #if defined(OS_CHROMEOS) | 688 #if defined(OS_CHROMEOS) |
684 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); | 689 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); |
685 #else | 690 #else |
686 return true; | 691 return true; |
(...skipping 22 matching lines...) Expand all Loading... |
709 RegisterProfile(profile, true); | 714 RegisterProfile(profile, true); |
710 if (add_to_cache) | 715 if (add_to_cache) |
711 AddProfileToCache(profile); | 716 AddProfileToCache(profile); |
712 } | 717 } |
713 | 718 |
714 #if defined(OS_WIN) | 719 #if defined(OS_WIN) |
715 void ProfileManager::RemoveProfileShortcutManagerForTesting() { | 720 void ProfileManager::RemoveProfileShortcutManagerForTesting() { |
716 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | 721 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); |
717 } | 722 } |
718 #endif | 723 #endif |
OLD | NEW |