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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 message_value->IsType(Value::TYPE_DICTIONARY)) { | 195 message_value->IsType(Value::TYPE_DICTIONARY)) { |
196 response_dict.reset( | 196 response_dict.reset( |
197 static_cast<DictionaryValue*>(message_value.release())); | 197 static_cast<DictionaryValue*>(message_value.release())); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 if (!response_dict.get()) { | 201 if (!response_dict.get()) { |
202 // If we don't have an access token yet and the the error was not | 202 // If we don't have an access token yet and the the error was not |
203 // RC_BAD_REQUEST, we may need to retry. | 203 // RC_BAD_REQUEST, we may need to retry. |
204 if ((source->GetMaxRetriesOn5xx() != -1) && | 204 if ((source->GetMaxRetriesOn5xx() != -1) && |
205 (num_retries_ > source->GetMaxRetriesOn5xx())) { | 205 (num_retries_ >= source->GetMaxRetriesOn5xx())) { |
206 // Retry limit reached. Give up. | 206 // Retry limit reached. Give up. |
207 delegate_->OnNetworkError(source->GetResponseCode()); | 207 delegate_->OnNetworkError(source->GetResponseCode()); |
208 } else { | 208 } else { |
209 request_ = old_request.Pass(); | 209 request_ = old_request.Pass(); |
210 *should_retry_request = true; | 210 *should_retry_request = true; |
211 } | 211 } |
212 return; | 212 return; |
213 } | 213 } |
214 | 214 |
215 RequestType type = request_type_; | 215 RequestType type = request_type_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 delegate); | 281 delegate); |
282 } | 282 } |
283 | 283 |
284 void GaiaOAuthClient::GetUserInfo(const std::string& access_token, | 284 void GaiaOAuthClient::GetUserInfo(const std::string& access_token, |
285 int max_retries, | 285 int max_retries, |
286 Delegate* delegate) { | 286 Delegate* delegate) { |
287 return core_->GetUserInfo(access_token, max_retries, delegate); | 287 return core_->GetUserInfo(access_token, max_retries, delegate); |
288 } | 288 } |
289 | 289 |
290 } // namespace gaia | 290 } // namespace gaia |
OLD | NEW |