OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOBILE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 // Creates a UserPolicySigninService associated with the passed |profile|. | 33 // Creates a UserPolicySigninService associated with the passed |profile|. |
34 UserPolicySigninService( | 34 UserPolicySigninService( |
35 Profile* profile, | 35 Profile* profile, |
36 PrefService* local_state, | 36 PrefService* local_state, |
37 DeviceManagementService* device_management_service, | 37 DeviceManagementService* device_management_service, |
38 UserCloudPolicyManager* policy_manager, | 38 UserCloudPolicyManager* policy_manager, |
39 SigninManager* signin_manager, | 39 SigninManager* signin_manager, |
40 scoped_refptr<net::URLRequestContextGetter> system_request_context, | 40 scoped_refptr<net::URLRequestContextGetter> system_request_context, |
41 ProfileOAuth2TokenService* token_service); | 41 ProfileOAuth2TokenService* token_service); |
42 virtual ~UserPolicySigninService(); | 42 ~UserPolicySigninService() override; |
43 | 43 |
44 // Registers a CloudPolicyClient for fetching policy for |username|. | 44 // Registers a CloudPolicyClient for fetching policy for |username|. |
45 // This requests an OAuth2 token for the services involved, and contacts | 45 // This requests an OAuth2 token for the services involved, and contacts |
46 // the policy service if the account has management enabled. | 46 // the policy service if the account has management enabled. |
47 // |callback| is invoked once we have registered this device to fetch policy, | 47 // |callback| is invoked once we have registered this device to fetch policy, |
48 // or once it is determined that |username| is not a managed account. | 48 // or once it is determined that |username| is not a managed account. |
49 void RegisterForPolicy(const std::string& username, | 49 void RegisterForPolicy(const std::string& username, |
50 const PolicyRegistrationCallback& callback); | 50 const PolicyRegistrationCallback& callback); |
51 | 51 |
52 #if !defined(OS_ANDROID) | 52 #if !defined(OS_ANDROID) |
(...skipping 14 matching lines...) Expand all Loading... |
67 private: | 67 private: |
68 void RegisterForPolicyInternal( | 68 void RegisterForPolicyInternal( |
69 const std::string& username, | 69 const std::string& username, |
70 const std::string& access_token, | 70 const std::string& access_token, |
71 const PolicyRegistrationCallback& callback); | 71 const PolicyRegistrationCallback& callback); |
72 | 72 |
73 void CallPolicyRegistrationCallback(scoped_ptr<CloudPolicyClient> client, | 73 void CallPolicyRegistrationCallback(scoped_ptr<CloudPolicyClient> client, |
74 PolicyRegistrationCallback callback); | 74 PolicyRegistrationCallback callback); |
75 | 75 |
76 // KeyedService implementation: | 76 // KeyedService implementation: |
77 virtual void Shutdown() override; | 77 void Shutdown() override; |
78 | 78 |
79 // CloudPolicyService::Observer implementation: | 79 // CloudPolicyService::Observer implementation: |
80 virtual void OnInitializationCompleted(CloudPolicyService* service) override; | 80 void OnInitializationCompleted(CloudPolicyService* service) override; |
81 | 81 |
82 // Overridden from UserPolicySigninServiceBase to cancel the pending delayed | 82 // Overridden from UserPolicySigninServiceBase to cancel the pending delayed |
83 // registration. | 83 // registration. |
84 virtual void ShutdownUserCloudPolicyManager() override; | 84 void ShutdownUserCloudPolicyManager() override; |
85 | 85 |
86 // Registers for cloud policy for an already signed-in user. | 86 // Registers for cloud policy for an already signed-in user. |
87 void RegisterCloudPolicyService(); | 87 void RegisterCloudPolicyService(); |
88 | 88 |
89 // Cancels a pending cloud policy registration attempt. | 89 // Cancels a pending cloud policy registration attempt. |
90 void CancelPendingRegistration(); | 90 void CancelPendingRegistration(); |
91 | 91 |
92 void OnRegistrationDone(); | 92 void OnRegistrationDone(); |
93 | 93 |
94 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; | 94 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; |
95 | 95 |
96 // Weak pointer to the token service used to authenticate the | 96 // Weak pointer to the token service used to authenticate the |
97 // CloudPolicyClient during registration. | 97 // CloudPolicyClient during registration. |
98 ProfileOAuth2TokenService* oauth2_token_service_; | 98 ProfileOAuth2TokenService* oauth2_token_service_; |
99 | 99 |
100 // The PrefService associated with the profile. | 100 // The PrefService associated with the profile. |
101 PrefService* profile_prefs_; | 101 PrefService* profile_prefs_; |
102 | 102 |
103 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; | 103 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); | 105 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace policy | 108 } // namespace policy |
109 | 109 |
110 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_ | 110 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_ |
OLD | NEW |