Index: chrome/browser/policy/user_policy_signin_service.cc |
=================================================================== |
--- chrome/browser/policy/user_policy_signin_service.cc (revision 183433) |
+++ chrome/browser/policy/user_policy_signin_service.cc (working copy) |
@@ -408,6 +408,7 @@ |
manager->Connect(g_browser_process->local_state(), client.Pass()); |
DCHECK(manager->core()->service()); |
StartObserving(); |
+ ProhibitSignoutIfNeeded(); |
} |
void UserPolicySigninService::InitializeForSignedInUser() { |
@@ -474,6 +475,8 @@ |
} |
RegisterCloudPolicyService(token); |
} |
+ // If client is registered now, prohibit signout. |
+ ProhibitSignoutIfNeeded(); |
} |
void UserPolicySigninService::RegisterCloudPolicyService( |
@@ -496,9 +499,19 @@ |
} |
void UserPolicySigninService::OnRegistrationComplete() { |
+ ProhibitSignoutIfNeeded(); |
registration_helper_.reset(); |
} |
+void UserPolicySigninService::ProhibitSignoutIfNeeded() { |
+ if (GetManager()->IsClientRegistered()) { |
+ DVLOG(1) << "User is registered for policy - prohibiting signout"; |
+ SigninManager* signin_manager = |
+ SigninManagerFactory::GetForProfile(profile_); |
+ signin_manager->ProhibitSignout(); |
+ } |
+} |
+ |
void UserPolicySigninService::Shutdown() { |
// Stop any pending registration helper activity. We do this here instead of |
// in the destructor because we want to shutdown the registration helper |