Index: chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h |
diff --git a/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h b/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h |
index 330cfbdb22c1914d55dcf7c139b33da3aa1b19f8..9dfc4317c088f0c3a133507ae3e0ef5557c4236f 100644 |
--- a/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h |
+++ b/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h |
@@ -16,6 +16,7 @@ |
#include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" |
class AndroidProfileOAuth2TokenService; |
+class OAuth2TokenService; |
namespace net { |
class URLRequestContextGetter; |
@@ -40,15 +41,23 @@ class CloudPolicyClientRegistrationHelper : public UserInfoFetcher::Delegate, |
enterprise_management::DeviceRegisterRequest::Type registration_type); |
virtual ~CloudPolicyClientRegistrationHelper(); |
-#if defined(OS_ANDROID) |
// Starts the client registration process. This version uses the |
- // AndroidProfileOAuth2TokenService to mint the new token for the userinfo |
+ // supplied OAuth2TokenService to mint the new token for the userinfo |
// and DM services, using the |username| account. |
// |callback| is invoked when the registration is complete. |
- void StartRegistration(AndroidProfileOAuth2TokenService* token_service, |
- const std::string& username, |
- const base::Closure& callback); |
+ void StartRegistration( |
+#if defined(OS_ANDROID) |
+ // TODO(atwilson): Remove this when the Android StartRequestForUsername() |
+ // API is folded into the base OAuth2TokenService class (when that class |
+ // is made multi-account aware). |
+ AndroidProfileOAuth2TokenService* token_service, |
#else |
+ OAuth2TokenService* token_service, |
+#endif |
+ const std::string& username, |
+ const base::Closure& callback); |
+ |
+#if !defined(OS_ANDROID) |
// Starts the client registration process. The |login_refresh_token| is used |
// to mint a new token for the userinfo and DM services. |
// |callback| is invoked when the registration is complete. |
@@ -56,13 +65,9 @@ class CloudPolicyClientRegistrationHelper : public UserInfoFetcher::Delegate, |
const base::Closure& callback); |
#endif |
- private: |
-#if defined(OS_ANDROID) |
- class TokenHelperAndroid; |
-#else |
class TokenHelper; |
-#endif |
+ private: |
void OnTokenFetched(const std::string& oauth_access_token); |
// UserInfoFetcher::Delegate implementation: |
@@ -79,14 +84,11 @@ class CloudPolicyClientRegistrationHelper : public UserInfoFetcher::Delegate, |
// Invoked when the registration request has been completed. |
void RequestCompleted(); |
- // Internal helper used to fetch the access token. There is an OS_ANDROID |
- // implementation which uses the AccountManager and a known account name, |
- // and a desktop implementation which uses an OAuth2AccessTokenFetcher. |
-#if defined(OS_ANDROID) |
- scoped_ptr<TokenHelperAndroid> token_helper_; |
-#else |
+ // Internal helper used to fetch the access token. There are two |
+ // implementations on desktop - one that uses a supplied login token for use |
+ // when there is no signed-in user, and one that uses OAuth2TokenService |
+ // (Android always uses OAuth2TokenService). |
scoped_ptr<TokenHelper> token_helper_; |
-#endif |
// Helper class for fetching information from GAIA about the currently |
// signed-in user. |