| Index: chrome/browser/profiles/profile_manager.cc
|
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
|
| index 014877c80c00c6928b8049943ab3d66f8ffb41c1..0c4229c8eb8db14d8d3625af514b2d39dfb0202c 100644
|
| --- a/chrome/browser/profiles/profile_manager.cc
|
| +++ b/chrome/browser/profiles/profile_manager.cc
|
| @@ -51,6 +51,7 @@
|
| #include "chrome/browser/signin/account_tracker_service_factory.h"
|
| #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
|
| #include "chrome/browser/signin/signin_manager_factory.h"
|
| +#include "chrome/browser/signin/signin_util.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_finder.h"
|
| @@ -336,6 +337,14 @@ bool IsProfileEphemeral(ProfileAttributesStorage* storage,
|
| }
|
| #endif
|
|
|
| +#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
|
| +void SignOut(SigninManager* signin_manager) {
|
| + signin_manager->SignOut(
|
| + signin_metrics::AUTHENTICATION_FAILED_WITH_FORCE_SIGNIN,
|
| + signin_metrics::SignoutDelete::IGNORE_METRIC);
|
| +}
|
| +#endif
|
| +
|
| } // namespace
|
|
|
| ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
|
| @@ -1564,8 +1573,21 @@ void ProfileManager::AddProfileToStorage(Profile* profile) {
|
| bool has_entry = storage.GetProfileAttributesWithPath(profile->GetPath(),
|
| &entry);
|
| if (has_entry) {
|
| +#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
|
| + bool was_authenticated_status = entry->IsAuthenticated();
|
| +#endif
|
| // The ProfileAttributesStorage's info must match the Signin Manager.
|
| entry->SetAuthInfo(account_info.gaia, username);
|
| +#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
|
| + // Sign out if force-sign-in policy is enabled and profile is not signed
|
| + // in.
|
| + if (signin_util::IsForceSigninEnabled() && was_authenticated_status &&
|
| + !entry->IsAuthenticated()) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&SignOut, static_cast<SigninManager*>(signin_manager)));
|
| + }
|
| +#endif
|
| return;
|
| }
|
| }
|
|
|