| 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/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" |
| 10 #include "base/threading/worker_pool.h" | 11 #include "base/threading/worker_pool.h" |
| 11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/shell/shell_network_delegate.h" | 13 #include "content/shell/shell_network_delegate.h" |
| 13 #include "net/base/cert_verifier.h" | 14 #include "net/base/cert_verifier.h" |
| 14 #include "net/base/default_server_bound_cert_store.h" | 15 #include "net/base/default_server_bound_cert_store.h" |
| 15 #include "net/base/host_resolver.h" | 16 #include "net/base/host_resolver.h" |
| 16 #include "net/base/server_bound_cert_service.h" | 17 #include "net/base/server_bound_cert_service.h" |
| 17 #include "net/base/ssl_config_service_defaults.h" | 18 #include "net/base/ssl_config_service_defaults.h" |
| 18 #include "net/cookies/cookie_monster.h" | 19 #include "net/cookies/cookie_monster.h" |
| 19 #include "net/http/http_auth_handler_factory.h" | 20 #include "net/http/http_auth_handler_factory.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!url_request_context_.get()) { | 57 if (!url_request_context_.get()) { |
| 57 url_request_context_.reset(new net::URLRequestContext()); | 58 url_request_context_.reset(new net::URLRequestContext()); |
| 58 network_delegate_.reset(new ShellNetworkDelegate); | 59 network_delegate_.reset(new ShellNetworkDelegate); |
| 59 url_request_context_->set_network_delegate(network_delegate_.get()); | 60 url_request_context_->set_network_delegate(network_delegate_.get()); |
| 60 storage_.reset( | 61 storage_.reset( |
| 61 new net::URLRequestContextStorage(url_request_context_.get())); | 62 new net::URLRequestContextStorage(url_request_context_.get())); |
| 62 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 63 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); |
| 63 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( | 64 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( |
| 64 new net::DefaultServerBoundCertStore(NULL), | 65 new net::DefaultServerBoundCertStore(NULL), |
| 65 base::WorkerPool::GetTaskRunner(true))); | 66 base::WorkerPool::GetTaskRunner(true))); |
| 66 url_request_context_->set_accept_language("en-us,en"); | 67 storage_->set_http_user_agent_settings(new net::ConstHttpUserAgentSettings( |
| 67 url_request_context_->set_accept_charset("iso-8859-1,*,utf-8"); | 68 "en-us,en", "iso-8859-1,*,utf-8", EmptyString())); |
| 68 | 69 |
| 69 storage_->set_host_resolver( | 70 storage_->set_host_resolver( |
| 70 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 71 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 71 net::HostResolver::kDefaultRetryAttempts, | 72 net::HostResolver::kDefaultRetryAttempts, |
| 72 NULL)); | 73 NULL)); |
| 73 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); | 74 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 74 // TODO(jam): use v8 if possible, look at chrome code. | 75 // TODO(jam): use v8 if possible, look at chrome code. |
| 75 storage_->set_proxy_service( | 76 storage_->set_proxy_service( |
| 76 net::ProxyService::CreateUsingSystemProxyResolver( | 77 net::ProxyService::CreateUsingSystemProxyResolver( |
| 77 proxy_config_service_.release(), | 78 proxy_config_service_.release(), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 scoped_refptr<base::SingleThreadTaskRunner> | 126 scoped_refptr<base::SingleThreadTaskRunner> |
| 126 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 127 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 127 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 128 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 128 } | 129 } |
| 129 | 130 |
| 130 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 131 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
| 131 return url_request_context_->host_resolver(); | 132 return url_request_context_->host_resolver(); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace content | 135 } // namespace content |
| OLD | NEW |