| 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/oauth2_access_token_fetcher.h" | 5 #include "google_apis/gaia/oauth2_access_token_fetcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 std::string* access_token, | 219 std::string* access_token, |
| 220 int* expires_in) { | 220 int* expires_in) { |
| 221 CHECK(source); | 221 CHECK(source); |
| 222 CHECK(access_token); | 222 CHECK(access_token); |
| 223 std::string data; | 223 std::string data; |
| 224 source->GetResponseAsString(&data); | 224 source->GetResponseAsString(&data); |
| 225 scoped_ptr<base::Value> value(base::JSONReader::Read(data)); | 225 scoped_ptr<base::Value> value(base::JSONReader::Read(data)); |
| 226 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) | 226 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) |
| 227 return false; | 227 return false; |
| 228 | 228 |
| 229 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); | 229 base::DictionaryValue* dict = |
| 230 static_cast<base::DictionaryValue*>(value.get()); |
| 230 return dict->GetString(kAccessTokenKey, access_token) && | 231 return dict->GetString(kAccessTokenKey, access_token) && |
| 231 dict->GetInteger(kExpiresInKey, expires_in); | 232 dict->GetInteger(kExpiresInKey, expires_in); |
| 232 } | 233 } |
| OLD | NEW |