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" | |
16 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
17 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
18 #include "content/shell/browser/shell_network_delegate.h" | 17 #include "content/shell/browser/shell_network_delegate.h" |
19 #include "content/shell/common/shell_switches.h" | 18 #include "content/shell/common/shell_switches.h" |
20 #include "net/base/cache_type.h" | 19 #include "net/base/cache_type.h" |
21 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
22 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
23 #include "net/dns/host_resolver.h" | 22 #include "net/dns/host_resolver.h" |
24 #include "net/dns/mapped_host_resolver.h" | 23 #include "net/dns/mapped_host_resolver.h" |
25 #include "net/http/http_auth_handler_factory.h" | 24 #include "net/http/http_auth_handler_factory.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 94 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
96 | 95 |
97 url_request_context_.reset(new net::URLRequestContext()); | 96 url_request_context_.reset(new net::URLRequestContext()); |
98 url_request_context_->set_net_log(net_log_); | 97 url_request_context_->set_net_log(net_log_); |
99 network_delegate_.reset(new ShellNetworkDelegate); | 98 network_delegate_.reset(new ShellNetworkDelegate); |
100 if (command_line.HasSwitch(switches::kDumpRenderTree)) | 99 if (command_line.HasSwitch(switches::kDumpRenderTree)) |
101 ShellNetworkDelegate::SetAcceptAllCookies(false); | 100 ShellNetworkDelegate::SetAcceptAllCookies(false); |
102 url_request_context_->set_network_delegate(network_delegate_.get()); | 101 url_request_context_->set_network_delegate(network_delegate_.get()); |
103 storage_.reset( | 102 storage_.reset( |
104 new net::URLRequestContextStorage(url_request_context_.get())); | 103 new net::URLRequestContextStorage(url_request_context_.get())); |
105 storage_->set_cookie_store( | 104 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); |
106 content::CreateCookieStore(content::CookieStoreConfig())); | |
107 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( | 105 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( |
108 new net::DefaultServerBoundCertStore(NULL), | 106 new net::DefaultServerBoundCertStore(NULL), |
109 base::WorkerPool::GetTaskRunner(true))); | 107 base::WorkerPool::GetTaskRunner(true))); |
110 storage_->set_http_user_agent_settings( | 108 storage_->set_http_user_agent_settings( |
111 new net::StaticHttpUserAgentSettings("en-us,en", EmptyString())); | 109 new net::StaticHttpUserAgentSettings("en-us,en", EmptyString())); |
112 | 110 |
113 scoped_ptr<net::HostResolver> host_resolver( | 111 scoped_ptr<net::HostResolver> host_resolver( |
114 net::HostResolver::CreateDefaultResolver( | 112 net::HostResolver::CreateDefaultResolver( |
115 url_request_context_->net_log())); | 113 url_request_context_->net_log())); |
116 | 114 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 scoped_refptr<base::SingleThreadTaskRunner> | 222 scoped_refptr<base::SingleThreadTaskRunner> |
225 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 223 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
226 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 224 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
227 } | 225 } |
228 | 226 |
229 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 227 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
230 return url_request_context_->host_resolver(); | 228 return url_request_context_->host_resolver(); |
231 } | 229 } |
232 | 230 |
233 } // namespace content | 231 } // namespace content |
OLD | NEW |