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