Index: components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc |
diff --git a/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc b/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc |
index 5c49e18fbc73110ca7f12afa7c4958d4dae119a8..c7b184b033116cf933dd8b1df43413e487c23748 100644 |
--- a/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc |
+++ b/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc |
@@ -4,8 +4,6 @@ |
#include "components/policy/core/common/cloud/cloud_policy_client_registration_helper.h" |
-#include <vector> |
- |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
#include "base/logging.h" |
@@ -24,10 +22,6 @@ |
namespace policy { |
-// OAuth2 scope for the userinfo service. |
-const char kServiceScopeGetUserInfo[] = |
- "https://www.googleapis.com/auth/userinfo.email"; |
- |
// The key under which the hosted-domain value is stored in the UserInfo |
// response. |
const char kGetHostedDomainKey[] = "hd"; |
@@ -77,7 +71,7 @@ void CloudPolicyClientRegistrationHelper::TokenServiceHelper::FetchAccessToken( |
OAuth2TokenService::ScopeSet scopes; |
scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); |
- scopes.insert(kServiceScopeGetUserInfo); |
+ scopes.insert(GaiaConstants::kOAuthWrapBridgeUserInfoScope); |
token_request_ = token_service->StartRequest(account_id, scopes, this); |
} |
@@ -135,14 +129,11 @@ void CloudPolicyClientRegistrationHelper::LoginTokenHelper::FetchAccessToken( |
// userinfo services. |
oauth2_access_token_fetcher_.reset( |
new OAuth2AccessTokenFetcherImpl(this, context, login_refresh_token)); |
- std::vector<std::string> scopes; |
- scopes.push_back(GaiaConstants::kDeviceManagementServiceOAuth); |
- scopes.push_back(kServiceScopeGetUserInfo); |
GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); |
oauth2_access_token_fetcher_->Start( |
gaia_urls->oauth2_chrome_client_id(), |
gaia_urls->oauth2_chrome_client_secret(), |
- scopes); |
+ GetScopes()); |
} |
void CloudPolicyClientRegistrationHelper::LoginTokenHelper::OnGetTokenSuccess( |
@@ -210,6 +201,24 @@ void CloudPolicyClientRegistrationHelper::StartRegistrationWithLoginToken( |
base::Bind(&CloudPolicyClientRegistrationHelper::OnTokenFetched, |
base::Unretained(this))); |
} |
+ |
+void CloudPolicyClientRegistrationHelper::StartRegistrationWithAccessToken( |
+ const std::string& access_token, |
+ const base::Closure& callback) { |
+ DCHECK(!client_->is_registered()); |
+ callback_ = callback; |
+ client_->AddObserver(this); |
+ OnTokenFetched(access_token); |
+} |
+ |
+// static |
+std::vector<std::string> |
+CloudPolicyClientRegistrationHelper::GetScopes() { |
+ std::vector<std::string> scopes; |
+ scopes.push_back(GaiaConstants::kDeviceManagementServiceOAuth); |
+ scopes.push_back(GaiaConstants::kOAuthWrapBridgeUserInfoScope); |
+ return scopes; |
+} |
#endif |
void CloudPolicyClientRegistrationHelper::OnTokenFetched( |