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/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" | 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" |
15 | 15 |
| 16 class AndroidProfileOAuth2TokenService; |
16 class Profile; | 17 class Profile; |
17 | 18 |
18 namespace policy { | 19 namespace policy { |
19 | 20 |
20 class CloudPolicyClientRegistrationHelper; | 21 class CloudPolicyClientRegistrationHelper; |
21 | 22 |
22 // A specialization of the UserPolicySigninServiceBase for Android. | 23 // A specialization of the UserPolicySigninServiceBase for Android. |
23 class UserPolicySigninService : public UserPolicySigninServiceBase { | 24 class UserPolicySigninService : public UserPolicySigninServiceBase { |
24 public: | 25 public: |
25 // Creates a UserPolicySigninService associated with the passed |profile|. | 26 // Creates a UserPolicySigninService associated with the passed |profile|. |
26 UserPolicySigninService(Profile* profile, | 27 UserPolicySigninService(Profile* profile, |
27 PrefService* local_state, | 28 PrefService* local_state, |
28 DeviceManagementService* device_management_service); | 29 DeviceManagementService* device_management_service, |
| 30 AndroidProfileOAuth2TokenService* token_service); |
29 virtual ~UserPolicySigninService(); | 31 virtual ~UserPolicySigninService(); |
30 | 32 |
31 // Registers a CloudPolicyClient for fetching policy for |username|. | 33 // Registers a CloudPolicyClient for fetching policy for |username|. |
32 // This requests an OAuth2 token for the services involved, and contacts | 34 // This requests an OAuth2 token for the services involved, and contacts |
33 // the policy service if the account has management enabled. | 35 // the policy service if the account has management enabled. |
34 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy, | 36 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy, |
35 // or once it is determined that |username| is not a managed account. | 37 // or once it is determined that |username| is not a managed account. |
36 void RegisterPolicyClient(const std::string& username, | 38 void RegisterPolicyClient(const std::string& username, |
37 const PolicyRegistrationCallback& callback); | 39 const PolicyRegistrationCallback& callback); |
38 | 40 |
(...skipping 11 matching lines...) Expand all Loading... |
50 void RegisterCloudPolicyService(); | 52 void RegisterCloudPolicyService(); |
51 | 53 |
52 // Cancels a pending cloud policy registration attempt. | 54 // Cancels a pending cloud policy registration attempt. |
53 void CancelPendingRegistration(); | 55 void CancelPendingRegistration(); |
54 | 56 |
55 void OnRegistrationDone(); | 57 void OnRegistrationDone(); |
56 | 58 |
57 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; | 59 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; |
58 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; | 60 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; |
59 | 61 |
| 62 // Weak pointer to the token service used to authenticate the |
| 63 // CloudPolicyClient during registration. |
| 64 AndroidProfileOAuth2TokenService* oauth2_token_service_; |
| 65 |
60 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); | 66 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); |
61 }; | 67 }; |
62 | 68 |
63 } // namespace policy | 69 } // namespace policy |
64 | 70 |
65 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ | 71 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ |
OLD | NEW |