| OLD | NEW |
| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 delegate_->OnOAuthError(); | 264 delegate_->OnOAuthError(); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 std::unique_ptr<base::DictionaryValue> response_dict; | 268 std::unique_ptr<base::DictionaryValue> response_dict; |
| 269 if (source->GetResponseCode() == net::HTTP_OK) { | 269 if (source->GetResponseCode() == net::HTTP_OK) { |
| 270 std::string data; | 270 std::string data; |
| 271 source->GetResponseAsString(&data); | 271 source->GetResponseAsString(&data); |
| 272 std::unique_ptr<base::Value> message_value = base::JSONReader::Read(data); | 272 std::unique_ptr<base::Value> message_value = base::JSONReader::Read(data); |
| 273 if (message_value.get() && | 273 if (message_value.get() && |
| 274 message_value->IsType(base::Value::TYPE_DICTIONARY)) { | 274 message_value->IsType(base::Value::Type::DICTIONARY)) { |
| 275 response_dict.reset( | 275 response_dict.reset( |
| 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())) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 405 } |
| 406 | 406 |
| 407 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, | 407 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, |
| 408 int max_retries, | 408 int max_retries, |
| 409 Delegate* delegate) { | 409 Delegate* delegate) { |
| 410 return core_->GetTokenInfo("token_handle", token_handle, max_retries, | 410 return core_->GetTokenInfo("token_handle", token_handle, max_retries, |
| 411 delegate); | 411 delegate); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace gaia | 414 } // namespace gaia |
| OLD | NEW |