Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 DCHECK(set_protocol); | 60 DCHECK(set_protocol); |
| 61 } | 61 } |
| 62 protocol_handlers->clear(); | 62 protocol_handlers->clear(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 ShellURLRequestContextGetter::ShellURLRequestContextGetter( | 67 ShellURLRequestContextGetter::ShellURLRequestContextGetter( |
| 68 bool ignore_certificate_errors, | 68 bool ignore_certificate_errors, |
| 69 const base::FilePath& base_path, | 69 const base::FilePath& base_path, |
| 70 base::MessageLoop* io_loop, | 70 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 71 base::MessageLoop* file_loop, | 71 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
| 72 ProtocolHandlerMap* protocol_handlers, | 72 ProtocolHandlerMap* protocol_handlers, |
| 73 URLRequestInterceptorScopedVector request_interceptors, | 73 URLRequestInterceptorScopedVector request_interceptors, |
| 74 net::NetLog* net_log) | 74 net::NetLog* net_log) |
| 75 : ignore_certificate_errors_(ignore_certificate_errors), | 75 : ignore_certificate_errors_(ignore_certificate_errors), |
| 76 base_path_(base_path), | 76 base_path_(base_path), |
| 77 io_loop_(io_loop), | 77 io_task_runner_(io_task_runner), |
| 78 file_loop_(file_loop), | 78 file_task_runner_(file_task_runner), |
|
Ryan Sleevi
2016/02/25 20:50:14
drive by: std::move() here (like line 80)
| |
| 79 net_log_(net_log), | 79 net_log_(net_log), |
| 80 request_interceptors_(std::move(request_interceptors)) { | 80 request_interceptors_(std::move(request_interceptors)) { |
| 81 // Must first be created on the UI thread. | 81 // Must first be created on the UI thread. |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 83 | 83 |
| 84 std::swap(protocol_handlers_, *protocol_handlers); | 84 std::swap(protocol_handlers_, *protocol_handlers); |
| 85 | 85 |
| 86 // We must create the proxy config service on the UI loop on Linux because it | 86 // We must create the proxy config service on the UI loop on Linux because it |
| 87 // must synchronously run on the glib message loop. This will be passed to | 87 // must synchronously run on the glib message loop. This will be passed to |
| 88 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). | 88 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). |
| 89 proxy_config_service_ = GetProxyConfigService(); | 89 proxy_config_service_ = GetProxyConfigService(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { | 92 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { |
| 93 } | 93 } |
| 94 | 94 |
| 95 scoped_ptr<net::NetworkDelegate> | 95 scoped_ptr<net::NetworkDelegate> |
| 96 ShellURLRequestContextGetter::CreateNetworkDelegate() { | 96 ShellURLRequestContextGetter::CreateNetworkDelegate() { |
| 97 return make_scoped_ptr(new ShellNetworkDelegate); | 97 return make_scoped_ptr(new ShellNetworkDelegate); |
| 98 } | 98 } |
| 99 | 99 |
| 100 scoped_ptr<net::ProxyConfigService> | 100 scoped_ptr<net::ProxyConfigService> |
| 101 ShellURLRequestContextGetter::GetProxyConfigService() { | 101 ShellURLRequestContextGetter::GetProxyConfigService() { |
| 102 return net::ProxyService::CreateSystemProxyConfigService( | 102 return net::ProxyService::CreateSystemProxyConfigService(io_task_runner_, |
| 103 io_loop_->task_runner(), file_loop_->task_runner()); | 103 file_task_runner_); |
| 104 } | 104 } |
| 105 | 105 |
| 106 scoped_ptr<net::ProxyService> ShellURLRequestContextGetter::GetProxyService() { | 106 scoped_ptr<net::ProxyService> ShellURLRequestContextGetter::GetProxyService() { |
| 107 // TODO(jam): use v8 if possible, look at chrome code. | 107 // TODO(jam): use v8 if possible, look at chrome code. |
| 108 return net::ProxyService::CreateUsingSystemProxyResolver( | 108 return net::ProxyService::CreateUsingSystemProxyResolver( |
| 109 std::move(proxy_config_service_), 0, url_request_context_->net_log()); | 109 std::move(proxy_config_service_), 0, url_request_context_->net_log()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { | 112 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { |
| 113 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 113 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 scoped_refptr<base::SingleThreadTaskRunner> | 248 scoped_refptr<base::SingleThreadTaskRunner> |
| 249 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 249 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 250 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 250 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 251 } | 251 } |
| 252 | 252 |
| 253 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 253 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
| 254 return url_request_context_->host_resolver(); | 254 return url_request_context_->host_resolver(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace content | 257 } // namespace content |
| OLD | NEW |