| 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_BASE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 typedef base::Callback<void(bool)> PolicyFetchCallback; | 62 typedef base::Callback<void(bool)> PolicyFetchCallback; |
| 63 | 63 |
| 64 // Creates a UserPolicySigninServiceBase associated with the passed |profile|. | 64 // Creates a UserPolicySigninServiceBase associated with the passed |profile|. |
| 65 UserPolicySigninServiceBase( | 65 UserPolicySigninServiceBase( |
| 66 Profile* profile, | 66 Profile* profile, |
| 67 PrefService* local_state, | 67 PrefService* local_state, |
| 68 DeviceManagementService* device_management_service, | 68 DeviceManagementService* device_management_service, |
| 69 UserCloudPolicyManager* policy_manager, | 69 UserCloudPolicyManager* policy_manager, |
| 70 SigninManager* signin_manager, | 70 SigninManager* signin_manager, |
| 71 scoped_refptr<net::URLRequestContextGetter> system_request_context); | 71 scoped_refptr<net::URLRequestContextGetter> system_request_context); |
| 72 virtual ~UserPolicySigninServiceBase(); | 72 ~UserPolicySigninServiceBase() override; |
| 73 | 73 |
| 74 // Initiates a policy fetch as part of user signin, using a |dm_token| and | 74 // Initiates a policy fetch as part of user signin, using a |dm_token| and |
| 75 // |client_id| fetched via RegisterForPolicy(). |callback| is invoked | 75 // |client_id| fetched via RegisterForPolicy(). |callback| is invoked |
| 76 // once the policy fetch is complete, passing true if the policy fetch | 76 // once the policy fetch is complete, passing true if the policy fetch |
| 77 // succeeded. | 77 // succeeded. |
| 78 void FetchPolicyForSignedInUser( | 78 void FetchPolicyForSignedInUser( |
| 79 const std::string& username, | 79 const std::string& username, |
| 80 const std::string& dm_token, | 80 const std::string& dm_token, |
| 81 const std::string& client_id, | 81 const std::string& client_id, |
| 82 scoped_refptr<net::URLRequestContextGetter> profile_request_context, | 82 scoped_refptr<net::URLRequestContextGetter> profile_request_context, |
| 83 const PolicyFetchCallback& callback); | 83 const PolicyFetchCallback& callback); |
| 84 | 84 |
| 85 // SigninManagerBase::Observer implementation: | 85 // SigninManagerBase::Observer implementation: |
| 86 virtual void GoogleSignedOut(const std::string& account_id, | 86 void GoogleSignedOut(const std::string& account_id, |
| 87 const std::string& username) override; | 87 const std::string& username) override; |
| 88 | 88 |
| 89 // content::NotificationObserver implementation: | 89 // content::NotificationObserver implementation: |
| 90 virtual void Observe(int type, | 90 void Observe(int type, |
| 91 const content::NotificationSource& source, | 91 const content::NotificationSource& source, |
| 92 const content::NotificationDetails& details) override; | 92 const content::NotificationDetails& details) override; |
| 93 | 93 |
| 94 // CloudPolicyService::Observer implementation: | 94 // CloudPolicyService::Observer implementation: |
| 95 virtual void OnInitializationCompleted(CloudPolicyService* service) override; | 95 void OnInitializationCompleted(CloudPolicyService* service) override; |
| 96 | 96 |
| 97 // CloudPolicyClient::Observer implementation: | 97 // CloudPolicyClient::Observer implementation: |
| 98 virtual void OnPolicyFetched(CloudPolicyClient* client) override; | 98 void OnPolicyFetched(CloudPolicyClient* client) override; |
| 99 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) override; | 99 void OnRegistrationStateChanged(CloudPolicyClient* client) override; |
| 100 virtual void OnClientError(CloudPolicyClient* client) override; | 100 void OnClientError(CloudPolicyClient* client) override; |
| 101 | 101 |
| 102 // KeyedService implementation: | 102 // KeyedService implementation: |
| 103 virtual void Shutdown() override; | 103 void Shutdown() override; |
| 104 | 104 |
| 105 void SetSystemRequestContext( | 105 void SetSystemRequestContext( |
| 106 scoped_refptr<net::URLRequestContextGetter> request_context); | 106 scoped_refptr<net::URLRequestContextGetter> request_context); |
| 107 | 107 |
| 108 protected: | 108 protected: |
| 109 net::URLRequestContextGetter* system_request_context() { | 109 net::URLRequestContextGetter* system_request_context() { |
| 110 return system_request_context_.get(); | 110 return system_request_context_.get(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Returns a CloudPolicyClient to perform a registration with the DM server, | 113 // Returns a CloudPolicyClient to perform a registration with the DM server, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 scoped_refptr<net::URLRequestContextGetter> system_request_context_; | 176 scoped_refptr<net::URLRequestContextGetter> system_request_context_; |
| 177 | 177 |
| 178 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_; | 178 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_; |
| 179 | 179 |
| 180 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase); | 180 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase); |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 } // namespace policy | 183 } // namespace policy |
| 184 | 184 |
| 185 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ | 185 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
| OLD | NEW |