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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
26 #include "base/value_conversions.h" | 26 #include "base/value_conversions.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 28 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
29 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" | 29 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" |
30 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
33 #include "chrome/browser/download/download_service.h" | 33 #include "chrome/browser/download/download_core_service.h" |
34 #include "chrome/browser/download/download_service_factory.h" | 34 #include "chrome/browser/download/download_core_service_factory.h" |
35 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 35 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
37 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 37 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
38 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv
ice_factory.h" | 38 #include "chrome/browser/password_manager/password_manager_setting_migrator_serv
ice_factory.h" |
39 #include "chrome/browser/password_manager/password_store_factory.h" | 39 #include "chrome/browser/password_manager/password_store_factory.h" |
40 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 40 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
41 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 41 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
42 #include "chrome/browser/profiles/profile_attributes_entry.h" | 42 #include "chrome/browser/profiles/profile_attributes_entry.h" |
43 #include "chrome/browser/profiles/profile_attributes_storage.h" | 43 #include "chrome/browser/profiles/profile_attributes_storage.h" |
44 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 44 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 void ProfileManager::ScheduleProfileForDeletion( | 809 void ProfileManager::ScheduleProfileForDeletion( |
810 const base::FilePath& profile_dir, const CreateCallback& callback) { | 810 const base::FilePath& profile_dir, const CreateCallback& callback) { |
811 DCHECK(profiles::IsMultipleProfilesEnabled()); | 811 DCHECK(profiles::IsMultipleProfilesEnabled()); |
812 DCHECK(!IsProfileDirectoryMarkedForDeletion(profile_dir)); | 812 DCHECK(!IsProfileDirectoryMarkedForDeletion(profile_dir)); |
813 | 813 |
814 Profile* profile = GetProfileByPath(profile_dir); | 814 Profile* profile = GetProfileByPath(profile_dir); |
815 if (profile) { | 815 if (profile) { |
816 // Cancel all in-progress downloads before deleting the profile to prevent a | 816 // Cancel all in-progress downloads before deleting the profile to prevent a |
817 // "Do you want to exit Google Chrome and cancel the downloads?" prompt | 817 // "Do you want to exit Google Chrome and cancel the downloads?" prompt |
818 // (crbug.com/336725). | 818 // (crbug.com/336725). |
819 DownloadService* service = | 819 DownloadCoreService* service = |
820 DownloadServiceFactory::GetForBrowserContext(profile); | 820 DownloadCoreServiceFactory::GetForBrowserContext(profile); |
821 service->CancelDownloads(); | 821 service->CancelDownloads(); |
822 DCHECK_EQ(0, service->NonMaliciousDownloadCount()); | 822 DCHECK_EQ(0, service->NonMaliciousDownloadCount()); |
823 | 823 |
824 // Close all browser windows before deleting the profile. If the user | 824 // Close all browser windows before deleting the profile. If the user |
825 // cancels the closing of any tab in an OnBeforeUnload event, profile | 825 // cancels the closing of any tab in an OnBeforeUnload event, profile |
826 // deletion is also cancelled. (crbug.com/289390) | 826 // deletion is also cancelled. (crbug.com/289390) |
827 BrowserList::CloseAllBrowsersWithProfile( | 827 BrowserList::CloseAllBrowsersWithProfile( |
828 profile, | 828 profile, |
829 base::Bind(&ProfileManager::EnsureActiveProfileExistsBeforeDeletion, | 829 base::Bind(&ProfileManager::EnsureActiveProfileExistsBeforeDeletion, |
830 base::Unretained(this), callback), | 830 base::Unretained(this), callback), |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1794 |
1795 const base::FilePath new_active_profile_dir = | 1795 const base::FilePath new_active_profile_dir = |
1796 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); | 1796 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); |
1797 FinishDeletingProfile(profile_dir, new_active_profile_dir); | 1797 FinishDeletingProfile(profile_dir, new_active_profile_dir); |
1798 } | 1798 } |
1799 #endif // !defined(OS_ANDROID) | 1799 #endif // !defined(OS_ANDROID) |
1800 | 1800 |
1801 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1801 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1802 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1802 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1803 } | 1803 } |
OLD | NEW |