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

Side by Side Diff: content/shell/shell_url_request_context_getter.cc

Issue 10834215: Remove static variables from HttpStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 8 years, 3 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 "content/shell/shell_url_request_context_getter.h" 5 #include "content/shell/shell_url_request_context_getter.h"
6 6
7 #include "base/command_line.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/string_split.h" 9 #include "base/string_split.h"
9 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
10 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
11 #include "content/shell/shell_network_delegate.h" 12 #include "content/shell/shell_network_delegate.h"
12 #include "net/base/cert_verifier.h" 13 #include "net/base/cert_verifier.h"
13 #include "net/base/default_server_bound_cert_store.h" 14 #include "net/base/default_server_bound_cert_store.h"
14 #include "net/base/host_resolver.h" 15 #include "net/base/host_resolver.h"
15 #include "net/base/server_bound_cert_service.h" 16 #include "net/base/server_bound_cert_service.h"
16 #include "net/base/ssl_config_service_defaults.h" 17 #include "net/base/ssl_config_service_defaults.h"
17 #include "net/cookies/cookie_monster.h" 18 #include "net/cookies/cookie_monster.h"
18 #include "net/http/http_auth_handler_factory.h" 19 #include "net/http/http_auth_handler_factory.h"
19 #include "net/http/http_cache.h" 20 #include "net/http/http_cache.h"
21 #include "net/http/http_network_session.h"
20 #include "net/http/http_server_properties_impl.h" 22 #include "net/http/http_server_properties_impl.h"
21 #include "net/proxy/proxy_service.h" 23 #include "net/proxy/proxy_service.h"
22 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
23 #include "net/url_request/url_request_context_storage.h" 25 #include "net/url_request/url_request_context_storage.h"
24 #include "net/url_request/url_request_job_factory_impl.h" 26 #include "net/url_request/url_request_job_factory_impl.h"
25 27
26 namespace content { 28 namespace content {
27 29
28 ShellURLRequestContextGetter::ShellURLRequestContextGetter( 30 ShellURLRequestContextGetter::ShellURLRequestContextGetter(
31 bool ignore_certificate_errors,
29 const FilePath& base_path, 32 const FilePath& base_path,
30 MessageLoop* io_loop, 33 MessageLoop* io_loop,
31 MessageLoop* file_loop) 34 MessageLoop* file_loop)
32 : base_path_(base_path), 35 : ignore_certificate_errors_(ignore_certificate_errors),
36 base_path_(base_path),
33 io_loop_(io_loop), 37 io_loop_(io_loop),
34 file_loop_(file_loop) { 38 file_loop_(file_loop) {
35 // Must first be created on the UI thread. 39 // Must first be created on the UI thread.
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
37 41
38 // We must create the proxy config service on the UI loop on Linux because it 42 // We must create the proxy config service on the UI loop on Linux because it
39 // must synchronously run on the glib message loop. This will be passed to 43 // must synchronously run on the glib message loop. This will be passed to
40 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). 44 // the URLRequestContextStorage on the IO thread in GetURLRequestContext().
41 proxy_config_service_.reset( 45 proxy_config_service_.reset(
42 net::ProxyService::CreateSystemProxyConfigService( 46 net::ProxyService::CreateSystemProxyConfigService(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 85
82 FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); 86 FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache"));
83 net::HttpCache::DefaultBackend* main_backend = 87 net::HttpCache::DefaultBackend* main_backend =
84 new net::HttpCache::DefaultBackend( 88 new net::HttpCache::DefaultBackend(
85 net::DISK_CACHE, 89 net::DISK_CACHE,
86 cache_path, 90 cache_path,
87 0, 91 0,
88 BrowserThread::GetMessageLoopProxyForThread( 92 BrowserThread::GetMessageLoopProxyForThread(
89 BrowserThread::CACHE)); 93 BrowserThread::CACHE));
90 94
95 net::HttpNetworkSession::Params network_session_params;
96 network_session_params.host_resolver =
97 url_request_context_->host_resolver();
98 network_session_params.cert_verifier =
99 url_request_context_->cert_verifier();
100 network_session_params.server_bound_cert_service =
101 url_request_context_->server_bound_cert_service();
102 network_session_params.proxy_service =
103 url_request_context_->proxy_service();
104 network_session_params.ssl_config_service =
105 url_request_context_->ssl_config_service();
106 network_session_params.http_auth_handler_factory =
107 url_request_context_->http_auth_handler_factory();
108 network_session_params.network_delegate =
109 url_request_context_->network_delegate();
110 network_session_params.http_server_properties =
111 url_request_context_->http_server_properties();
112 network_session_params.ignore_certificate_errors =
113 ignore_certificate_errors_;
114
91 net::HttpCache* main_cache = new net::HttpCache( 115 net::HttpCache* main_cache = new net::HttpCache(
92 url_request_context_->host_resolver(), 116 network_session_params, main_backend);
93 url_request_context_->cert_verifier(),
94 url_request_context_->server_bound_cert_service(),
95 NULL, /* transport_security_state */
96 url_request_context_->proxy_service(),
97 "", /* ssl_session_cache_shard */
98 url_request_context_->ssl_config_service(),
99 url_request_context_->http_auth_handler_factory(),
100 url_request_context_->network_delegate(),
101 url_request_context_->http_server_properties(),
102 NULL,
103 main_backend,
104 "" /* trusted_spdy_proxy */ );
105 storage_->set_http_transaction_factory(main_cache); 117 storage_->set_http_transaction_factory(main_cache);
106 118
107 storage_->set_job_factory(new net::URLRequestJobFactoryImpl); 119 storage_->set_job_factory(new net::URLRequestJobFactoryImpl);
108 } 120 }
109 121
110 return url_request_context_.get(); 122 return url_request_context_.get();
111 } 123 }
112 124
113 scoped_refptr<base::SingleThreadTaskRunner> 125 scoped_refptr<base::SingleThreadTaskRunner>
114 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 126 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
115 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 127 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
116 } 128 }
117 129
118 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 130 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
119 return url_request_context_->host_resolver(); 131 return url_request_context_->host_resolver();
120 } 132 }
121 133
122 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_url_request_context_getter.h ('k') | jingle/glue/proxy_resolving_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698