Chromium Code Reviews| 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" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/deferred_sequenced_task_runner.h" | 12 #include "base/deferred_sequenced_task_runner.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/prefs/scoped_user_pref_update.h" | 18 #include "base/prefs/scoped_user_pref_update.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/content_settings/host_content_settings_map.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 26 #include "chrome/browser/download/download_service.h" | 26 #include "chrome/browser/download/download_service.h" |
| 27 #include "chrome/browser/download/download_service_factory.h" | 27 #include "chrome/browser/download/download_service_factory.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | |
| 28 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 29 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 29 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 30 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
| 30 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 31 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 31 #include "chrome/browser/profiles/profile_destroyer.h" | 32 #include "chrome/browser/profiles/profile_destroyer.h" |
| 32 #include "chrome/browser/profiles/profile_info_cache.h" | 33 #include "chrome/browser/profiles/profile_info_cache.h" |
| 33 #include "chrome/browser/profiles/profile_metrics.h" | 34 #include "chrome/browser/profiles/profile_metrics.h" |
| 34 #include "chrome/browser/profiles/profiles_state.h" | 35 #include "chrome/browser/profiles/profiles_state.h" |
| 35 #include "chrome/browser/profiles/startup_task_runner_service.h" | 36 #include "chrome/browser/profiles/startup_task_runner_service.h" |
| 36 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" | 37 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" |
| 37 #include "chrome/browser/signin/account_reconcilor_factory.h" | 38 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)-> | 1091 DCHECK(DownloadServiceFactory::GetForBrowserContext(profile)-> |
| 1091 NonMaliciousDownloadCount() == 0); | 1092 NonMaliciousDownloadCount() == 0); |
| 1092 BrowserList::CloseAllBrowsersWithProfile(profile); | 1093 BrowserList::CloseAllBrowsersWithProfile(profile); |
| 1093 | 1094 |
| 1094 // Disable sync for doomed profile. | 1095 // Disable sync for doomed profile. |
| 1095 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( | 1096 if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( |
| 1096 profile)) { | 1097 profile)) { |
| 1097 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 1098 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
| 1098 profile)->DisableForUser(); | 1099 profile)->DisableForUser(); |
| 1099 } | 1100 } |
| 1101 | |
| 1102 // Disable apps & extensions now to stop them from running after a profile | |
|
not at google - send to devlin
2014/05/06 22:25:29
I have a weak preference for this logic to be some
scheib
2014/05/07 21:29:35
Done.
| |
| 1103 // has been conceptually deleted. Don't wait for full browser shutdown and | |
| 1104 // the actual profile objects to be destroyed. | |
| 1105 ExtensionIdSet ids_to_unload = extensions::ExtensionRegistry::Get(profile) | |
| 1106 ->enabled_extensions() | |
| 1107 .GetIDs(); | |
| 1108 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | |
| 1109 it != ids_to_unload.end(); | |
| 1110 ++it) { | |
| 1111 extensions::ExtensionSystem::Get(profile) | |
| 1112 ->extension_service() | |
| 1113 ->UnloadExtension( | |
| 1114 *it, extensions::UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | |
| 1115 } | |
| 1100 } | 1116 } |
| 1101 | 1117 |
| 1102 QueueProfileDirectoryForDeletion(profile_dir); | 1118 QueueProfileDirectoryForDeletion(profile_dir); |
| 1103 cache.DeleteProfileFromCache(profile_dir); | 1119 cache.DeleteProfileFromCache(profile_dir); |
| 1104 ProfileMetrics::UpdateReportedProfilesStatistics(this); | 1120 ProfileMetrics::UpdateReportedProfilesStatistics(this); |
| 1105 } | 1121 } |
| 1106 | 1122 |
| 1107 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( | 1123 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( |
| 1108 Profile* profile, | 1124 Profile* profile, |
| 1109 bool created) { | 1125 bool created) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 last_non_managed_profile_path.BaseName().MaybeAsASCII()); | 1302 last_non_managed_profile_path.BaseName().MaybeAsASCII()); |
| 1287 FinishDeletingProfile(profile_to_delete_path); | 1303 FinishDeletingProfile(profile_to_delete_path); |
| 1288 } | 1304 } |
| 1289 } | 1305 } |
| 1290 } | 1306 } |
| 1291 #endif | 1307 #endif |
| 1292 | 1308 |
| 1293 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1309 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1294 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1310 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1295 } | 1311 } |
| OLD | NEW |