Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "chrome/browser/profiles/profile_metrics.h" | 8 #include "chrome/browser/profiles/profile_metrics.h" |
| 9 #include "chrome/browser/profiles/profile_window.h" | 9 #include "chrome/browser/profiles/profile_window.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" | 10 #include "chrome/browser/profiles/profiles_state.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/webui/profile_helper.h" | 12 #include "chrome/browser/ui/webui/profile_helper.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 #include "extensions/browser/app_window/app_window.h" | 15 #include "extensions/browser/app_window/app_window.h" |
| 16 #include "extensions/browser/app_window/app_window_registry.h" | 16 #include "extensions/browser/app_window/app_window_registry.h" |
| 17 | 17 |
| 18 namespace webui { | 18 namespace webui { |
| 19 | 19 |
| 20 void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) { | 20 void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) { |
| 21 if (status != Profile::CREATE_STATUS_INITIALIZED) | 21 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 22 return; | 22 return; |
| 23 | 23 |
| 24 profiles::FindOrCreateNewWindowForProfile( | 24 profiles::FindOrCreateNewWindowForProfile( |
| 25 profile, chrome::startup::IS_PROCESS_STARTUP, | 25 profile, chrome::startup::IS_PROCESS_STARTUP, |
| 26 chrome::startup::IS_FIRST_RUN, false); | 26 chrome::startup::IS_FIRST_RUN, false); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void DeleteProfileAtPath(base::FilePath file_path, content::WebUI* web_ui) { | 29 void DeleteProfileAtPath(base::FilePath file_path, |
| 30 content::WebUI* web_ui, | |
| 31 ProfileMetrics::ProfileDelete user) { | |
| 30 DCHECK(web_ui); | 32 DCHECK(web_ui); |
| 31 | 33 |
| 32 if (!profiles::IsMultipleProfilesEnabled()) | 34 if (!profiles::IsMultipleProfilesEnabled()) |
| 33 return; | 35 return; |
| 34 | 36 if (g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion( |
|
achuithb
2016/05/12 22:33:59
This seems a bit awkward. Can you pass user into M
| |
| 35 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::DELETE_PROFILE_SETTINGS); | 37 file_path, base::Bind(&OpenNewWindowForProfile))) { |
| 36 | 38 ProfileMetrics::LogProfileDeleteUser(user); |
| 37 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 39 } |
| 38 file_path, base::Bind(&OpenNewWindowForProfile)); | |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace webui | 42 } // namespace webui |
| OLD | NEW |