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 <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 882 DCHECK(deleted_profiles); | 882 DCHECK(deleted_profiles); |
| 883 | 883 |
| 884 for (const std::unique_ptr<base::Value>& value : *deleted_profiles) { | 884 for (const std::unique_ptr<base::Value>& value : *deleted_profiles) { |
| 885 base::FilePath profile_path; | 885 base::FilePath profile_path; |
| 886 bool is_valid_profile_path = | 886 bool is_valid_profile_path = |
| 887 base::GetValueAsFilePath(*value, &profile_path) && | 887 base::GetValueAsFilePath(*value, &profile_path) && |
| 888 profile_path.DirName() == user_data_dir(); | 888 profile_path.DirName() == user_data_dir(); |
| 889 // Although it should never happen, make sure this is a valid path in the | 889 // Although it should never happen, make sure this is a valid path in the |
| 890 // user_data_dir, so we don't accidentially delete something else. | 890 // user_data_dir, so we don't accidentially delete something else. |
| 891 if (is_valid_profile_path) { | 891 if (is_valid_profile_path) { |
| 892 LOG(WARNING) << "Files of a deleted profile still exist after restart. " | 892 if (base::PathExists(profile_path)) { |
|
msramek
2017/01/10 13:46:32
This is not a part of this CL.
dullweber
2017/01/10 17:14:38
That's right, I have no idea how I managed to get
| |
| 893 "Cleaning up now."; | 893 LOG(WARNING) << "Files of a deleted profile still exist after restart. " |
| 894 BrowserThread::PostTaskAndReply( | 894 "Cleaning up now."; |
| 895 BrowserThread::FILE, FROM_HERE, | 895 BrowserThread::PostTaskAndReply( |
| 896 base::Bind(&NukeProfileFromDisk, profile_path), | 896 BrowserThread::FILE, FROM_HERE, |
| 897 base::Bind(&ProfileCleanedUp, value.get())); | 897 base::Bind(&NukeProfileFromDisk, profile_path), |
| 898 base::Bind(&ProfileCleanedUp, value.get())); | |
| 899 } else { | |
| 900 // Everything is fine, the profile was removed on shutdown. | |
| 901 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
| 902 base::Bind(&ProfileCleanedUp, value.get())); | |
| 903 } | |
| 898 } else { | 904 } else { |
| 899 LOG(ERROR) << "Found invalid profile path in deleted_profiles: " | 905 LOG(ERROR) << "Found invalid profile path in deleted_profiles: " |
| 900 << profile_path.AsUTF8Unsafe(); | 906 << profile_path.AsUTF8Unsafe(); |
| 901 NOTREACHED(); | 907 NOTREACHED(); |
| 902 } | 908 } |
| 903 } | 909 } |
| 904 } | 910 } |
| 905 | 911 |
| 906 void ProfileManager::InitProfileUserPrefs(Profile* profile) { | 912 void ProfileManager::InitProfileUserPrefs(Profile* profile) { |
| 907 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs"); | 913 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs"); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1714 | 1720 |
| 1715 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1721 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
| 1716 if (!original_callback.is_null()) | 1722 if (!original_callback.is_null()) |
| 1717 original_callback.Run(loaded_profile, status); | 1723 original_callback.Run(loaded_profile, status); |
| 1718 } | 1724 } |
| 1719 #endif // !defined(OS_ANDROID) | 1725 #endif // !defined(OS_ANDROID) |
| 1720 | 1726 |
| 1721 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1727 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1722 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1728 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1723 } | 1729 } |
| OLD | NEW |