Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1463)

Side by Side Diff: google_apis/gaia/gaia_oauth_client.cc

Issue 2620373003: Reset pending request type on network error (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | google_apis/gaia/gaia_oauth_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "google_apis/gaia/gaia_oauth_client.h" 5 #include "google_apis/gaia/gaia_oauth_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 static_cast<base::DictionaryValue*>(message_value.release())); 276 static_cast<base::DictionaryValue*>(message_value.release()));
277 } 277 }
278 } 278 }
279 279
280 if (!response_dict.get()) { 280 if (!response_dict.get()) {
281 // If we don't have an access token yet and the the error was not 281 // If we don't have an access token yet and the the error was not
282 // RC_BAD_REQUEST, we may need to retry. 282 // RC_BAD_REQUEST, we may need to retry.
283 if ((source->GetMaxRetriesOn5xx() != -1) && 283 if ((source->GetMaxRetriesOn5xx() != -1) &&
284 (num_retries_ >= source->GetMaxRetriesOn5xx())) { 284 (num_retries_ >= source->GetMaxRetriesOn5xx())) {
285 // Retry limit reached. Give up. 285 // Retry limit reached. Give up.
286 request_type_ = NO_PENDING_REQUEST;
286 delegate_->OnNetworkError(source->GetResponseCode()); 287 delegate_->OnNetworkError(source->GetResponseCode());
287 } else { 288 } else {
288 request_ = std::move(old_request); 289 request_ = std::move(old_request);
289 *should_retry_request = true; 290 *should_retry_request = true;
290 } 291 }
291 return; 292 return;
292 } 293 }
293 294
294 RequestType type = request_type_; 295 RequestType type = request_type_;
295 request_type_ = NO_PENDING_REQUEST; 296 request_type_ = NO_PENDING_REQUEST;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 406 }
406 407
407 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, 408 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle,
408 int max_retries, 409 int max_retries,
409 Delegate* delegate) { 410 Delegate* delegate) {
410 return core_->GetTokenInfo("token_handle", token_handle, max_retries, 411 return core_->GetTokenInfo("token_handle", token_handle, max_retries,
411 delegate); 412 delegate);
412 } 413 }
413 414
414 } // namespace gaia 415 } // namespace gaia
OLDNEW
« no previous file with comments | « no previous file | google_apis/gaia/gaia_oauth_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698