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

Unified Diff: chrome/browser/ui/webui/profile_helper.cc

Issue 2516613002: Profile deletion: prevent profile creation race in dying browser. (Closed)
Patch Set: Review fixes Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/profile_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/profile_helper.cc
diff --git a/chrome/browser/ui/webui/profile_helper.cc b/chrome/browser/ui/webui/profile_helper.cc
index 04bf70c1d48674c254e061abfb8d005d096f9794..217cfaf46579b33bdc9755ffa367ab447144a16c 100644
--- a/chrome/browser/ui/webui/profile_helper.cc
+++ b/chrome/browser/ui/webui/profile_helper.cc
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/lifetime/keep_alive_types.h"
+#include "chrome/browser/lifetime/scoped_keep_alive.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_window.h"
@@ -20,17 +22,25 @@
namespace webui {
namespace {
+
void ShowSigninDialog(base::FilePath signin_profile_path,
Profile* system_profile,
Profile::CreateStatus status) {
UserManager::ShowSigninDialog(system_profile, signin_profile_path);
}
-} // namespace
-void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) {
+void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive,
+ Profile* profile,
+ Profile::CreateStatus status) {
if (status != Profile::CREATE_STATUS_INITIALIZED)
return;
+ OpenNewWindowForProfile(profile);
+}
+
+} // namespace
+
+void OpenNewWindowForProfile(Profile* profile) {
if (signin::IsForceSigninEnabled()) {
if (!UserManager::IsShowing()) {
UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL,
@@ -57,7 +67,11 @@ void DeleteProfileAtPath(base::FilePath file_path,
if (!profiles::IsMultipleProfilesEnabled())
return;
g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion(
- file_path, base::Bind(&OpenNewWindowForProfile), deletion_source);
+ file_path, base::Bind(&DeleteProfileCallback,
+ base::Passed(base::MakeUnique<ScopedKeepAlive>(
+ KeepAliveOrigin::PROFILE_HELPER,
+ KeepAliveRestartOption::DISABLED))),
+ deletion_source);
}
} // namespace webui
« no previous file with comments | « chrome/browser/ui/webui/profile_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698