OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/shell_url_request_context_getter.h" | 5 #include "content/shell/browser/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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/cookie_store_factory.h" | 15 #include "content/public/browser/cookie_store_factory.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/shell/browser/shell_network_delegate.h" | 17 #include "content/shell/browser/shell_network_delegate.h" |
| 18 #include "content/shell/common/shell_content_client.h" |
18 #include "content/shell/common/shell_switches.h" | 19 #include "content/shell/common/shell_switches.h" |
19 #include "net/base/cache_type.h" | 20 #include "net/base/cache_type.h" |
20 #include "net/cert/cert_verifier.h" | 21 #include "net/cert/cert_verifier.h" |
21 #include "net/cookies/cookie_monster.h" | 22 #include "net/cookies/cookie_monster.h" |
22 #include "net/dns/host_resolver.h" | 23 #include "net/dns/host_resolver.h" |
23 #include "net/dns/mapped_host_resolver.h" | 24 #include "net/dns/mapped_host_resolver.h" |
24 #include "net/http/http_auth_handler_factory.h" | 25 #include "net/http/http_auth_handler_factory.h" |
25 #include "net/http/http_cache.h" | 26 #include "net/http/http_cache.h" |
26 #include "net/http/http_network_session.h" | 27 #include "net/http/http_network_session.h" |
27 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (command_line.HasSwitch(switches::kDumpRenderTree)) | 103 if (command_line.HasSwitch(switches::kDumpRenderTree)) |
103 ShellNetworkDelegate::SetAcceptAllCookies(false); | 104 ShellNetworkDelegate::SetAcceptAllCookies(false); |
104 url_request_context_->set_network_delegate(network_delegate_.get()); | 105 url_request_context_->set_network_delegate(network_delegate_.get()); |
105 storage_.reset( | 106 storage_.reset( |
106 new net::URLRequestContextStorage(url_request_context_.get())); | 107 new net::URLRequestContextStorage(url_request_context_.get())); |
107 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); | 108 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); |
108 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( | 109 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( |
109 new net::DefaultServerBoundCertStore(NULL), | 110 new net::DefaultServerBoundCertStore(NULL), |
110 base::WorkerPool::GetTaskRunner(true))); | 111 base::WorkerPool::GetTaskRunner(true))); |
111 storage_->set_http_user_agent_settings( | 112 storage_->set_http_user_agent_settings( |
112 new net::StaticHttpUserAgentSettings("en-us,en", std::string())); | 113 new net::StaticHttpUserAgentSettings( |
| 114 "en-us,en", GetShellUserAgent())); |
113 | 115 |
114 scoped_ptr<net::HostResolver> host_resolver( | 116 scoped_ptr<net::HostResolver> host_resolver( |
115 net::HostResolver::CreateDefaultResolver( | 117 net::HostResolver::CreateDefaultResolver( |
116 url_request_context_->net_log())); | 118 url_request_context_->net_log())); |
117 | 119 |
118 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); | 120 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); |
119 storage_->set_transport_security_state(new net::TransportSecurityState); | 121 storage_->set_transport_security_state(new net::TransportSecurityState); |
120 if (command_line.HasSwitch(switches::kDumpRenderTree)) { | 122 if (command_line.HasSwitch(switches::kDumpRenderTree)) { |
121 storage_->set_proxy_service(net::ProxyService::CreateDirect()); | 123 storage_->set_proxy_service(net::ProxyService::CreateDirect()); |
122 } else { | 124 } else { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 scoped_refptr<base::SingleThreadTaskRunner> | 238 scoped_refptr<base::SingleThreadTaskRunner> |
237 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 239 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
238 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 240 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
239 } | 241 } |
240 | 242 |
241 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 243 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
242 return url_request_context_->host_resolver(); | 244 return url_request_context_->host_resolver(); |
243 } | 245 } |
244 | 246 |
245 } // namespace content | 247 } // namespace content |
OLD | NEW |