Index: chrome/browser/policy/cloud/user_policy_signin_service.h |
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service.h b/chrome/browser/policy/cloud/user_policy_signin_service.h |
index b708f795e83467b284d134e6400a1dd856d4f9d3..2b035fe14464babb0fb02196ebdbe353629cfe16 100644 |
--- a/chrome/browser/policy/cloud/user_policy_signin_service.h |
+++ b/chrome/browser/policy/cloud/user_policy_signin_service.h |
@@ -11,6 +11,7 @@ |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
#include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" |
+#include "chrome/browser/signin/oauth2_token_service.h" |
class Profile; |
@@ -20,7 +21,8 @@ class CloudPolicyClientRegistrationHelper; |
// A specialization of the UserPolicySigninServiceBase for the desktop |
// platforms (Windows, Mac and Linux). |
-class UserPolicySigninService : public UserPolicySigninServiceBase { |
+class UserPolicySigninService : public UserPolicySigninServiceBase, |
+ public OAuth2TokenService::Observer { |
public: |
// Creates a UserPolicySigninService associated with the passed |profile|. |
UserPolicySigninService(Profile* profile, |
@@ -30,16 +32,15 @@ class UserPolicySigninService : public UserPolicySigninServiceBase { |
// Registers a CloudPolicyClient for fetching policy for a user. The |
// |oauth2_login_token| and |username| are explicitly passed because |
- // the user is not signed in yet (TokenService does not have any tokens yet |
- // to prevent services from using it until after we've fetched policy). |
+ // the user is not signed in yet (ProfileOAuth2TokenService does not have |
+ // any tokens yet to prevent services from using it until after we've fetched |
+ // policy). |
void RegisterPolicyClient(const std::string& username, |
const std::string& oauth2_login_token, |
const PolicyRegistrationCallback& callback); |
- // content::NotificationObserver implementation: |
- virtual void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) OVERRIDE; |
+ // OAuth2TokenService::Observer implementation: |
+ virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; |
// CloudPolicyService::Observer implementation: |
virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; |
@@ -47,9 +48,12 @@ class UserPolicySigninService : public UserPolicySigninServiceBase { |
// BrowserContextKeyedService implementation: |
virtual void Shutdown() OVERRIDE; |
+ protected: |
// UserPolicySigninServiceBase implementation: |
virtual void InitializeUserCloudPolicyManager( |
scoped_ptr<CloudPolicyClient> client) OVERRIDE; |
+ |
+ virtual void PrepareForUserCloudPolicyManagerShutdown() OVERRIDE; |
virtual void ShutdownUserCloudPolicyManager() OVERRIDE; |
private: |
@@ -57,7 +61,7 @@ class UserPolicySigninService : public UserPolicySigninServiceBase { |
// the cloud policy server. |oauth_login_token| should contain an OAuth login |
// refresh token that can be downscoped to get an access token for the |
// device_management service. |
- void RegisterCloudPolicyService(const std::string& oauth_login_token); |
+ void RegisterCloudPolicyService(); |
// Callback invoked when policy registration has finished. |
void OnRegistrationComplete(); |