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 <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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 709 |
710 profile_manager->CreateProfileAsync(new_path, | 710 profile_manager->CreateProfileAsync(new_path, |
711 base::Bind(&OnOpenWindowForNewProfile)); | 711 base::Bind(&OnOpenWindowForNewProfile)); |
712 } | 712 } |
713 | 713 |
714 // static | 714 // static |
715 void ProfileManager::RegisterPrefs(PrefService* prefs) { | 715 void ProfileManager::RegisterPrefs(PrefService* prefs) { |
716 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); | 716 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); |
717 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); | 717 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); |
718 prefs->RegisterListPref(prefs::kProfilesLastActive); | 718 prefs->RegisterListPref(prefs::kProfilesLastActive); |
| 719 prefs->RegisterBooleanPref(prefs::kInManagedMode, false); |
719 } | 720 } |
720 | 721 |
721 size_t ProfileManager::GetNumberOfProfiles() { | 722 size_t ProfileManager::GetNumberOfProfiles() { |
722 return GetProfileInfoCache().GetNumberOfProfiles(); | 723 return GetProfileInfoCache().GetNumberOfProfiles(); |
723 } | 724 } |
724 | 725 |
725 bool ProfileManager::CompareProfilePathAndName( | 726 bool ProfileManager::CompareProfilePathAndName( |
726 const ProfileManager::ProfilePathAndName& pair1, | 727 const ProfileManager::ProfilePathAndName& pair1, |
727 const ProfileManager::ProfilePathAndName& pair2) { | 728 const ProfileManager::ProfilePathAndName& pair2) { |
728 int name_compare = pair1.second.compare(pair2.second); | 729 int name_compare = pair1.second.compare(pair2.second); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 ProfileMetrics::STARTUP_PROFILE_EVENT); | 913 ProfileMetrics::STARTUP_PROFILE_EVENT); |
913 } | 914 } |
914 | 915 |
915 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 916 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
916 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 917 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
917 } | 918 } |
918 | 919 |
919 void ProfileManager::RegisterTestingProfile(Profile* profile, | 920 void ProfileManager::RegisterTestingProfile(Profile* profile, |
920 bool add_to_cache) { | 921 bool add_to_cache) { |
921 RegisterProfile(profile, true); | 922 RegisterProfile(profile, true); |
922 if (add_to_cache){ | 923 if (add_to_cache) { |
923 InitProfileUserPrefs(profile); | 924 InitProfileUserPrefs(profile); |
924 AddProfileToCache(profile); | 925 AddProfileToCache(profile); |
925 } | 926 } |
926 } | 927 } |
927 | 928 |
928 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 929 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
929 Profile* profile, | 930 Profile* profile, |
930 Profile::CreateStatus status) { | 931 Profile::CreateStatus status) { |
931 for (size_t i = 0; i < callbacks.size(); ++i) | 932 for (size_t i = 0; i < callbacks.size(); ++i) |
932 callbacks[i].Run(profile, status); | 933 callbacks[i].Run(profile, status); |
933 } | 934 } |
OLD | NEW |