Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4971)

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 2712883005: Sign out profile when local_state file has been changed. (Closed)
Patch Set: Merge from master Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/signin/chrome_signin_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/signin/chrome_signin_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698