Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/common/net/gaia/oauth2_revocation_fetcher.cc

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/common/content_url_request_user_data.h"
17 #include "net/base/escape.h" 18 #include "net/base/escape.h"
18 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
19 #include "net/http/http_status_code.h" 20 #include "net/http/http_status_code.h"
20 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
21 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
22 23
23 using content::URLFetcher; 24 using content::URLFetcher;
24 using content::URLFetcherDelegate; 25 using content::URLFetcherDelegate;
25 using net::ResponseCookies; 26 using net::ResponseCookies;
26 using net::URLRequestContextGetter; 27 using net::URLRequestContextGetter;
(...skipping 25 matching lines...) Expand all
52 const std::string& header, 53 const std::string& header,
53 const std::string& body, 54 const std::string& body,
54 URLFetcherDelegate* delegate) { 55 URLFetcherDelegate* delegate) {
55 bool empty_body = body.empty(); 56 bool empty_body = body.empty();
56 URLFetcher* result = URLFetcher::Create( 57 URLFetcher* result = URLFetcher::Create(
57 0, url, 58 0, url,
58 empty_body ? URLFetcher::GET : URLFetcher::POST, 59 empty_body ? URLFetcher::GET : URLFetcher::POST,
59 delegate); 60 delegate);
60 61
61 result->SetRequestContext(getter); 62 result->SetRequestContext(getter);
63 // No user data, as the request will be cookie-less.
64 result->SetContentURLRequestUserData(
65 new content::ContentURLRequestUserData());
62 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 66 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
63 net::LOAD_DO_NOT_SAVE_COOKIES); 67 net::LOAD_DO_NOT_SAVE_COOKIES);
64 if (!header.empty()) 68 if (!header.empty())
65 result->SetExtraRequestHeaders(header); 69 result->SetExtraRequestHeaders(header);
66 70
67 if (!empty_body) 71 if (!empty_body)
68 result->SetUploadData("application/x-www-form-urlencoded", body); 72 result->SetUploadData("application/x-www-form-urlencoded", body);
69 73
70 return result; 74 return result;
71 } 75 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 std::string OAuth2RevocationFetcher::MakeRevocationBody( 158 std::string OAuth2RevocationFetcher::MakeRevocationBody(
155 const std::string& client_id, 159 const std::string& client_id,
156 const std::string& origin) { 160 const std::string& origin) {
157 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true); 161 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true);
158 std::string enc_origin = net::EscapeUrlEncodedData(origin, true); 162 std::string enc_origin = net::EscapeUrlEncodedData(origin, true);
159 return StringPrintf( 163 return StringPrintf(
160 kRevocationBodyFormat, 164 kRevocationBodyFormat,
161 enc_client_id.c_str(), 165 enc_client_id.c_str(),
162 enc_origin.c_str()); 166 enc_origin.c_str());
163 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698