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