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

Side by Side Diff: chrome/browser/sync/glue/http_bridge.cc

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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 "chrome/browser/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
11 #include "net/base/cookie_monster.h" 11 #include "net/base/cookie_monster.h"
12 #include "net/base/host_resolver.h" 12 #include "net/base/host_resolver.h"
13 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
14 #include "net/http/http_cache.h" 14 #include "net/http/http_cache.h"
15 #include "net/http/http_network_layer.h" 15 #include "net/http/http_network_layer.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 #include "net/proxy/proxy_service.h" 17 #include "net/proxy/proxy_service.h"
18 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_status.h" 19 #include "net/url_request/url_request_status.h"
20 #include "webkit/glue/webkit_glue.h" 20 #include "webkit/glue/webkit_glue.h"
21 21
22 namespace browser_sync { 22 namespace browser_sync {
23 23
24 HttpBridge::RequestContextGetter::RequestContextGetter( 24 HttpBridge::RequestContextGetter::RequestContextGetter(
25 URLRequestContextGetter* baseline_context_getter) 25 URLRequestContextGetter* baseline_context_getter)
26 : baseline_context_getter_(baseline_context_getter) { 26 : baseline_context_getter_(baseline_context_getter) {
27 } 27 }
28 28
29 URLRequestContext* HttpBridge::RequestContextGetter::GetURLRequestContext() { 29 net::URLRequestContext*
30 HttpBridge::RequestContextGetter::GetURLRequestContext() {
30 // Lazily create the context. 31 // Lazily create the context.
31 if (!context_) { 32 if (!context_) {
32 URLRequestContext* baseline_context = 33 net::URLRequestContext* baseline_context =
33 baseline_context_getter_->GetURLRequestContext(); 34 baseline_context_getter_->GetURLRequestContext();
34 context_ = new RequestContext(baseline_context); 35 context_ = new RequestContext(baseline_context);
35 baseline_context_getter_ = NULL; 36 baseline_context_getter_ = NULL;
36 } 37 }
37 38
38 // Apply the user agent which was set earlier. 39 // Apply the user agent which was set earlier.
39 if (is_user_agent_set()) 40 if (is_user_agent_set())
40 context_->set_user_agent(user_agent_); 41 context_->set_user_agent(user_agent_);
41 42
42 return context_; 43 return context_;
(...skipping 17 matching lines...) Expand all
60 sync_api::HttpPostProviderInterface* HttpBridgeFactory::Create() { 61 sync_api::HttpPostProviderInterface* HttpBridgeFactory::Create() {
61 HttpBridge* http = new HttpBridge(request_context_getter_); 62 HttpBridge* http = new HttpBridge(request_context_getter_);
62 http->AddRef(); 63 http->AddRef();
63 return http; 64 return http;
64 } 65 }
65 66
66 void HttpBridgeFactory::Destroy(sync_api::HttpPostProviderInterface* http) { 67 void HttpBridgeFactory::Destroy(sync_api::HttpPostProviderInterface* http) {
67 static_cast<HttpBridge*>(http)->Release(); 68 static_cast<HttpBridge*>(http)->Release();
68 } 69 }
69 70
70 HttpBridge::RequestContext::RequestContext(URLRequestContext* baseline_context) 71 HttpBridge::RequestContext::RequestContext(
72 net::URLRequestContext* baseline_context)
71 : baseline_context_(baseline_context) { 73 : baseline_context_(baseline_context) {
72 74
73 // Create empty, in-memory cookie store. 75 // Create empty, in-memory cookie store.
74 cookie_store_ = new net::CookieMonster(NULL, NULL); 76 cookie_store_ = new net::CookieMonster(NULL, NULL);
75 77
76 // We don't use a cache for bridged loads, but we do want to share proxy info. 78 // We don't use a cache for bridged loads, but we do want to share proxy info.
77 host_resolver_ = baseline_context->host_resolver(); 79 host_resolver_ = baseline_context->host_resolver();
78 proxy_service_ = baseline_context->proxy_service(); 80 proxy_service_ = baseline_context->proxy_service();
79 ssl_config_service_ = baseline_context->ssl_config_service(); 81 ssl_config_service_ = baseline_context->ssl_config_service();
80 82
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. 242 // URLFetcher, so it seems most natural / "polite" to let the stack unwind.
241 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_); 243 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_);
242 url_poster_ = NULL; 244 url_poster_ = NULL;
243 245
244 // Wake the blocked syncer thread in MakeSynchronousPost. 246 // Wake the blocked syncer thread in MakeSynchronousPost.
245 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! 247 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted!
246 http_post_completed_.Signal(); 248 http_post_completed_.Signal();
247 } 249 }
248 250
249 } // namespace browser_sync 251 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698