| 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/oauth_request_signer.h" | 5 #include "google_apis/gaia/oauth_request_signer.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 #include <cstring> | 10 #include <cstring> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 case OAuthRequestSigner::PLAINTEXT_SIGNATURE: | 72 case OAuthRequestSigner::PLAINTEXT_SIGNATURE: |
| 73 return "PLAINTEXT"; | 73 return "PLAINTEXT"; |
| 74 } | 74 } |
| 75 NOTREACHED(); | 75 NOTREACHED(); |
| 76 return std::string(); | 76 return std::string(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 std::string BuildBaseString(const GURL& request_base_url, | 79 std::string BuildBaseString(const GURL& request_base_url, |
| 80 OAuthRequestSigner::HttpMethod http_method, | 80 OAuthRequestSigner::HttpMethod http_method, |
| 81 const std::string& base_parameters) { | 81 const std::string& base_parameters) { |
| 82 return StringPrintf("%s&%s&%s", | 82 return base::StringPrintf("%s&%s&%s", |
| 83 HttpMethodName(http_method).c_str(), | 83 HttpMethodName(http_method).c_str(), |
| 84 OAuthRequestSigner::Encode( | 84 OAuthRequestSigner::Encode( |
| 85 request_base_url.spec()).c_str(), | 85 request_base_url.spec()).c_str(), |
| 86 OAuthRequestSigner::Encode( | 86 OAuthRequestSigner::Encode( |
| 87 base_parameters).c_str()); | 87 base_parameters).c_str()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::string BuildBaseStringParameters( | 90 std::string BuildBaseStringParameters( |
| 91 const OAuthRequestSigner::Parameters& parameters) { | 91 const OAuthRequestSigner::Parameters& parameters) { |
| 92 std::string result = ""; | 92 std::string result = ""; |
| 93 OAuthRequestSigner::Parameters::const_iterator cursor; | 93 OAuthRequestSigner::Parameters::const_iterator cursor; |
| 94 OAuthRequestSigner::Parameters::const_iterator limit; | 94 OAuthRequestSigner::Parameters::const_iterator limit; |
| 95 bool first = true; | 95 bool first = true; |
| 96 for (cursor = parameters.begin(), limit = parameters.end(); | 96 for (cursor = parameters.begin(), limit = parameters.end(); |
| 97 cursor != limit; | 97 cursor != limit; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 std::string signed_text = "OAuth "; | 441 std::string signed_text = "OAuth "; |
| 442 bool first = true; | 442 bool first = true; |
| 443 for (Parameters::const_iterator param = parameters.begin(); | 443 for (Parameters::const_iterator param = parameters.begin(); |
| 444 param != parameters.end(); | 444 param != parameters.end(); |
| 445 ++param) { | 445 ++param) { |
| 446 if (first) | 446 if (first) |
| 447 first = false; | 447 first = false; |
| 448 else | 448 else |
| 449 signed_text += ", "; | 449 signed_text += ", "; |
| 450 signed_text += | 450 signed_text += |
| 451 StringPrintf("%s=\"%s\"", | 451 base::StringPrintf( |
| 452 OAuthRequestSigner::Encode(param->first).c_str(), | 452 "%s=\"%s\"", |
| 453 OAuthRequestSigner::Encode(param->second).c_str()); | 453 OAuthRequestSigner::Encode(param->first).c_str(), |
| 454 OAuthRequestSigner::Encode(param->second).c_str()); |
| 454 } | 455 } |
| 455 *signed_text_return = signed_text; | 456 *signed_text_return = signed_text; |
| 456 } | 457 } |
| 457 return is_signed; | 458 return is_signed; |
| 458 } | 459 } |
| OLD | NEW |