| 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/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/profiles/profile_metrics.h" | 10 #include "chrome/browser/profiles/profile_metrics.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 Profile::CreateStatus status) { | 25 Profile::CreateStatus status) { |
| 26 UserManager::ShowSigninDialog(system_profile, signin_profile_path); | 26 UserManager::ShowSigninDialog(system_profile, signin_profile_path); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) { | 30 void OpenNewWindowForProfile(Profile* profile, Profile::CreateStatus status) { |
| 31 if (status != Profile::CREATE_STATUS_INITIALIZED) | 31 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 if (signin::IsForceSigninEnabled()) { | 34 if (signin::IsForceSigninEnabled()) { |
| 35 // TODO(zmin): Remove the switcher once the UserManager API is finished on Mac. | |
| 36 #if !defined(OS_MACOSX) | |
| 37 if (!UserManager::IsShowing()) { | 35 if (!UserManager::IsShowing()) { |
| 38 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, | 36 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, |
| 39 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 37 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 40 } | 38 } |
| 41 | 39 |
| 42 g_browser_process->profile_manager()->CreateProfileAsync( | 40 g_browser_process->profile_manager()->CreateProfileAsync( |
| 43 ProfileManager::GetSystemProfilePath(), | 41 ProfileManager::GetSystemProfilePath(), |
| 44 base::Bind(&ShowSigninDialog, profile->GetPath()), base::string16(), | 42 base::Bind(&ShowSigninDialog, profile->GetPath()), base::string16(), |
| 45 std::string(), std::string()); | 43 std::string(), std::string()); |
| 46 | 44 |
| 47 #endif | |
| 48 } else { | 45 } else { |
| 49 profiles::FindOrCreateNewWindowForProfile( | 46 profiles::FindOrCreateNewWindowForProfile( |
| 50 profile, chrome::startup::IS_PROCESS_STARTUP, | 47 profile, chrome::startup::IS_PROCESS_STARTUP, |
| 51 chrome::startup::IS_FIRST_RUN, false); | 48 chrome::startup::IS_FIRST_RUN, false); |
| 52 } | 49 } |
| 53 } | 50 } |
| 54 | 51 |
| 55 void DeleteProfileAtPath(base::FilePath file_path, | 52 void DeleteProfileAtPath(base::FilePath file_path, |
| 56 content::WebUI* web_ui, | 53 content::WebUI* web_ui, |
| 57 ProfileMetrics::ProfileDelete deletion_source) { | 54 ProfileMetrics::ProfileDelete deletion_source) { |
| 58 DCHECK(web_ui); | 55 DCHECK(web_ui); |
| 59 | 56 |
| 60 if (!profiles::IsMultipleProfilesEnabled()) | 57 if (!profiles::IsMultipleProfilesEnabled()) |
| 61 return; | 58 return; |
| 62 g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion( | 59 g_browser_process->profile_manager()->MaybeScheduleProfileForDeletion( |
| 63 file_path, base::Bind(&OpenNewWindowForProfile), deletion_source); | 60 file_path, base::Bind(&OpenNewWindowForProfile), deletion_source); |
| 64 } | 61 } |
| 65 | 62 |
| 66 } // namespace webui | 63 } // namespace webui |
| OLD | NEW |