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

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: DeleteProfileAtPath use MaybeScheduleProfileForDeletion 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 if (IsProfileMarkedForDeletion(profile_dir)) {
733 LOG(WARNING) << "Profile already marked for deletion: "
Bernhard Bauer 2016/05/12 12:06:23 I would not warn here if we are returning success
734 << profile_dir.value();
735 return false;
736 }
737 ScheduleProfileForDeletion(profile_dir, callback);
738 return true;
739 }
740
729 void ProfileManager::ScheduleProfileForDeletion( 741 void ProfileManager::ScheduleProfileForDeletion(
730 const base::FilePath& profile_dir, 742 const base::FilePath& profile_dir,
731 const CreateCallback& callback) { 743 const CreateCallback& callback) {
732 DCHECK(profiles::IsMultipleProfilesEnabled()); 744 DCHECK(profiles::IsMultipleProfilesEnabled());
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) {
(...skipping 885 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

Powered by Google App Engine
This is Rietveld 408576698