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

Unified Diff: chrome/browser/policy/cloud/user_policy_signin_service_base.cc

Issue 187693002: Move UserPolicySigninServiceBase to observe SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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/policy/cloud/user_policy_signin_service_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/cloud/user_policy_signin_service_base.cc
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_base.cc b/chrome/browser/policy/cloud/user_policy_signin_service_base.cc
index 1a754f0f7d23389531e2991ca1f21f2b6761c6b8..f23742676f81537742243cc2b058562ec2cccc6f 100644
--- a/chrome/browser/policy/cloud/user_policy_signin_service_base.cc
+++ b/chrome/browser/policy/cloud/user_policy_signin_service_base.cc
@@ -72,14 +72,15 @@ void UserPolicySigninServiceBase::FetchPolicyForSignedInUser(
manager->core()->service()->RefreshPolicy(callback);
}
+void UserPolicySigninServiceBase::GoogleSignedOut(const std::string& username) {
+ ShutdownUserCloudPolicyManager();
+}
+
void UserPolicySigninServiceBase::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT:
- ShutdownUserCloudPolicyManager();
- break;
case chrome::NOTIFICATION_PROFILE_ADDED:
// A new profile has been loaded - if it's signed in, then initialize the
// UCPM, otherwise shut down the UCPM (which deletes any cached policy
@@ -132,6 +133,8 @@ void UserPolicySigninServiceBase::OnClientError(CloudPolicyClient* client) {
}
void UserPolicySigninServiceBase::Shutdown() {
+ if (signin_manager())
+ signin_manager()->RemoveObserver(this);
PrepareForUserCloudPolicyManagerShutdown();
}
@@ -180,12 +183,11 @@ void UserPolicySigninServiceBase::InitializeOnProfileReady(Profile* profile) {
return;
}
- // Shutdown the UserCloudPolicyManager when the user signs out. We do
- // this here because we don't want to get SIGNED_OUT notifications until
- // after the profile has started initializing (http://crbug.com/316229).
- registrar_.Add(this,
- chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
- content::Source<Profile>(profile));
+ // Shutdown the UserCloudPolicyManager when the user signs out. We start
+ // observing the SigninManager here because we don't want to get signout
+ // notifications until after the profile has started initializing
+ // (http://crbug.com/316229).
+ signin_manager()->AddObserver(this);
std::string username = signin_manager()->GetAuthenticatedUsername();
if (username.empty())
« no previous file with comments | « chrome/browser/policy/cloud/user_policy_signin_service_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698