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

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

Issue 1869473002: Fixed crash on double profile delete operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: param renaming. Created 4 years, 7 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ProfileMetrics::ProfileDelete deletion_source) {
733 if (IsProfileMarkedForDeletion(profile_dir))
734 return false;
735 ScheduleProfileForDeletion(profile_dir, callback);
736 ProfileMetrics::LogProfileDeleteUser(deletion_source);
737 return true;
738 }
739
729 void ProfileManager::ScheduleProfileForDeletion( 740 void ProfileManager::ScheduleProfileForDeletion(
730 const base::FilePath& profile_dir, 741 const base::FilePath& profile_dir,
731 const CreateCallback& callback) { 742 const CreateCallback& callback) {
732 DCHECK(profiles::IsMultipleProfilesEnabled()); 743 DCHECK(profiles::IsMultipleProfilesEnabled());
744 DCHECK(!IsProfileMarkedForDeletion(profile_dir));
733 745
734 // Cancel all in-progress downloads before deleting the profile to prevent a 746 // 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 747 // "Do you want to exit Google Chrome and cancel the downloads?" prompt
736 // (crbug.com/336725). 748 // (crbug.com/336725).
737 Profile* profile = GetProfileByPath(profile_dir); 749 Profile* profile = GetProfileByPath(profile_dir);
738 if (profile) { 750 if (profile) {
739 DownloadService* service = 751 DownloadService* service =
740 DownloadServiceFactory::GetForBrowserContext(profile); 752 DownloadServiceFactory::GetForBrowserContext(profile);
741 service->CancelDownloads(); 753 service->CancelDownloads();
742 } 754 }
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1636
1625 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1637 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1626 if (!original_callback.is_null()) 1638 if (!original_callback.is_null())
1627 original_callback.Run(loaded_profile, status); 1639 original_callback.Run(loaded_profile, status);
1628 } 1640 }
1629 #endif // !defined(OS_ANDROID) 1641 #endif // !defined(OS_ANDROID)
1630 1642
1631 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1643 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1632 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1644 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1633 } 1645 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698