Index: chrome/common/net/gaia/oauth2_api_call_flow.cc |
=================================================================== |
--- chrome/common/net/gaia/oauth2_api_call_flow.cc (revision 130661) |
+++ chrome/common/net/gaia/oauth2_api_call_flow.cc (working copy) |
@@ -34,7 +34,7 @@ |
tried_mint_access_token_(false) { |
} |
-OAuth2ApiCallFlow::~OAuth2ApiCallFlow() { } |
+OAuth2ApiCallFlow::~OAuth2ApiCallFlow() {} |
void OAuth2ApiCallFlow::Start() { |
BeginApiCall(); |
@@ -46,10 +46,8 @@ |
// If the access token is empty then directly try to mint one. |
if (access_token_.empty()) { |
BeginMintAccessToken(); |
- return; |
} else { |
state_ = API_CALL_STARTED; |
- |
url_fetcher_.reset(CreateURLFetcher()); |
url_fetcher_->Start(); // OnURLFetchComplete will be called. |
} |
@@ -61,6 +59,7 @@ |
URLRequestStatus status = source->GetStatus(); |
if (!status.is_success()) { |
+ state_ = ERROR_STATE; |
ProcessApiCallFailure(source); |
return; |
} |
@@ -69,15 +68,18 @@ |
// expired. So try generating a new access token. |
if (source->GetResponseCode() == net::HTTP_UNAUTHORIZED) { |
// If we already tried minting a new access token, don't do it again. |
- if (tried_mint_access_token_) |
+ if (tried_mint_access_token_) { |
+ state_ = ERROR_STATE; |
ProcessApiCallFailure(source); |
- else |
+ } else { |
BeginMintAccessToken(); |
+ } |
return; |
} |
if (source->GetResponseCode() != net::HTTP_OK) { |
+ state_ = ERROR_STATE; |
ProcessApiCallFailure(source); |
return; |
} |