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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 std::string enc_client_secret = | 276 std::string enc_client_secret = |
277 net::EscapeUrlEncodedData(client_secret, true); | 277 net::EscapeUrlEncodedData(client_secret, true); |
278 std::string enc_refresh_token = | 278 std::string enc_refresh_token = |
279 net::EscapeUrlEncodedData(refresh_token, true); | 279 net::EscapeUrlEncodedData(refresh_token, true); |
280 if (scopes.empty()) { | 280 if (scopes.empty()) { |
281 return base::StringPrintf(kGetAccessTokenBodyFormat, | 281 return base::StringPrintf(kGetAccessTokenBodyFormat, |
282 enc_client_id.c_str(), | 282 enc_client_id.c_str(), |
283 enc_client_secret.c_str(), | 283 enc_client_secret.c_str(), |
284 enc_refresh_token.c_str()); | 284 enc_refresh_token.c_str()); |
285 } else { | 285 } else { |
286 std::string scopes_string = JoinString(scopes, ' '); | 286 std::string scopes_string = base::JoinString(scopes, " "); |
287 return base::StringPrintf( | 287 return base::StringPrintf( |
288 kGetAccessTokenBodyWithScopeFormat, | 288 kGetAccessTokenBodyWithScopeFormat, |
289 enc_client_id.c_str(), | 289 enc_client_id.c_str(), |
290 enc_client_secret.c_str(), | 290 enc_client_secret.c_str(), |
291 enc_refresh_token.c_str(), | 291 enc_refresh_token.c_str(), |
292 net::EscapeUrlEncodedData(scopes_string, true).c_str()); | 292 net::EscapeUrlEncodedData(scopes_string, true).c_str()); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 // static | 296 // static |
(...skipping 13 matching lines...) Expand all Loading... |
310 // static | 310 // static |
311 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( | 311 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( |
312 const net::URLFetcher* source, | 312 const net::URLFetcher* source, |
313 std::string* error) { | 313 std::string* error) { |
314 CHECK(error); | 314 CHECK(error); |
315 scoped_ptr<base::DictionaryValue> value = ParseGetAccessTokenResponse(source); | 315 scoped_ptr<base::DictionaryValue> value = ParseGetAccessTokenResponse(source); |
316 if (value.get() == NULL) | 316 if (value.get() == NULL) |
317 return false; | 317 return false; |
318 return value->GetString(kErrorKey, error); | 318 return value->GetString(kErrorKey, error); |
319 } | 319 } |
OLD | NEW |