| 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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 request_type_ = REFRESH_TOKEN; | 130 request_type_ = REFRESH_TOKEN; |
| 131 std::string post_body = | 131 std::string post_body = |
| 132 "refresh_token=" + net::EscapeUrlEncodedData(refresh_token, true) + | 132 "refresh_token=" + net::EscapeUrlEncodedData(refresh_token, true) + |
| 133 "&client_id=" + net::EscapeUrlEncodedData(oauth_client_info.client_id, | 133 "&client_id=" + net::EscapeUrlEncodedData(oauth_client_info.client_id, |
| 134 true) + | 134 true) + |
| 135 "&client_secret=" + | 135 "&client_secret=" + |
| 136 net::EscapeUrlEncodedData(oauth_client_info.client_secret, true) + | 136 net::EscapeUrlEncodedData(oauth_client_info.client_secret, true) + |
| 137 "&grant_type=refresh_token"; | 137 "&grant_type=refresh_token"; |
| 138 | 138 |
| 139 if (!scopes.empty()) { | 139 if (!scopes.empty()) { |
| 140 std::string scopes_string = base::JoinString(scopes, " "); | 140 std::string scopes_string = JoinString(scopes, ' '); |
| 141 post_body += "&scope=" + net::EscapeUrlEncodedData(scopes_string, true); | 141 post_body += "&scope=" + net::EscapeUrlEncodedData(scopes_string, true); |
| 142 } | 142 } |
| 143 | 143 |
| 144 MakeGaiaRequest(GURL(GaiaUrls::GetInstance()->oauth2_token_url()), | 144 MakeGaiaRequest(GURL(GaiaUrls::GetInstance()->oauth2_token_url()), |
| 145 post_body, max_retries, delegate); | 145 post_body, max_retries, delegate); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void GaiaOAuthClient::Core::GetUserEmail(const std::string& oauth_access_token, | 148 void GaiaOAuthClient::Core::GetUserEmail(const std::string& oauth_access_token, |
| 149 int max_retries, | 149 int max_retries, |
| 150 Delegate* delegate) { | 150 Delegate* delegate) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 403 } |
| 404 | 404 |
| 405 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, | 405 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, |
| 406 int max_retries, | 406 int max_retries, |
| 407 Delegate* delegate) { | 407 Delegate* delegate) { |
| 408 return core_->GetTokenInfo("token_handle", token_handle, max_retries, | 408 return core_->GetTokenInfo("token_handle", token_handle, max_retries, |
| 409 delegate); | 409 delegate); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace gaia | 412 } // namespace gaia |
| OLD | NEW |