| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/shell/shell_network_delegate.h" | 10 #include "content/shell/shell_network_delegate.h" |
| 11 #include "net/base/cert_verifier.h" | 11 #include "net/base/cert_verifier.h" |
| 12 #include "net/base/default_server_bound_cert_store.h" | 12 #include "net/base/default_server_bound_cert_store.h" |
| 13 #include "net/base/host_resolver.h" | 13 #include "net/base/host_resolver.h" |
| 14 #include "net/base/server_bound_cert_service.h" | 14 #include "net/base/server_bound_cert_service.h" |
| 15 #include "net/base/ssl_config_service_defaults.h" | 15 #include "net/base/ssl_config_service_defaults.h" |
| 16 #include "net/cookies/cookie_monster.h" | 16 #include "net/cookies/cookie_monster.h" |
| 17 #include "net/http/http_auth_handler_factory.h" | 17 #include "net/http/http_auth_handler_factory.h" |
| 18 #include "net/http/http_cache.h" | 18 #include "net/http/http_cache.h" |
| 19 #include "net/http/http_server_properties_impl.h" | 19 #include "net/http/http_server_properties_impl.h" |
| 20 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
| 21 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
| 22 #include "net/url_request/url_request_context_storage.h" | 22 #include "net/url_request/url_request_context_storage.h" |
| 23 #include "net/url_request/url_request_job_factory.h" | 23 #include "net/url_request/url_request_job_factory.h" |
| 24 #include "net/url_request/url_request_throttler_manager.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 ShellURLRequestContextGetter::ShellURLRequestContextGetter( | 28 ShellURLRequestContextGetter::ShellURLRequestContextGetter( |
| 28 const FilePath& base_path, | 29 const FilePath& base_path, |
| 29 MessageLoop* io_loop, | 30 MessageLoop* io_loop, |
| 30 MessageLoop* file_loop) | 31 MessageLoop* file_loop) |
| 31 : base_path_(base_path), | 32 : base_path_(base_path), |
| 32 io_loop_(io_loop), | 33 io_loop_(io_loop), |
| 33 file_loop_(file_loop) { | 34 file_loop_(file_loop) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 50 | 51 |
| 51 if (!url_request_context_) { | 52 if (!url_request_context_) { |
| 52 url_request_context_ = new net::URLRequestContext(); | 53 url_request_context_ = new net::URLRequestContext(); |
| 53 network_delegate_.reset(new ShellNetworkDelegate); | 54 network_delegate_.reset(new ShellNetworkDelegate); |
| 54 url_request_context_->set_network_delegate(network_delegate_.get()); | 55 url_request_context_->set_network_delegate(network_delegate_.get()); |
| 55 storage_.reset(new net::URLRequestContextStorage(url_request_context_)); | 56 storage_.reset(new net::URLRequestContextStorage(url_request_context_)); |
| 56 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 57 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); |
| 57 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( | 58 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( |
| 58 new net::DefaultServerBoundCertStore(NULL))); | 59 new net::DefaultServerBoundCertStore(NULL))); |
| 60 storage_->set_throttler_manager(new net::URLRequestThrottlerManager); |
| 59 url_request_context_->set_accept_language("en-us,en"); | 61 url_request_context_->set_accept_language("en-us,en"); |
| 60 url_request_context_->set_accept_charset("iso-8859-1,*,utf-8"); | 62 url_request_context_->set_accept_charset("iso-8859-1,*,utf-8"); |
| 61 | 63 |
| 62 storage_->set_host_resolver( | 64 storage_->set_host_resolver( |
| 63 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 65 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 64 net::HostResolver::kDefaultRetryAttempts, | 66 net::HostResolver::kDefaultRetryAttempts, |
| 65 NULL)); | 67 NULL)); |
| 66 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); | 68 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 67 // TODO(jam): use v8 if possible, look at chrome code. | 69 // TODO(jam): use v8 if possible, look at chrome code. |
| 68 storage_->set_proxy_service( | 70 storage_->set_proxy_service( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 scoped_refptr<base::MessageLoopProxy> | 111 scoped_refptr<base::MessageLoopProxy> |
| 110 ShellURLRequestContextGetter::GetIOMessageLoopProxy() const { | 112 ShellURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 111 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 113 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 112 } | 114 } |
| 113 | 115 |
| 114 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 116 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
| 115 return url_request_context_->host_resolver(); | 117 return url_request_context_->host_resolver(); |
| 116 } | 118 } |
| 117 | 119 |
| 118 } // namespace content | 120 } // namespace content |
| OLD | NEW |