| 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..fccb98090de223f87843da7ad0dc9dc55b6ab41c 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/profile_oauth2_token_service.h"
|
|
|
| class Profile;
|
|
|
| @@ -20,26 +21,27 @@ 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,
|
| PrefService* local_state,
|
| - DeviceManagementService* device_management_service);
|
| + DeviceManagementService* device_management_service,
|
| + ProfileOAuth2TokenService* oauth2_token_service);
|
| virtual ~UserPolicySigninService();
|
|
|
| // 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 +49,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 +62,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();
|
| @@ -72,6 +77,10 @@ class UserPolicySigninService : public UserPolicySigninServiceBase {
|
|
|
| scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_;
|
|
|
| + // Weak pointer to the token service we use to authenticate during
|
| + // CloudPolicyClient registration.
|
| + ProfileOAuth2TokenService* oauth2_token_service_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService);
|
| };
|
|
|
|
|