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 "chrome/browser/ui/webui/profile_helper.h" | 5 #include "chrome/browser/ui/webui/profile_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/lifetime/keep_alive_types.h" | |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/profiles/profile_metrics.h" | 11 #include "chrome/browser/profiles/profile_metrics.h" |
| 11 #include "chrome/browser/profiles/profile_window.h" | 12 #include "chrome/browser/profiles/profile_window.h" |
| 12 #include "chrome/browser/profiles/profiles_state.h" | 13 #include "chrome/browser/profiles/profiles_state.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/browser/ui/user_manager.h" | 15 #include "chrome/browser/ui/user_manager.h" |
| 15 #include "chrome/browser/ui/webui/signin/signin_utils.h" | 16 #include "chrome/browser/ui/webui/signin/signin_utils.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 18 #include "extensions/browser/app_window/app_window.h" | 19 #include "extensions/browser/app_window/app_window.h" |
| 19 #include "extensions/browser/app_window/app_window_registry.h" | 20 #include "extensions/browser/app_window/app_window_registry.h" |
| 20 | 21 |
| 21 namespace webui { | 22 namespace webui { |
| 22 namespace { | 23 namespace { |
|
Bernhard Bauer
2016/11/18 13:31:31
Can you add an empty line after this one?
| |
| 23 void ShowSigninDialog(base::FilePath signin_profile_path, | 24 void ShowSigninDialog(base::FilePath signin_profile_path, |
| 24 Profile* system_profile, | 25 Profile* system_profile, |
| 25 Profile::CreateStatus status) { | 26 Profile::CreateStatus status) { |
| 26 UserManager::ShowSigninDialog(system_profile, signin_profile_path); | 27 UserManager::ShowSigninDialog(system_profile, signin_profile_path); |
| 27 } | 28 } |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
|
Bernhard Bauer
2016/11/18 13:31:31
And after this one?
| |
| 30 void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) { | 31 void OpenNewWindowForProfile(const std::unique_ptr<ScopedKeepAlive>& keep_alive, |
|
Bernhard Bauer
2016/11/18 13:31:31
Both the ScopedKeepAlive and the CreateStatus are
| |
| 32 Profile* profile, | |
| 33 Profile::CreateStatus status) { | |
| 31 if (status != Profile::CREATE_STATUS_INITIALIZED) | 34 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 32 return; | 35 return; |
| 33 | 36 |
| 34 if (signin::IsForceSigninEnabled()) { | 37 if (signin::IsForceSigninEnabled()) { |
| 35 if (!UserManager::IsShowing()) { | 38 if (!UserManager::IsShowing()) { |
| 36 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, | 39 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, |
| 37 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 40 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 38 } | 41 } |
| 39 | 42 |
| 40 g_browser_process->profile_manager()->CreateProfileAsync( | 43 g_browser_process->profile_manager()->CreateProfileAsync( |
| 41 ProfileManager::GetSystemProfilePath(), | 44 ProfileManager::GetSystemProfilePath(), |
| 42 base::Bind(&ShowSigninDialog, profile->GetPath()), base::string16(), | 45 base::Bind(&ShowSigninDialog, profile->GetPath()), base::string16(), |
| 43 std::string(), std::string()); | 46 std::string(), std::string()); |
| 44 | 47 |
| 45 } else { | 48 } else { |
| 46 profiles::FindOrCreateNewWindowForProfile( | 49 profiles::FindOrCreateNewWindowForProfile( |
| 47 profile, chrome::startup::IS_PROCESS_STARTUP, | 50 profile, chrome::startup::IS_PROCESS_STARTUP, |
| 48 chrome::startup::IS_FIRST_RUN, false); | 51 chrome::startup::IS_FIRST_RUN, false); |
| 49 } | 52 } |
| 50 } | 53 } |
| 51 | 54 |
| 52 void DeleteProfileAtPath(base::FilePath file_path, | 55 void DeleteProfileAtPath(base::FilePath file_path, |
| 53 content::WebUI* web_ui, | 56 content::WebUI* web_ui, |
| 54 ProfileMetrics::ProfileDelete deletion_source) { | 57 ProfileMetrics::ProfileDelete deletion_source) { |
| 55 DCHECK(web_ui); | 58 DCHECK(web_ui); |
|
Bernhard Bauer
2016/11/18 13:31:31
This parameter seems unnecessary...
| |
| 56 | 59 |
| 57 if (!profiles::IsMultipleProfilesEnabled()) | 60 if (!profiles::IsMultipleProfilesEnabled()) |
| 58 return; | 61 return; |
| 59 g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion( | 62 g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion( |
| 60 file_path, base::Bind(&OpenNewWindowForProfile), deletion_source); | 63 file_path, base::Bind(&OpenNewWindowForProfile, |
| 64 base::Passed(base::MakeUnique<ScopedKeepAlive>( | |
| 65 KeepAliveOrigin::PROFILE_HELPER, | |
| 66 KeepAliveRestartOption::DISABLED))), | |
| 67 deletion_source); | |
| 61 } | 68 } |
| 62 | 69 |
| 63 } // namespace webui | 70 } // namespace webui |
| OLD | NEW |