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

Side by Side Diff: chrome/browser/sync/glue/http_bridge.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/sync/glue/http_bridge.h" 5 #include "chrome/browser/sync/glue/http_bridge.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/common/content_client.h" 11 #include "content/public/common/content_client.h"
12 #include "content/public/common/content_url_request_user_data.h"
12 #include "content/public/common/url_fetcher.h" 13 #include "content/public/common/url_fetcher.h"
13 #include "net/base/cookie_monster.h" 14 #include "net/base/cookie_monster.h"
14 #include "net/base/host_resolver.h" 15 #include "net/base/host_resolver.h"
15 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
16 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
17 #include "net/http/http_cache.h" 18 #include "net/http/http_cache.h"
18 #include "net/http/http_network_layer.h" 19 #include "net/http/http_network_layer.h"
19 #include "net/http/http_response_headers.h" 20 #include "net/http/http_response_headers.h"
20 #include "net/proxy/proxy_service.h" 21 #include "net/proxy/proxy_service.h"
21 #include "net/url_request/url_request_context.h" 22 #include "net/url_request/url_request_context.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void HttpBridge::MakeAsynchronousPost() { 216 void HttpBridge::MakeAsynchronousPost() {
216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
217 base::AutoLock lock(fetch_state_lock_); 218 base::AutoLock lock(fetch_state_lock_);
218 DCHECK(!fetch_state_.request_completed); 219 DCHECK(!fetch_state_.request_completed);
219 if (fetch_state_.aborted) 220 if (fetch_state_.aborted)
220 return; 221 return;
221 222
222 fetch_state_.url_poster = content::URLFetcher::Create( 223 fetch_state_.url_poster = content::URLFetcher::Create(
223 url_for_request_, content::URLFetcher::POST, this); 224 url_for_request_, content::URLFetcher::POST, this);
224 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_); 225 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_);
226 // TODO(jochen): Do cookie audit.
227 fetch_state_.url_poster->SetContentURLRequestUserData(
228 new content::ContentURLRequestUserData());
225 fetch_state_.url_poster->SetUploadData(content_type_, request_content_); 229 fetch_state_.url_poster->SetUploadData(content_type_, request_content_);
226 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_); 230 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_);
227 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); 231 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
228 fetch_state_.url_poster->Start(); 232 fetch_state_.url_poster->Start();
229 } 233 }
230 234
231 int HttpBridge::GetResponseContentLength() const { 235 int HttpBridge::GetResponseContentLength() const {
232 DCHECK_EQ(MessageLoop::current(), created_on_loop_); 236 DCHECK_EQ(MessageLoop::current(), created_on_loop_);
233 base::AutoLock lock(fetch_state_lock_); 237 base::AutoLock lock(fetch_state_lock_);
234 DCHECK(fetch_state_.request_completed); 238 DCHECK(fetch_state_.request_completed);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. 292 // URLFetcher, so it seems most natural / "polite" to let the stack unwind.
289 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); 293 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster);
290 fetch_state_.url_poster = NULL; 294 fetch_state_.url_poster = NULL;
291 295
292 // Wake the blocked syncer thread in MakeSynchronousPost. 296 // Wake the blocked syncer thread in MakeSynchronousPost.
293 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! 297 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted!
294 http_post_completed_.Signal(); 298 http_post_completed_.Signal();
295 } 299 }
296 300
297 } // namespace browser_sync 301 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698