| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Creates a UserPolicySigninService associated with the passed | 33 // Creates a UserPolicySigninService associated with the passed |
| 34 // |policy_manager| and |signin_manager|. | 34 // |policy_manager| and |signin_manager|. |
| 35 UserPolicySigninService( | 35 UserPolicySigninService( |
| 36 Profile* profile, | 36 Profile* profile, |
| 37 PrefService* local_state, | 37 PrefService* local_state, |
| 38 DeviceManagementService* device_management_service, | 38 DeviceManagementService* device_management_service, |
| 39 UserCloudPolicyManager* policy_manager, | 39 UserCloudPolicyManager* policy_manager, |
| 40 SigninManager* signin_manager, | 40 SigninManager* signin_manager, |
| 41 scoped_refptr<net::URLRequestContextGetter> system_request_context, | 41 scoped_refptr<net::URLRequestContextGetter> system_request_context, |
| 42 ProfileOAuth2TokenService* oauth2_token_service); | 42 ProfileOAuth2TokenService* oauth2_token_service); |
| 43 virtual ~UserPolicySigninService(); | 43 ~UserPolicySigninService() override; |
| 44 | 44 |
| 45 // Registers a CloudPolicyClient for fetching policy for a user. The | 45 // Registers a CloudPolicyClient for fetching policy for a user. The |
| 46 // |oauth2_login_token| and |username| are explicitly passed because | 46 // |oauth2_login_token| and |username| are explicitly passed because |
| 47 // the user is not signed in yet (ProfileOAuth2TokenService does not have | 47 // the user is not signed in yet (ProfileOAuth2TokenService does not have |
| 48 // any tokens yet to prevent services from using it until after we've fetched | 48 // any tokens yet to prevent services from using it until after we've fetched |
| 49 // policy). | 49 // policy). |
| 50 void RegisterForPolicy(const std::string& username, | 50 void RegisterForPolicy(const std::string& username, |
| 51 const std::string& oauth2_login_token, | 51 const std::string& oauth2_login_token, |
| 52 const PolicyRegistrationCallback& callback); | 52 const PolicyRegistrationCallback& callback); |
| 53 | 53 |
| 54 // OAuth2TokenService::Observer implementation: | 54 // OAuth2TokenService::Observer implementation: |
| 55 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; | 55 void OnRefreshTokenAvailable(const std::string& account_id) override; |
| 56 | 56 |
| 57 // CloudPolicyService::Observer implementation: | 57 // CloudPolicyService::Observer implementation: |
| 58 virtual void OnInitializationCompleted(CloudPolicyService* service) override; | 58 void OnInitializationCompleted(CloudPolicyService* service) override; |
| 59 | 59 |
| 60 // KeyedService implementation: | 60 // KeyedService implementation: |
| 61 virtual void Shutdown() override; | 61 void Shutdown() override; |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 // UserPolicySigninServiceBase implementation: | 64 // UserPolicySigninServiceBase implementation: |
| 65 virtual void InitializeUserCloudPolicyManager( | 65 void InitializeUserCloudPolicyManager( |
| 66 const std::string& username, | 66 const std::string& username, |
| 67 scoped_ptr<CloudPolicyClient> client) override; | 67 scoped_ptr<CloudPolicyClient> client) override; |
| 68 | 68 |
| 69 virtual void PrepareForUserCloudPolicyManagerShutdown() override; | 69 void PrepareForUserCloudPolicyManagerShutdown() override; |
| 70 virtual void ShutdownUserCloudPolicyManager() override; | 70 void ShutdownUserCloudPolicyManager() override; |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // Fetches an OAuth token to allow the cloud policy service to register with | 73 // Fetches an OAuth token to allow the cloud policy service to register with |
| 74 // the cloud policy server. |oauth_login_token| should contain an OAuth login | 74 // the cloud policy server. |oauth_login_token| should contain an OAuth login |
| 75 // refresh token that can be downscoped to get an access token for the | 75 // refresh token that can be downscoped to get an access token for the |
| 76 // device_management service. | 76 // device_management service. |
| 77 void RegisterCloudPolicyService(); | 77 void RegisterCloudPolicyService(); |
| 78 | 78 |
| 79 // Callback invoked when policy registration has finished. | 79 // Callback invoked when policy registration has finished. |
| 80 void OnRegistrationComplete(); | 80 void OnRegistrationComplete(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 // Weak pointer to the token service we use to authenticate during | 95 // Weak pointer to the token service we use to authenticate during |
| 96 // CloudPolicyClient registration. | 96 // CloudPolicyClient registration. |
| 97 ProfileOAuth2TokenService* oauth2_token_service_; | 97 ProfileOAuth2TokenService* oauth2_token_service_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); | 99 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace policy | 102 } // namespace policy |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 104 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
| OLD | NEW |