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

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

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (r198785) Created 7 years, 7 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
« no previous file with comments | « content/shell/shell_content_browser_client.cc ('k') | net/ftp/ftp_network_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/threading/worker_pool.h" 12 #include "base/threading/worker_pool.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
16 #include "content/shell/common/shell_switches.h" 16 #include "content/shell/common/shell_switches.h"
17 #include "content/shell/shell_network_delegate.h" 17 #include "content/shell/shell_network_delegate.h"
18 #include "net/cert/cert_verifier.h" 18 #include "net/cert/cert_verifier.h"
19 #include "net/cookies/cookie_monster.h" 19 #include "net/cookies/cookie_monster.h"
20 #include "net/dns/host_resolver.h" 20 #include "net/dns/host_resolver.h"
21 #include "net/dns/mapped_host_resolver.h" 21 #include "net/dns/mapped_host_resolver.h"
22 #include "net/ftp/ftp_network_layer.h"
23 #include "net/http/http_auth_handler_factory.h" 22 #include "net/http/http_auth_handler_factory.h"
24 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
25 #include "net/http/http_network_session.h" 24 #include "net/http/http_network_session.h"
26 #include "net/http/http_server_properties_impl.h" 25 #include "net/http/http_server_properties_impl.h"
27 #include "net/proxy/proxy_service.h" 26 #include "net/proxy/proxy_service.h"
28 #include "net/ssl/default_server_bound_cert_store.h" 27 #include "net/ssl/default_server_bound_cert_store.h"
29 #include "net/ssl/server_bound_cert_service.h" 28 #include "net/ssl/server_bound_cert_service.h"
30 #include "net/ssl/ssl_config_service_defaults.h" 29 #include "net/ssl/ssl_config_service_defaults.h"
30 #include "net/url_request/data_protocol_handler.h"
31 #include "net/url_request/file_protocol_handler.h"
31 #include "net/url_request/protocol_intercept_job_factory.h" 32 #include "net/url_request/protocol_intercept_job_factory.h"
32 #include "net/url_request/static_http_user_agent_settings.h" 33 #include "net/url_request/static_http_user_agent_settings.h"
33 #include "net/url_request/url_request_context.h" 34 #include "net/url_request/url_request_context.h"
34 #include "net/url_request/url_request_context_storage.h" 35 #include "net/url_request/url_request_context_storage.h"
35 #include "net/url_request/url_request_job_factory_impl.h" 36 #include "net/url_request/url_request_job_factory_impl.h"
36 37
37 namespace content { 38 namespace content {
38 39
39 namespace { 40 namespace {
40 41
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 // Give |storage_| ownership at the end in case it's |mapped_host_resolver|. 170 // Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
170 storage_->set_host_resolver(host_resolver.Pass()); 171 storage_->set_host_resolver(host_resolver.Pass());
171 network_session_params.host_resolver = 172 network_session_params.host_resolver =
172 url_request_context_->host_resolver(); 173 url_request_context_->host_resolver();
173 174
174 net::HttpCache* main_cache = new net::HttpCache( 175 net::HttpCache* main_cache = new net::HttpCache(
175 network_session_params, main_backend); 176 network_session_params, main_backend);
176 storage_->set_http_transaction_factory(main_cache); 177 storage_->set_http_transaction_factory(main_cache);
177 178
178 #if !defined(DISABLE_FTP_SUPPORT)
179 storage_->set_ftp_transaction_factory(
180 new net::FtpNetworkLayer(network_session_params.host_resolver));
181 #endif
182
183 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 179 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
184 new net::URLRequestJobFactoryImpl()); 180 new net::URLRequestJobFactoryImpl());
181 // Keep ProtocolHandlers added in sync with
182 // ShellContentBrowserClient::IsHandledURL().
185 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); 183 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_);
184 bool set_protocol = job_factory->SetProtocolHandler(
185 chrome::kDataScheme,
186 new net::DataProtocolHandler);
187 DCHECK(set_protocol);
188 set_protocol = job_factory->SetProtocolHandler(
189 chrome::kFileScheme,
190 new net::FileProtocolHandler);
191 DCHECK(set_protocol);
186 storage_->set_job_factory(job_factory.release()); 192 storage_->set_job_factory(job_factory.release());
187 } 193 }
188 194
189 return url_request_context_.get(); 195 return url_request_context_.get();
190 } 196 }
191 197
192 scoped_refptr<base::SingleThreadTaskRunner> 198 scoped_refptr<base::SingleThreadTaskRunner>
193 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 199 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
194 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 200 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
195 } 201 }
196 202
197 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 203 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
198 return url_request_context_->host_resolver(); 204 return url_request_context_->host_resolver();
199 } 205 }
200 206
201 } // namespace content 207 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_content_browser_client.cc ('k') | net/ftp/ftp_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698