Chromium Code Reviews| 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 d7a6881638c82fc6c181bc7dc0974b577b0adf0d..61a0d3a775bbb675e34f4702198c6be0d8650a0d 100644 |
| --- a/chrome/browser/ui/webui/profile_helper.cc |
| +++ b/chrome/browser/ui/webui/profile_helper.cc |
| @@ -2,6 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "chrome/browser/ui/webui/profile_helper.h" |
| + |
| #include "base/bind.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| @@ -9,21 +11,45 @@ |
| #include "chrome/browser/profiles/profile_window.h" |
| #include "chrome/browser/profiles/profiles_state.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| -#include "chrome/browser/ui/webui/profile_helper.h" |
| +#include "chrome/browser/ui/user_manager.h" |
| +#include "chrome/browser/ui/webui/signin/signin_utils.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_ui.h" |
| #include "extensions/browser/app_window/app_window.h" |
| #include "extensions/browser/app_window/app_window_registry.h" |
| 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) { |
| if (status != Profile::CREATE_STATUS_INITIALIZED) |
| return; |
| - profiles::FindOrCreateNewWindowForProfile( |
| - profile, chrome::startup::IS_PROCESS_STARTUP, |
| - chrome::startup::IS_FIRST_RUN, false); |
| + if (signin::IsForceSigninEnabled()) { |
| +// TODO(zmin): Remove the switcher once the UserManager API is finished on Mac. |
| +#if !defined(OS_MACOSX) |
|
sky
2016/10/06 16:02:08
Is it expected this branch (force signin enabled)
|
| + if (!UserManager::IsShowing()) { |
| + UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, |
| + profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| + } |
| + |
| + g_browser_process->profile_manager()->CreateProfileAsync( |
| + ProfileManager::GetSystemProfilePath(), |
| + base::Bind(&ShowSigninDialog, profile->GetPath()), base::string16(), |
| + std::string(), std::string()); |
| + |
| +#endif |
| + } else { |
| + profiles::FindOrCreateNewWindowForProfile( |
| + profile, chrome::startup::IS_PROCESS_STARTUP, |
| + chrome::startup::IS_FIRST_RUN, false); |
| + } |
| } |
| void DeleteProfileAtPath(base::FilePath file_path, |