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

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

Issue 1913373002: Revert "Refactor ProfileInfoCache in most of c/b/profiles" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
31 #include "chrome/browser/download/download_service.h" 31 #include "chrome/browser/download/download_service.h"
32 #include "chrome/browser/download/download_service_factory.h" 32 #include "chrome/browser/download/download_service_factory.h"
33 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" 33 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
36 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h" 36 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv ice_factory.h"
37 #include "chrome/browser/password_manager/password_store_factory.h" 37 #include "chrome/browser/password_manager/password_store_factory.h"
38 #include "chrome/browser/prefs/incognito_mode_prefs.h" 38 #include "chrome/browser/prefs/incognito_mode_prefs.h"
39 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" 39 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
40 #include "chrome/browser/profiles/profile_attributes_entry.h"
41 #include "chrome/browser/profiles/profile_attributes_storage.h" 40 #include "chrome/browser/profiles/profile_attributes_storage.h"
42 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 41 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
43 #include "chrome/browser/profiles/profile_destroyer.h" 42 #include "chrome/browser/profiles/profile_destroyer.h"
44 #include "chrome/browser/profiles/profile_info_cache.h" 43 #include "chrome/browser/profiles/profile_info_cache.h"
45 #include "chrome/browser/profiles/profile_metrics.h" 44 #include "chrome/browser/profiles/profile_metrics.h"
46 #include "chrome/browser/profiles/profiles_state.h" 45 #include "chrome/browser/profiles/profiles_state.h"
47 #include "chrome/browser/sessions/session_service_factory.h" 46 #include "chrome/browser/sessions/session_service_factory.h"
48 #include "chrome/browser/signin/account_fetcher_service_factory.h" 47 #include "chrome/browser/signin/account_fetcher_service_factory.h"
49 #include "chrome/browser/signin/account_reconcilor_factory.h" 48 #include "chrome/browser/signin/account_reconcilor_factory.h"
50 #include "chrome/browser/signin/account_tracker_service_factory.h" 49 #include "chrome/browser/signin/account_tracker_service_factory.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 423
425 // If the profile is already loaded (e.g., chrome.exe launched twice), just 424 // If the profile is already loaded (e.g., chrome.exe launched twice), just
426 // return it. 425 // return it.
427 Profile* profile = GetProfileByPath(profile_dir); 426 Profile* profile = GetProfileByPath(profile_dir);
428 if (profile) 427 if (profile)
429 return profile; 428 return profile;
430 return CreateAndInitializeProfile(profile_dir); 429 return CreateAndInitializeProfile(profile_dir);
431 } 430 }
432 431
433 size_t ProfileManager::GetNumberOfProfiles() { 432 size_t ProfileManager::GetNumberOfProfiles() {
434 return GetProfileAttributesStorage().GetNumberOfProfiles(); 433 return GetProfileInfoCache().GetNumberOfProfiles();
435 } 434 }
436 435
437 bool ProfileManager::LoadProfile(const std::string& profile_name, 436 bool ProfileManager::LoadProfile(const std::string& profile_name,
438 bool incognito, 437 bool incognito,
439 const ProfileLoadedCallback& callback) { 438 const ProfileLoadedCallback& callback) {
440 const base::FilePath profile_path = user_data_dir().AppendASCII(profile_name); 439 const base::FilePath profile_path = user_data_dir().AppendASCII(profile_name);
441 440
442 ProfileAttributesEntry* entry = nullptr; 441 ProfileAttributesEntry* entry = nullptr;
443 if (!GetProfileAttributesStorage().GetProfileAttributesWithPath(profile_path, 442 if (!GetProfileAttributesStorage().GetProfileAttributesWithPath(profile_path,
444 &entry)) { 443 &entry)) {
(...skipping 29 matching lines...) Expand all
474 473
475 // Create the profile if needed and collect its ProfileInfo. 474 // Create the profile if needed and collect its ProfileInfo.
476 ProfilesInfoMap::iterator iter = profiles_info_.find(profile_path); 475 ProfilesInfoMap::iterator iter = profiles_info_.find(profile_path);
477 ProfileInfo* info = NULL; 476 ProfileInfo* info = NULL;
478 477
479 if (iter != profiles_info_.end()) { 478 if (iter != profiles_info_.end()) {
480 info = iter->second.get(); 479 info = iter->second.get();
481 } else { 480 } else {
482 // Initiate asynchronous creation process. 481 // Initiate asynchronous creation process.
483 info = RegisterProfile(CreateProfileAsyncHelper(profile_path, this), false); 482 info = RegisterProfile(CreateProfileAsyncHelper(profile_path, this), false);
483 ProfileInfoCache& cache = GetProfileInfoCache();
484 // Get the icon index from the user's icon url
484 size_t icon_index; 485 size_t icon_index;
485 DCHECK(base::IsStringASCII(icon_url)); 486 DCHECK(base::IsStringASCII(icon_url));
486 if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) { 487 if (profiles::IsDefaultAvatarIconUrl(icon_url, &icon_index)) {
487 // add profile to cache with user selected name and avatar 488 // add profile to cache with user selected name and avatar
488 GetProfileAttributesStorage().AddProfile(profile_path, name, 489 cache.AddProfileToCache(profile_path, name, std::string(),
489 std::string(), base::string16(), icon_index, supervised_user_id); 490 base::string16(), icon_index, supervised_user_id);
490 } 491 }
491 492
492 if (!supervised_user_id.empty()) { 493 if (!supervised_user_id.empty()) {
493 content::RecordAction( 494 content::RecordAction(
494 UserMetricsAction("ManagedMode_LocallyManagedUserCreated")); 495 UserMetricsAction("ManagedMode_LocallyManagedUserCreated"));
495 } 496 }
496 497
497 ProfileMetrics::UpdateReportedProfilesStatistics(this); 498 ProfileMetrics::UpdateReportedProfilesStatistics(this);
498 } 499 }
499 500
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 // Cancel all in-progress downloads before deleting the profile to prevent a 735 // Cancel all in-progress downloads before deleting the profile to prevent a
735 // "Do you want to exit Google Chrome and cancel the downloads?" prompt 736 // "Do you want to exit Google Chrome and cancel the downloads?" prompt
736 // (crbug.com/336725). 737 // (crbug.com/336725).
737 Profile* profile = GetProfileByPath(profile_dir); 738 Profile* profile = GetProfileByPath(profile_dir);
738 if (profile) { 739 if (profile) {
739 DownloadService* service = 740 DownloadService* service =
740 DownloadServiceFactory::GetForBrowserContext(profile); 741 DownloadServiceFactory::GetForBrowserContext(profile);
741 service->CancelDownloads(); 742 service->CancelDownloads();
742 } 743 }
743 744
744 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); 745 ProfileInfoCache& cache = GetProfileInfoCache();
746
745 // If we're deleting the last (non-legacy-supervised) profile, then create a 747 // If we're deleting the last (non-legacy-supervised) profile, then create a
746 // new profile in its place. 748 // new profile in its place.
747 base::FilePath last_non_supervised_profile_path; 749 base::FilePath last_non_supervised_profile_path;
748 std::vector<ProfileAttributesEntry*> entries = 750 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
749 storage.GetAllProfilesAttributes(); 751 base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i);
750 for (ProfileAttributesEntry* entry : entries) {
751 base::FilePath cur_path = entry->GetPath();
752 // Make sure that this profile is not pending deletion, and is not 752 // Make sure that this profile is not pending deletion, and is not
753 // legacy-supervised. 753 // legacy-supervised.
754 if (cur_path != profile_dir && 754 if (cur_path != profile_dir &&
755 !entry->IsLegacySupervised() && 755 !cache.ProfileIsLegacySupervisedAtIndex(i) &&
756 !IsProfileMarkedForDeletion(cur_path)) { 756 !IsProfileMarkedForDeletion(cur_path)) {
757 last_non_supervised_profile_path = cur_path; 757 last_non_supervised_profile_path = cur_path;
758 break; 758 break;
759 } 759 }
760 } 760 }
761 761
762 if (last_non_supervised_profile_path.empty()) { 762 if (last_non_supervised_profile_path.empty()) {
763 std::string new_avatar_url; 763 std::string new_avatar_url;
764 base::string16 new_profile_name; 764 base::string16 new_profile_name;
765 765
766 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 766 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
767 int avatar_index = profiles::GetPlaceholderAvatarIndex(); 767 int avatar_index = profiles::GetPlaceholderAvatarIndex();
768 new_avatar_url = profiles::GetDefaultAvatarIconUrl(avatar_index); 768 new_avatar_url = profiles::GetDefaultAvatarIconUrl(avatar_index);
769 new_profile_name = storage.ChooseNameForNewProfile(avatar_index); 769 new_profile_name = cache.ChooseNameForNewProfile(avatar_index);
770 #endif 770 #endif
771 771
772 base::FilePath new_path(GenerateNextProfileDirectoryPath()); 772 base::FilePath new_path(GenerateNextProfileDirectoryPath());
773 CreateProfileAsync(new_path, 773 CreateProfileAsync(new_path,
774 base::Bind(&ProfileManager::OnNewActiveProfileLoaded, 774 base::Bind(&ProfileManager::OnNewActiveProfileLoaded,
775 base::Unretained(this), 775 base::Unretained(this),
776 profile_dir, 776 profile_dir,
777 new_path, 777 new_path,
778 callback), 778 callback),
779 new_profile_name, 779 new_profile_name,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 void ProfileManager::AutoloadProfiles() { 813 void ProfileManager::AutoloadProfiles() {
814 // If running in the background is disabled for the browser, do not autoload 814 // If running in the background is disabled for the browser, do not autoload
815 // any profiles. 815 // any profiles.
816 PrefService* local_state = g_browser_process->local_state(); 816 PrefService* local_state = g_browser_process->local_state();
817 DCHECK(local_state); 817 DCHECK(local_state);
818 if (!local_state->HasPrefPath(prefs::kBackgroundModeEnabled) || 818 if (!local_state->HasPrefPath(prefs::kBackgroundModeEnabled) ||
819 !local_state->GetBoolean(prefs::kBackgroundModeEnabled)) { 819 !local_state->GetBoolean(prefs::kBackgroundModeEnabled)) {
820 return; 820 return;
821 } 821 }
822 822
823 std::vector<ProfileAttributesEntry*> entries = 823 ProfileInfoCache& cache = GetProfileInfoCache();
824 GetProfileAttributesStorage().GetAllProfilesAttributes(); 824 size_t number_of_profiles = cache.GetNumberOfProfiles();
825 for (ProfileAttributesEntry* entry : entries) { 825 for (size_t p = 0; p < number_of_profiles; ++p) {
826 if (entry->GetBackgroundStatus()) { 826 if (cache.GetBackgroundStatusOfProfileAtIndex(p)) {
827 // If status is true, that profile is running background apps. By calling 827 // If status is true, that profile is running background apps. By calling
828 // GetProfile, we automatically cause the profile to be loaded which will 828 // GetProfile, we automatically cause the profile to be loaded which will
829 // register it with the BackgroundModeManager. 829 // register it with the BackgroundModeManager.
830 GetProfile(entry->GetPath()); 830 GetProfile(cache.GetPathOfProfileAtIndex(p));
831 } 831 }
832 } 832 }
833 } 833 }
834 834
835 void ProfileManager::CleanUpEphemeralProfiles() { 835 void ProfileManager::CleanUpEphemeralProfiles() {
836 const std::string last_used_profile = GetLastUsedProfileName(); 836 const std::string last_used_profile = GetLastUsedProfileName();
837 837
838 bool last_active_profile_deleted = false; 838 bool last_active_profile_deleted = false;
839 base::FilePath new_profile_path; 839 base::FilePath new_profile_path;
840 std::vector<base::FilePath> profiles_to_delete; 840 std::vector<base::FilePath> profiles_to_delete;
841 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); 841 ProfileInfoCache& profile_cache = GetProfileInfoCache();
842 std::vector<ProfileAttributesEntry*> entries = 842 size_t profiles_count = profile_cache.GetNumberOfProfiles();
843 storage.GetAllProfilesAttributes(); 843 for (size_t i = 0; i < profiles_count; ++i) {
844 for (ProfileAttributesEntry* entry : entries) { 844 base::FilePath profile_path = profile_cache.GetPathOfProfileAtIndex(i);
845 base::FilePath profile_path = entry->GetPath(); 845 if (profile_cache.ProfileIsEphemeralAtIndex(i)) {
846 if (entry->IsEphemeral()) {
847 profiles_to_delete.push_back(profile_path); 846 profiles_to_delete.push_back(profile_path);
848 if (profile_path.BaseName().MaybeAsASCII() == last_used_profile) 847 if (profile_path.BaseName().MaybeAsASCII() == last_used_profile)
849 last_active_profile_deleted = true; 848 last_active_profile_deleted = true;
850 } else if (new_profile_path.empty()) { 849 } else if (new_profile_path.empty()) {
851 new_profile_path = profile_path; 850 new_profile_path = profile_path;
852 } 851 }
853 } 852 }
854 853
855 // If the last active profile was ephemeral, set a new one. 854 // If the last active profile was ephemeral, set a new one.
856 if (last_active_profile_deleted) { 855 if (last_active_profile_deleted) {
857 if (new_profile_path.empty()) 856 if (new_profile_path.empty())
858 new_profile_path = GenerateNextProfileDirectoryPath(); 857 new_profile_path = GenerateNextProfileDirectoryPath();
859 858
860 profiles::SetLastUsedProfile(new_profile_path.BaseName().MaybeAsASCII()); 859 profiles::SetLastUsedProfile(new_profile_path.BaseName().MaybeAsASCII());
861 } 860 }
862 861
863 // This uses a separate loop, because deleting the profile from the 862 // This uses a separate loop, because deleting the profile from the
864 // ProfileInfoCache will modify indices. 863 // ProfileInfoCache will modify indices.
865 for (const base::FilePath& profile_path : profiles_to_delete) { 864 for (const base::FilePath& profile_path : profiles_to_delete) {
866 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 865 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
867 base::Bind(&NukeProfileFromDisk, profile_path)); 866 base::Bind(&NukeProfileFromDisk, profile_path));
868 867
869 storage.RemoveProfile(profile_path); 868 profile_cache.DeleteProfileFromCache(profile_path);
870 } 869 }
871 } 870 }
872 871
873 void ProfileManager::InitProfileUserPrefs(Profile* profile) { 872 void ProfileManager::InitProfileUserPrefs(Profile* profile) {
874 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs"); 873 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs");
875 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); 874 ProfileInfoCache& cache = GetProfileInfoCache();
876 875
877 if (profile->GetPath().DirName() != user_data_dir()) { 876 if (profile->GetPath().DirName() != cache.GetUserDataDir())
878 UMA_HISTOGRAM_BOOLEAN("Profile.InitProfileUserPrefs.OutsideUserDir", true);
879 return; 877 return;
880 }
881 878
882 size_t avatar_index; 879 size_t avatar_index;
883 std::string profile_name; 880 std::string profile_name;
884 std::string supervised_user_id; 881 std::string supervised_user_id;
885 if (profile->IsGuestSession()) { 882 if (profile->IsGuestSession()) {
886 profile_name = l10n_util::GetStringUTF8(IDS_PROFILES_GUEST_PROFILE_NAME); 883 profile_name = l10n_util::GetStringUTF8(IDS_PROFILES_GUEST_PROFILE_NAME);
887 avatar_index = 0; 884 avatar_index = 0;
888 } else { 885 } else {
889 ProfileAttributesEntry* entry; 886 size_t profile_cache_index =
890 bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(), 887 cache.GetIndexOfProfileWithPath(profile->GetPath());
891 &entry); 888 // If the cache has an entry for this profile, use the cache data.
892 // If the profile attributes storage has an entry for this profile, use the 889 if (profile_cache_index != std::string::npos) {
893 // data in the profile attributes storage. 890 avatar_index =
894 if (has_entry) { 891 cache.GetAvatarIconIndexOfProfileAtIndex(profile_cache_index);
895 avatar_index = entry->GetAvatarIconIndex(); 892 profile_name =
896 profile_name = base::UTF16ToUTF8(entry->GetName()); 893 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_cache_index));
897 supervised_user_id = entry->GetSupervisedUserId(); 894 supervised_user_id =
895 cache.GetSupervisedUserIdOfProfileAtIndex(profile_cache_index);
898 } else if (profile->GetPath() == 896 } else if (profile->GetPath() ==
899 profiles::GetDefaultProfileDir(user_data_dir())) { 897 profiles::GetDefaultProfileDir(cache.GetUserDataDir())) {
900 avatar_index = profiles::GetPlaceholderAvatarIndex(); 898 avatar_index = profiles::GetPlaceholderAvatarIndex();
901 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 899 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
902 profile_name = 900 profile_name =
903 base::UTF16ToUTF8(storage.ChooseNameForNewProfile(avatar_index)); 901 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index));
904 #else 902 #else
905 profile_name = l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME); 903 profile_name = l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME);
906 #endif 904 #endif
907 } else { 905 } else {
908 avatar_index = storage.ChooseAvatarIconIndexForNewProfile(); 906 avatar_index = cache.ChooseAvatarIconIndexForNewProfile();
909 profile_name = 907 profile_name =
910 base::UTF16ToUTF8(storage.ChooseNameForNewProfile(avatar_index)); 908 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index));
911 } 909 }
912 } 910 }
913 911
914 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex)) 912 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex))
915 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index); 913 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index);
916 914
917 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileName)) 915 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileName))
918 profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); 916 profile->GetPrefs()->SetString(prefs::kProfileName, profile_name);
919 917
920 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 918 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
921 bool force_supervised_user_id = 919 bool force_supervised_user_id =
922 #if defined(OS_CHROMEOS) 920 #if defined(OS_CHROMEOS)
923 g_browser_process->platform_part() 921 g_browser_process->platform_part()
924 ->profile_helper() 922 ->profile_helper()
925 ->GetSigninProfileDir() != profile->GetPath() && 923 ->GetSigninProfileDir() != profile->GetPath() &&
926 #endif 924 #endif
927 command_line->HasSwitch(switches::kSupervisedUserId); 925 command_line->HasSwitch(switches::kSupervisedUserId);
928 if (force_supervised_user_id) { 926 if (force_supervised_user_id) {
929 supervised_user_id = 927 supervised_user_id =
930 command_line->GetSwitchValueASCII(switches::kSupervisedUserId); 928 command_line->GetSwitchValueASCII(switches::kSupervisedUserId);
931 } 929 }
932 if (force_supervised_user_id || 930 if (force_supervised_user_id ||
933 !profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) { 931 !profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) {
934 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, 932 profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
935 supervised_user_id); 933 supervised_user_id);
936 } 934 }
937 } 935 }
938 936
939 void ProfileManager::RegisterTestingProfile(Profile* profile, 937 void ProfileManager::RegisterTestingProfile(Profile* profile,
940 bool add_to_storage, 938 bool add_to_cache,
941 bool start_deferred_task_runners) { 939 bool start_deferred_task_runners) {
942 RegisterProfile(profile, true); 940 RegisterProfile(profile, true);
943 if (add_to_storage) { 941 if (add_to_cache) {
944 InitProfileUserPrefs(profile); 942 InitProfileUserPrefs(profile);
945 AddProfileToStorage(profile); 943 AddProfileToCache(profile);
946 } 944 }
947 if (start_deferred_task_runners) { 945 if (start_deferred_task_runners) {
948 StartupTaskRunnerServiceFactory::GetForProfile(profile)-> 946 StartupTaskRunnerServiceFactory::GetForProfile(profile)->
949 StartDeferredTaskRunners(); 947 StartDeferredTaskRunners();
950 } 948 }
951 } 949 }
952 950
953 void ProfileManager::Observe( 951 void ProfileManager::Observe(
954 int type, 952 int type,
955 const content::NotificationSource& source, 953 const content::NotificationSource& source,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 RunCallbacks(callbacks, profile, 1105 RunCallbacks(callbacks, profile,
1108 profile ? Profile::CREATE_STATUS_INITIALIZED : 1106 profile ? Profile::CREATE_STATUS_INITIALIZED :
1109 Profile::CREATE_STATUS_LOCAL_FAIL); 1107 Profile::CREATE_STATUS_LOCAL_FAIL);
1110 } 1108 }
1111 1109
1112 void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { 1110 void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
1113 TRACE_EVENT0("browser", "ProfileManager::DoFinalInit"); 1111 TRACE_EVENT0("browser", "ProfileManager::DoFinalInit");
1114 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInit"); 1112 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInit");
1115 1113
1116 DoFinalInitForServices(profile, go_off_the_record); 1114 DoFinalInitForServices(profile, go_off_the_record);
1117 AddProfileToStorage(profile); 1115 AddProfileToCache(profile);
1118 DoFinalInitLogging(profile); 1116 DoFinalInitLogging(profile);
1119 1117
1120 ProfileMetrics::LogNumberOfProfiles(this); 1118 ProfileMetrics::LogNumberOfProfiles(this);
1121 content::NotificationService::current()->Notify( 1119 content::NotificationService::current()->Notify(
1122 chrome::NOTIFICATION_PROFILE_ADDED, 1120 chrome::NOTIFICATION_PROFILE_ADDED,
1123 content::Source<Profile>(profile), 1121 content::Source<Profile>(profile),
1124 content::NotificationService::NoDetails()); 1122 content::NotificationService::NoDetails());
1125 1123
1126 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) 1124 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
1127 // Record statistics to ProfileInfoCache if statistics were not recorded 1125 // Record statistics to ProfileInfoCache if statistics were not recorded
1128 // during shutdown, i.e. the last shutdown was a system shutdown or a crash. 1126 // during shutdown, i.e. the last shutdown was a system shutdown or a crash.
1129 if (!profile->IsGuestSession() && !profile->IsSystemProfile() && 1127 if (!profile->IsGuestSession() && !profile->IsSystemProfile() &&
1130 !profile->IsNewProfile() && !go_off_the_record && 1128 !profile->IsNewProfile() && !go_off_the_record &&
1131 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) { 1129 profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) {
1132 ProfileStatisticsFactory::GetForProfile(profile)->GatherStatistics( 1130 ProfileStatisticsFactory::GetForProfile(profile)->GatherStatistics(
1133 profiles::ProfileStatisticsCallback()); 1131 profiles::ProfileStatisticsCallback());
1134 } 1132 }
1135 #endif 1133 #endif
1136 } 1134 }
1137 1135
1138 void ProfileManager::DoFinalInitForServices(Profile* profile, 1136 void ProfileManager::DoFinalInitForServices(Profile* profile,
1139 bool go_off_the_record) { 1137 bool go_off_the_record) {
1140 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); 1138 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices");
1141 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices"); 1139 TRACK_SCOPED_REGION("Startup", "ProfileManager::DoFinalInitForServices");
1142 1140
1143 #if defined(ENABLE_EXTENSIONS) 1141 #if defined(ENABLE_EXTENSIONS)
1142 ProfileInfoCache& cache = GetProfileInfoCache();
1143
1144 // Ensure that the HostContentSettingsMap has been created before the 1144 // Ensure that the HostContentSettingsMap has been created before the
1145 // ExtensionSystem is initialized otherwise the ExtensionSystem will be 1145 // ExtensionSystem is initialized otherwise the ExtensionSystem will be
1146 // registered twice 1146 // registered twice
1147 HostContentSettingsMap* content_settings_map = 1147 HostContentSettingsMap* content_settings_map =
1148 HostContentSettingsMapFactory::GetForProfile(profile); 1148 HostContentSettingsMapFactory::GetForProfile(profile);
1149 1149
1150 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( 1150 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
1151 !go_off_the_record); 1151 !go_off_the_record);
1152 // During tests, when |profile| is an instance of TestingProfile, 1152 // During tests, when |profile| is an instance of TestingProfile,
1153 // ExtensionSystem might not create an ExtensionService. 1153 // ExtensionSystem might not create an ExtensionService.
1154 // This block is duplicated in the HostContentSettingsMapFactory 1154 // This block is duplicated in the HostContentSettingsMapFactory
1155 // ::BuildServiceInstanceFor method, it should be called once when both the 1155 // ::BuildServiceInstanceFor method, it should be called once when both the
1156 // HostContentSettingsMap and the extension_service are set up. 1156 // HostContentSettingsMap and the extension_service are set up.
1157 if (extensions::ExtensionSystem::Get(profile)->extension_service()) { 1157 if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
1158 extensions::ExtensionSystem::Get(profile)->extension_service()-> 1158 extensions::ExtensionSystem::Get(profile)->extension_service()->
1159 RegisterContentSettings(content_settings_map); 1159 RegisterContentSettings(content_settings_map);
1160 } 1160 }
1161 // Set the block extensions bit on the ExtensionService. There likely are no 1161 // Set the block extensions bit on the ExtensionService. There likely are no
1162 // blockable extensions to block. 1162 // blockable extensions to block.
1163 ProfileAttributesEntry* entry; 1163 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
1164 bool has_entry = GetProfileAttributesStorage(). 1164 if (profile_index != std::string::npos &&
1165 GetProfileAttributesWithPath(profile->GetPath(), &entry); 1165 cache.ProfileIsSigninRequiredAtIndex(profile_index)) {
1166 if (has_entry && entry->IsSigninRequired()) {
1167 extensions::ExtensionSystem::Get(profile) 1166 extensions::ExtensionSystem::Get(profile)
1168 ->extension_service() 1167 ->extension_service()
1169 ->BlockAllExtensions(); 1168 ->BlockAllExtensions();
1170 } 1169 }
1171 1170
1172 #endif 1171 #endif
1173 #if defined(ENABLE_SUPERVISED_USERS) 1172 #if defined(ENABLE_SUPERVISED_USERS)
1174 // Initialization needs to happen after extension system initialization (for 1173 // Initialization needs to happen after extension system initialization (for
1175 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the 1174 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the
1176 // initializing the supervised flag if necessary). 1175 // initializing the supervised flag if necessary).
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 1332
1334 #if !defined(OS_ANDROID) 1333 #if !defined(OS_ANDROID)
1335 void ProfileManager::FinishDeletingProfile( 1334 void ProfileManager::FinishDeletingProfile(
1336 const base::FilePath& profile_dir, 1335 const base::FilePath& profile_dir,
1337 const base::FilePath& new_active_profile_dir) { 1336 const base::FilePath& new_active_profile_dir) {
1338 // Update the last used profile pref before closing browser windows. This 1337 // Update the last used profile pref before closing browser windows. This
1339 // way the correct last used profile is set for any notification observers. 1338 // way the correct last used profile is set for any notification observers.
1340 profiles::SetLastUsedProfile( 1339 profiles::SetLastUsedProfile(
1341 new_active_profile_dir.BaseName().MaybeAsASCII()); 1340 new_active_profile_dir.BaseName().MaybeAsASCII());
1342 1341
1343 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); 1342 ProfileInfoCache& cache = GetProfileInfoCache();
1344 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we 1343 // TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we
1345 // start deleting the profile instance we need to close background apps too. 1344 // start deleting the profile instance we need to close background apps too.
1346 Profile* profile = GetProfileByPath(profile_dir); 1345 Profile* profile = GetProfileByPath(profile_dir);
1347 1346
1348 if (profile) { 1347 if (profile) {
1349 // TODO: Migrate additional code in this block to observe this notification 1348 // TODO: Migrate additional code in this block to observe this notification
1350 // instead of being implemented here. 1349 // instead of being implemented here.
1351 content::NotificationService::current()->Notify( 1350 content::NotificationService::current()->Notify(
1352 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 1351 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
1353 content::Source<Profile>(profile), 1352 content::Source<Profile>(profile),
1354 content::NotificationService::NoDetails()); 1353 content::NotificationService::NoDetails());
1355 1354
1356 // By this point, all in-progress downloads for the profile being deleted 1355 // By this point, all in-progress downloads for the profile being deleted
1357 // must have been canceled (crbug.com/336725). 1356 // must have been canceled (crbug.com/336725).
1358 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)-> 1357 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)->
1359 NonMaliciousDownloadCount() == 0); 1358 NonMaliciousDownloadCount() == 0);
1360 BrowserList::CloseAllBrowsersWithProfile(profile); 1359 BrowserList::CloseAllBrowsersWithProfile(profile);
1361 1360
1362 // Disable sync for doomed profile. 1361 // Disable sync for doomed profile.
1363 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( 1362 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
1364 profile)) { 1363 profile)) {
1365 ProfileSyncService* sync_service = 1364 ProfileSyncService* sync_service =
1366 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); 1365 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
1367 if (sync_service->IsSyncRequested()) { 1366 if (sync_service->IsSyncRequested()) {
1368 // Record sync stopped by profile destruction if it was on before. 1367 // Record sync stopped by profile destruction if it was on before.
1369 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", 1368 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource",
1370 syncer::PROFILE_DESTRUCTION, 1369 syncer::PROFILE_DESTRUCTION,
1371 syncer::STOP_SOURCE_LIMIT); 1370 syncer::STOP_SOURCE_LIMIT);
1372 } 1371 }
1373 // Ensure data is cleared even if sync was already off. 1372 // Ensure data is cleared even if sync was already off.
1374 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 1373 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
1375 profile)->RequestStop(ProfileSyncService::CLEAR_DATA); 1374 profile)->RequestStop(ProfileSyncService::CLEAR_DATA);
1376 } 1375 }
1377 1376
1378 ProfileAttributesEntry* entry; 1377 ProfileMetrics::LogProfileDelete(cache.ProfileIsAuthenticatedAtIndex(
1379 bool has_entry = storage.GetProfileAttributesWithPath(profile_dir, &entry); 1378 cache.GetIndexOfProfileWithPath(profile_dir)));
1380 DCHECK(has_entry);
1381 ProfileMetrics::LogProfileDelete(entry->IsAuthenticated());
1382 // Some platforms store passwords in keychains. They should be removed. 1379 // Some platforms store passwords in keychains. They should be removed.
1383 scoped_refptr<password_manager::PasswordStore> password_store = 1380 scoped_refptr<password_manager::PasswordStore> password_store =
1384 PasswordStoreFactory::GetForProfile( 1381 PasswordStoreFactory::GetForProfile(
1385 profile, ServiceAccessType::EXPLICIT_ACCESS).get(); 1382 profile, ServiceAccessType::EXPLICIT_ACCESS).get();
1386 if (password_store.get()) { 1383 if (password_store.get()) {
1387 password_store->RemoveLoginsCreatedBetween( 1384 password_store->RemoveLoginsCreatedBetween(
1388 base::Time(), base::Time::Max(), base::Closure()); 1385 base::Time(), base::Time::Max(), base::Closure());
1389 } 1386 }
1390 1387
1391 // The Profile Data doesn't get wiped until Chrome closes. Since we promised 1388 // The Profile Data doesn't get wiped until Chrome closes. Since we promised
1392 // that the user's data would be removed, do so immediately. 1389 // that the user's data would be removed, do so immediately.
1393 profiles::RemoveBrowsingDataForProfile(profile_dir); 1390 profiles::RemoveBrowsingDataForProfile(profile_dir);
1394 } else { 1391 } else {
1395 // It is safe to delete a not yet loaded Profile from disk. 1392 // It is safe to delete a not yet loaded Profile from disk.
1396 BrowserThread::PostTask( 1393 BrowserThread::PostTask(
1397 BrowserThread::FILE, FROM_HERE, 1394 BrowserThread::FILE, FROM_HERE,
1398 base::Bind(&NukeProfileFromDisk, profile_dir)); 1395 base::Bind(&NukeProfileFromDisk, profile_dir));
1399 } 1396 }
1400 1397
1401 // Queue even a profile that was nuked so it will be MarkedForDeletion and so 1398 // Queue even a profile that was nuked so it will be MarkedForDeletion and so
1402 // CreateProfileAsync can't create it. 1399 // CreateProfileAsync can't create it.
1403 QueueProfileDirectoryForDeletion(profile_dir); 1400 QueueProfileDirectoryForDeletion(profile_dir);
1404 storage.RemoveProfile(profile_dir); 1401 cache.DeleteProfileFromCache(profile_dir);
1405 ProfileMetrics::UpdateReportedProfilesStatistics(this); 1402 ProfileMetrics::UpdateReportedProfilesStatistics(this);
1406 } 1403 }
1407 #endif // !defined(OS_ANDROID) 1404 #endif // !defined(OS_ANDROID)
1408 1405
1409 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( 1406 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
1410 Profile* profile, 1407 Profile* profile,
1411 bool created) { 1408 bool created) {
1412 TRACE_EVENT0("browser", "ProfileManager::RegisterProfile"); 1409 TRACE_EVENT0("browser", "ProfileManager::RegisterProfile");
1413 ProfileInfo* info = new ProfileInfo(profile, created); 1410 ProfileInfo* info = new ProfileInfo(profile, created);
1414 profiles_info_.insert( 1411 profiles_info_.insert(
1415 std::make_pair(profile->GetPath(), linked_ptr<ProfileInfo>(info))); 1412 std::make_pair(profile->GetPath(), linked_ptr<ProfileInfo>(info)));
1416 return info; 1413 return info;
1417 } 1414 }
1418 1415
1419 ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath( 1416 ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath(
1420 const base::FilePath& path) const { 1417 const base::FilePath& path) const {
1421 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); 1418 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path);
1422 return (iter == profiles_info_.end()) ? NULL : iter->second.get(); 1419 return (iter == profiles_info_.end()) ? NULL : iter->second.get();
1423 } 1420 }
1424 1421
1425 void ProfileManager::AddProfileToStorage(Profile* profile) { 1422 void ProfileManager::AddProfileToCache(Profile* profile) {
1426 TRACE_EVENT0("browser", "ProfileManager::AddProfileToCache"); 1423 TRACE_EVENT0("browser", "ProfileManager::AddProfileToCache");
1427 if (profile->IsGuestSession() || profile->IsSystemProfile()) 1424 if (profile->IsGuestSession() || profile->IsSystemProfile())
1428 return; 1425 return;
1429 if (profile->GetPath().DirName() != user_data_dir()) { 1426 ProfileInfoCache& cache = GetProfileInfoCache();
1430 UMA_HISTOGRAM_BOOLEAN("Profile.GetProfileInfoPath.OutsideUserDir", true); 1427 if (profile->GetPath().DirName() != cache.GetUserDataDir())
1431 return; 1428 return;
1432 }
1433
1434 1429
1435 SigninManagerBase* signin_manager = 1430 SigninManagerBase* signin_manager =
1436 SigninManagerFactory::GetForProfile(profile); 1431 SigninManagerFactory::GetForProfile(profile);
1437 AccountTrackerService* account_tracker = 1432 AccountTrackerService* account_tracker =
1438 AccountTrackerServiceFactory::GetForProfile(profile); 1433 AccountTrackerServiceFactory::GetForProfile(profile);
1439 AccountInfo account_info = account_tracker->GetAccountInfo( 1434 AccountInfo account_info = account_tracker->GetAccountInfo(
1440 signin_manager->GetAuthenticatedAccountId()); 1435 signin_manager->GetAuthenticatedAccountId());
1441 base::string16 username = base::UTF8ToUTF16(account_info.email); 1436 base::string16 username = base::UTF8ToUTF16(account_info.email);
1442 1437
1443 ProfileAttributesStorage& storage = GetProfileAttributesStorage(); 1438 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
1444 // |entry| and |has_entry| below are put inside a pair of brackets for 1439 if (profile_index != std::string::npos) {
1445 // scoping, to avoid potential clashes of variable names. 1440 // The ProfileInfoCache's info must match the Signin Manager.
1446 { 1441 cache.SetAuthInfoOfProfileAtIndex(profile_index, account_info.gaia,
1447 ProfileAttributesEntry* entry; 1442 username);
1448 bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(), 1443 return;
1449 &entry);
1450 if (has_entry) {
1451 // The ProfileAttributesStorage's info must match the Signin Manager.
1452 entry->SetAuthInfo(account_info.gaia, username);
1453 return;
1454 }
1455 } 1444 }
1456 1445
1457 // Profile name and avatar are set by InitProfileUserPrefs and stored in the 1446 // Profile name and avatar are set by InitProfileUserPrefs and stored in the
1458 // profile. Use those values to setup the entry in profile attributes storage. 1447 // profile. Use those values to setup the cache entry.
1459 base::string16 profile_name = 1448 base::string16 profile_name =
1460 base::UTF8ToUTF16(profile->GetPrefs()->GetString(prefs::kProfileName)); 1449 base::UTF8ToUTF16(profile->GetPrefs()->GetString(prefs::kProfileName));
1461 1450
1462 size_t icon_index = 1451 size_t icon_index = profile->GetPrefs()->GetInteger(
1463 profile->GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); 1452 prefs::kProfileAvatarIndex);
1464 1453
1465 std::string supervised_user_id = 1454 std::string supervised_user_id =
1466 profile->GetPrefs()->GetString(prefs::kSupervisedUserId); 1455 profile->GetPrefs()->GetString(prefs::kSupervisedUserId);
1467 1456
1468 storage.AddProfile(profile->GetPath(), profile_name, account_info.gaia, 1457 cache.AddProfileToCache(profile->GetPath(),
1469 username, icon_index, supervised_user_id); 1458 profile_name,
1459 account_info.gaia,
1460 username,
1461 icon_index,
1462 supervised_user_id);
1470 1463
1471 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) { 1464 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) {
1472 ProfileAttributesEntry* entry; 1465 cache.SetProfileIsEphemeralAtIndex(
1473 bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(), 1466 cache.GetIndexOfProfileWithPath(profile->GetPath()), true);
1474 &entry);
1475 DCHECK(has_entry);
1476 entry->SetIsEphemeral(true);
1477 } 1467 }
1478 } 1468 }
1479 1469
1480 void ProfileManager::SetNonPersonalProfilePrefs(Profile* profile) { 1470 void ProfileManager::SetNonPersonalProfilePrefs(Profile* profile) {
1481 PrefService* prefs = profile->GetPrefs(); 1471 PrefService* prefs = profile->GetPrefs();
1482 prefs->SetBoolean(prefs::kSigninAllowed, false); 1472 prefs->SetBoolean(prefs::kSigninAllowed, false);
1483 prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false); 1473 prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false);
1484 prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false); 1474 prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false);
1485 prefs->ClearPref(DefaultSearchManager::kDefaultSearchProviderDataPrefName); 1475 prefs->ClearPref(DefaultSearchManager::kDefaultSearchProviderDataPrefName);
1486 } 1476 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 DCHECK(local_state); 1508 DCHECK(local_state);
1519 // Only keep track of profiles that we are managing; tests may create others. 1509 // Only keep track of profiles that we are managing; tests may create others.
1520 // Also never consider the SystemProfile as "active". 1510 // Also never consider the SystemProfile as "active".
1521 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end() && 1511 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end() &&
1522 !last_active->IsSystemProfile()) { 1512 !last_active->IsSystemProfile()) {
1523 std::string profile_path_base = 1513 std::string profile_path_base =
1524 last_active->GetPath().BaseName().MaybeAsASCII(); 1514 last_active->GetPath().BaseName().MaybeAsASCII();
1525 if (profile_path_base != GetLastUsedProfileName()) 1515 if (profile_path_base != GetLastUsedProfileName())
1526 profiles::SetLastUsedProfile(profile_path_base); 1516 profiles::SetLastUsedProfile(profile_path_base);
1527 1517
1528 ProfileAttributesEntry* entry; 1518 ProfileInfoCache& cache = GetProfileInfoCache();
1529 if (GetProfileAttributesStorage(). 1519 size_t profile_index =
1530 GetProfileAttributesWithPath(last_active->GetPath(), &entry)) { 1520 cache.GetIndexOfProfileWithPath(last_active->GetPath());
1521 if (profile_index != std::string::npos) {
1531 #if !defined(OS_CHROMEOS) 1522 #if !defined(OS_CHROMEOS)
1532 // Incognito Profiles don't have ProfileKeyedServices. 1523 // Incognito Profiles don't have ProfileKeyedServices.
1533 if (!last_active->IsOffTheRecord()) { 1524 if (!last_active->IsOffTheRecord()) {
1534 CrossDevicePromoFactory::GetForProfile(last_active)-> 1525 CrossDevicePromoFactory::GetForProfile(last_active)
1535 MaybeBrowsingSessionStarted(entry->GetActiveTime()); 1526 ->MaybeBrowsingSessionStarted(
1527 cache.GetProfileActiveTimeAtIndex(profile_index));
1536 } 1528 }
1537 #endif 1529 #endif
1538 entry->SetActiveTimeToNow(); 1530 cache.SetProfileActiveTimeAtIndex(profile_index);
1539 } 1531 }
1540 } 1532 }
1541 } 1533 }
1542 1534
1543 ProfileManager::BrowserListObserver::BrowserListObserver( 1535 ProfileManager::BrowserListObserver::BrowserListObserver(
1544 ProfileManager* manager) 1536 ProfileManager* manager)
1545 : profile_manager_(manager) { 1537 : profile_manager_(manager) {
1546 BrowserList::AddObserver(this); 1538 BrowserList::AddObserver(this);
1547 } 1539 }
1548 1540
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1617
1626 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1618 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1627 if (!original_callback.is_null()) 1619 if (!original_callback.is_null())
1628 original_callback.Run(loaded_profile, status); 1620 original_callback.Run(loaded_profile, status);
1629 } 1621 }
1630 #endif // !defined(OS_ANDROID) 1622 #endif // !defined(OS_ANDROID)
1631 1623
1632 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1624 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1633 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1625 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1634 } 1626 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/profiles/profile_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698