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 "chrome/common/net/gaia/oauth2_revocation_fetcher.h" | 5 #include "chrome/common/net/gaia/oauth2_revocation_fetcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/common/net/gaia/gaia_urls.h" | 15 #include "chrome/common/net/gaia/gaia_urls.h" |
16 #include "chrome/common/net/gaia/google_service_auth_error.h" | 16 #include "chrome/common/net/gaia/google_service_auth_error.h" |
17 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
18 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
19 #include "net/http/http_status_code.h" | 19 #include "net/http/http_status_code.h" |
20 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
21 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
22 | 22 |
23 using content::URLFetcher; | 23 using content::URLFetcher; |
24 using content::URLFetcherDelegate; | 24 using net::URLFetcherDelegate; |
25 using net::ResponseCookies; | 25 using net::ResponseCookies; |
26 using net::URLRequestContextGetter; | 26 using net::URLRequestContextGetter; |
27 using net::URLRequestStatus; | 27 using net::URLRequestStatus; |
28 | 28 |
29 namespace { | 29 namespace { |
30 static const char kOAuth2RevokeTokenURL[] = | 30 static const char kOAuth2RevokeTokenURL[] = |
31 "https://www.googleapis.com/oauth2/v2/RevokeToken"; | 31 "https://www.googleapis.com/oauth2/v2/RevokeToken"; |
32 | 32 |
33 static const char kAuthorizationHeaderFormat[] = | 33 static const char kAuthorizationHeaderFormat[] = |
34 "Authorization: Bearer %s"; | 34 "Authorization: Bearer %s"; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 std::string OAuth2RevocationFetcher::MakeRevocationBody( | 155 std::string OAuth2RevocationFetcher::MakeRevocationBody( |
156 const std::string& client_id, | 156 const std::string& client_id, |
157 const std::string& origin) { | 157 const std::string& origin) { |
158 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true); | 158 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true); |
159 std::string enc_origin = net::EscapeUrlEncodedData(origin, true); | 159 std::string enc_origin = net::EscapeUrlEncodedData(origin, true); |
160 return StringPrintf( | 160 return StringPrintf( |
161 kRevocationBodyFormat, | 161 kRevocationBodyFormat, |
162 enc_client_id.c_str(), | 162 enc_client_id.c_str(), |
163 enc_origin.c_str()); | 163 enc_origin.c_str()); |
164 } | 164 } |
OLD | NEW |