| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/oauth2_access_token_fetcher_impl.h" | 5 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return result; | 113 return result; |
| 114 } | 114 } |
| 115 | 115 |
| 116 std::unique_ptr<base::DictionaryValue> ParseGetAccessTokenResponse( | 116 std::unique_ptr<base::DictionaryValue> ParseGetAccessTokenResponse( |
| 117 const net::URLFetcher* source) { | 117 const net::URLFetcher* source) { |
| 118 CHECK(source); | 118 CHECK(source); |
| 119 | 119 |
| 120 std::string data; | 120 std::string data; |
| 121 source->GetResponseAsString(&data); | 121 source->GetResponseAsString(&data); |
| 122 std::unique_ptr<base::Value> value = base::JSONReader::Read(data); | 122 std::unique_ptr<base::Value> value = base::JSONReader::Read(data); |
| 123 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) | 123 if (!value.get() || value->GetType() != base::Value::Type::DICTIONARY) |
| 124 value.reset(); | 124 value.reset(); |
| 125 | 125 |
| 126 return std::unique_ptr<base::DictionaryValue>( | 126 return std::unique_ptr<base::DictionaryValue>( |
| 127 static_cast<base::DictionaryValue*>(value.release())); | 127 static_cast<base::DictionaryValue*>(value.release())); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| 131 | 131 |
| 132 OAuth2AccessTokenFetcherImpl::OAuth2AccessTokenFetcherImpl( | 132 OAuth2AccessTokenFetcherImpl::OAuth2AccessTokenFetcherImpl( |
| 133 OAuth2AccessTokenConsumer* consumer, | 133 OAuth2AccessTokenConsumer* consumer, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( | 312 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( |
| 313 const net::URLFetcher* source, | 313 const net::URLFetcher* source, |
| 314 std::string* error) { | 314 std::string* error) { |
| 315 CHECK(error); | 315 CHECK(error); |
| 316 std::unique_ptr<base::DictionaryValue> value = | 316 std::unique_ptr<base::DictionaryValue> value = |
| 317 ParseGetAccessTokenResponse(source); | 317 ParseGetAccessTokenResponse(source); |
| 318 if (value.get() == NULL) | 318 if (value.get() == NULL) |
| 319 return false; | 319 return false; |
| 320 return value->GetString(kErrorKey, error); | 320 return value->GetString(kErrorKey, error); |
| 321 } | 321 } |
| OLD | NEW |