diff options
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/oauth2_api_call_flow.cc | 16 | ||||
-rw-r--r-- | google_apis/gaia/oauth2_api_call_flow.h | 9 |
2 files changed, 23 insertions, 2 deletions
diff --git a/google_apis/gaia/oauth2_api_call_flow.cc b/google_apis/gaia/oauth2_api_call_flow.cc index a6a267c..ee0643f 100644 --- a/google_apis/gaia/oauth2_api_call_flow.cc +++ b/google_apis/gaia/oauth2_api_call_flow.cc @@ -41,6 +41,9 @@ OAuth2ApiCallFlow::OAuth2ApiCallFlow( refresh_token_(refresh_token), access_token_(access_token), scopes_(scopes), + chrome_client_id_(GaiaUrls::GetInstance()->oauth2_chrome_client_id()), + chrome_client_secret_( + GaiaUrls::GetInstance()->oauth2_chrome_client_secret()), state_(INITIAL), tried_mint_access_token_(false) { } @@ -51,6 +54,15 @@ void OAuth2ApiCallFlow::Start() { BeginApiCall(); } +#if defined(OS_CHROMEOS) +void OAuth2ApiCallFlow::SetChromeOAuthClientInfo( + const std::string& chrome_client_id, + const std::string& chrome_client_secret) { + chrome_client_id_ = chrome_client_id; + chrome_client_secret_ = chrome_client_secret; +} +#endif + void OAuth2ApiCallFlow::BeginApiCall() { CHECK(state_ == INITIAL || state_ == MINT_ACCESS_TOKEN_DONE); @@ -106,8 +118,8 @@ void OAuth2ApiCallFlow::BeginMintAccessToken() { oauth2_access_token_fetcher_.reset(CreateAccessTokenFetcher()); oauth2_access_token_fetcher_->Start( - GaiaUrls::GetInstance()->oauth2_chrome_client_id(), - GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), + chrome_client_id_, + chrome_client_secret_, refresh_token_, scopes_); } diff --git a/google_apis/gaia/oauth2_api_call_flow.h b/google_apis/gaia/oauth2_api_call_flow.h index fccd1e7..fa7dd5c 100644 --- a/google_apis/gaia/oauth2_api_call_flow.h +++ b/google_apis/gaia/oauth2_api_call_flow.h @@ -50,6 +50,11 @@ class OAuth2ApiCallFlow // Start the flow. virtual void Start(); +#if defined(OS_CHROMEOS) + void SetChromeOAuthClientInfo(const std::string& chrome_client_id, + const std::string& chrome_client_secret); +#endif + // OAuth2AccessTokenFetcher implementation. virtual void OnGetTokenSuccess(const std::string& access_token, const base::Time& expiration_time) OVERRIDE; @@ -113,6 +118,10 @@ class OAuth2ApiCallFlow std::string access_token_; std::vector<std::string> scopes_; + // Override values for the main chrome client id and secret. + std::string chrome_client_id_; + std::string chrome_client_secret_; + State state_; // Whether we have already tried minting an access token once. bool tried_mint_access_token_; |