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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 | 719 |
| 720 ProfileAttributesStorage& ProfileManager::GetProfileAttributesStorage() { | 720 ProfileAttributesStorage& ProfileManager::GetProfileAttributesStorage() { |
| 721 return GetProfileInfoCache(); | 721 return GetProfileInfoCache(); |
| 722 } | 722 } |
| 723 | 723 |
| 724 ProfileShortcutManager* ProfileManager::profile_shortcut_manager() { | 724 ProfileShortcutManager* ProfileManager::profile_shortcut_manager() { |
| 725 return profile_shortcut_manager_.get(); | 725 return profile_shortcut_manager_.get(); |
| 726 } | 726 } |
| 727 | 727 |
| 728 #if !defined(OS_ANDROID) | 728 #if !defined(OS_ANDROID) |
| 729 bool ProfileManager::MaybeScheduleProfileForDeletion( | |
| 730 const base::FilePath& profile_dir, | |
| 731 const CreateCallback& callback) { | |
| 732 if (IsProfileMarkedForDeletion(profile_dir)) | |
| 733 return false; | |
| 734 ScheduleProfileForDeletion(profile_dir, callback); | |
| 735 return true; | |
| 736 } | |
| 737 | |
| 729 void ProfileManager::ScheduleProfileForDeletion( | 738 void ProfileManager::ScheduleProfileForDeletion( |
| 730 const base::FilePath& profile_dir, | 739 const base::FilePath& profile_dir, |
| 731 const CreateCallback& callback) { | 740 const CreateCallback& callback) { |
| 732 DCHECK(profiles::IsMultipleProfilesEnabled()); | 741 DCHECK(profiles::IsMultipleProfilesEnabled()); |
| 742 CHECK(!IsProfileMarkedForDeletion(profile_dir)); | |
|
Dan Beam
2016/05/13 03:37:40
sooooo, why can't we just do:
if (IsProfileMarked
Bernhard Bauer
2016/05/13 09:37:54
I would make this a DCHECK though.
| |
| 733 | 743 |
| 734 // Cancel all in-progress downloads before deleting the profile to prevent a | 744 // 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 | 745 // "Do you want to exit Google Chrome and cancel the downloads?" prompt |
| 736 // (crbug.com/336725). | 746 // (crbug.com/336725). |
| 737 Profile* profile = GetProfileByPath(profile_dir); | 747 Profile* profile = GetProfileByPath(profile_dir); |
| 738 if (profile) { | 748 if (profile) { |
| 739 DownloadService* service = | 749 DownloadService* service = |
| 740 DownloadServiceFactory::GetForBrowserContext(profile); | 750 DownloadServiceFactory::GetForBrowserContext(profile); |
| 741 service->CancelDownloads(); | 751 service->CancelDownloads(); |
| 742 } | 752 } |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1624 | 1634 |
| 1625 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1635 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
| 1626 if (!original_callback.is_null()) | 1636 if (!original_callback.is_null()) |
| 1627 original_callback.Run(loaded_profile, status); | 1637 original_callback.Run(loaded_profile, status); |
| 1628 } | 1638 } |
| 1629 #endif // !defined(OS_ANDROID) | 1639 #endif // !defined(OS_ANDROID) |
| 1630 | 1640 |
| 1631 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1641 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1632 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1642 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1633 } | 1643 } |
| OLD | NEW |