| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" | 15 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" |
| 16 | 16 |
| 17 class AndroidProfileOAuth2TokenService; | 17 class ProfileOAuth2TokenService; |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace policy { | 24 namespace policy { |
| 25 | 25 |
| 26 class CloudPolicyClientRegistrationHelper; | 26 class CloudPolicyClientRegistrationHelper; |
| 27 | 27 |
| 28 // A specialization of the UserPolicySigninServiceBase for Android. | 28 // A specialization of the UserPolicySigninServiceBase for Android. |
| 29 class UserPolicySigninService : public UserPolicySigninServiceBase { | 29 class UserPolicySigninService : public UserPolicySigninServiceBase { |
| 30 public: | 30 public: |
| 31 // Creates a UserPolicySigninService associated with the passed |profile|. | 31 // Creates a UserPolicySigninService associated with the passed |profile|. |
| 32 UserPolicySigninService( | 32 UserPolicySigninService( |
| 33 Profile* profile, | 33 Profile* profile, |
| 34 PrefService* local_state, | 34 PrefService* local_state, |
| 35 scoped_refptr<net::URLRequestContextGetter> request_context, | 35 scoped_refptr<net::URLRequestContextGetter> request_context, |
| 36 DeviceManagementService* device_management_service, | 36 DeviceManagementService* device_management_service, |
| 37 AndroidProfileOAuth2TokenService* token_service); | 37 ProfileOAuth2TokenService* token_service); |
| 38 virtual ~UserPolicySigninService(); | 38 virtual ~UserPolicySigninService(); |
| 39 | 39 |
| 40 // Registers a CloudPolicyClient for fetching policy for |username|. | 40 // Registers a CloudPolicyClient for fetching policy for |username|. |
| 41 // This requests an OAuth2 token for the services involved, and contacts | 41 // This requests an OAuth2 token for the services involved, and contacts |
| 42 // the policy service if the account has management enabled. | 42 // the policy service if the account has management enabled. |
| 43 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy, | 43 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy, |
| 44 // or once it is determined that |username| is not a managed account. | 44 // or once it is determined that |username| is not a managed account. |
| 45 void RegisterPolicyClient(const std::string& username, | 45 void RegisterPolicyClient(const std::string& username, |
| 46 const PolicyRegistrationCallback& callback); | 46 const PolicyRegistrationCallback& callback); |
| 47 | 47 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 // Cancels a pending cloud policy registration attempt. | 61 // Cancels a pending cloud policy registration attempt. |
| 62 void CancelPendingRegistration(); | 62 void CancelPendingRegistration(); |
| 63 | 63 |
| 64 void OnRegistrationDone(); | 64 void OnRegistrationDone(); |
| 65 | 65 |
| 66 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; | 66 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; |
| 67 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; | 67 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; |
| 68 | 68 |
| 69 // Weak pointer to the token service used to authenticate the | 69 // Weak pointer to the token service used to authenticate the |
| 70 // CloudPolicyClient during registration. | 70 // CloudPolicyClient during registration. |
| 71 AndroidProfileOAuth2TokenService* oauth2_token_service_; | 71 ProfileOAuth2TokenService* oauth2_token_service_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); | 73 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace policy | 76 } // namespace policy |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ | 78 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ |
| OLD | NEW |