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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 file_task_runner_); | 107 file_task_runner_); |
| 108 } | 108 } |
| 109 | 109 |
| 110 std::unique_ptr<net::ProxyService> | 110 std::unique_ptr<net::ProxyService> |
| 111 ShellURLRequestContextGetter::GetProxyService() { | 111 ShellURLRequestContextGetter::GetProxyService() { |
| 112 // TODO(jam): use v8 if possible, look at chrome code. | 112 // TODO(jam): use v8 if possible, look at chrome code. |
| 113 return net::ProxyService::CreateUsingSystemProxyResolver( | 113 return net::ProxyService::CreateUsingSystemProxyResolver( |
| 114 std::move(proxy_config_service_), 0, url_request_context_->net_log()); | 114 std::move(proxy_config_service_), 0, url_request_context_->net_log()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool ShellURLRequestContextGetter::ShouldEnableReferrerPolicyHeader() { | |
| 118 return false; | |
|
jochen (gone - plz use gerrit)
2016/06/29 20:44:05
nit. could be return base::CommandLine::ForCurrent
estark
2016/06/29 21:16:48
Done.
| |
| 119 } | |
| 120 | |
| 117 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { | 121 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { |
| 118 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 122 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 119 | 123 |
| 120 if (!url_request_context_) { | 124 if (!url_request_context_) { |
| 121 const base::CommandLine& command_line = | 125 const base::CommandLine& command_line = |
| 122 *base::CommandLine::ForCurrentProcess(); | 126 *base::CommandLine::ForCurrentProcess(); |
| 123 | 127 |
| 124 url_request_context_.reset(new net::URLRequestContext()); | 128 url_request_context_.reset(new net::URLRequestContext()); |
| 125 url_request_context_->set_net_log(net_log_); | 129 url_request_context_->set_net_log(net_log_); |
| 126 network_delegate_ = CreateNetworkDelegate(); | 130 network_delegate_ = CreateNetworkDelegate(); |
| 127 url_request_context_->set_network_delegate(network_delegate_.get()); | 131 url_request_context_->set_network_delegate(network_delegate_.get()); |
| 132 // TODO(estark): Remove this once the Referrer-Policy header is no | |
| 133 // longer an experimental feature. https://crbug.com/619228 | |
| 134 url_request_context_->set_enable_referrer_policy_header( | |
| 135 ShouldEnableReferrerPolicyHeader()); | |
| 128 storage_.reset( | 136 storage_.reset( |
| 129 new net::URLRequestContextStorage(url_request_context_.get())); | 137 new net::URLRequestContextStorage(url_request_context_.get())); |
| 130 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); | 138 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); |
| 131 storage_->set_channel_id_service(base::WrapUnique( | 139 storage_->set_channel_id_service(base::WrapUnique( |
| 132 new net::ChannelIDService(new net::DefaultChannelIDStore(NULL), | 140 new net::ChannelIDService(new net::DefaultChannelIDStore(NULL), |
| 133 base::WorkerPool::GetTaskRunner(true)))); | 141 base::WorkerPool::GetTaskRunner(true)))); |
| 134 storage_->set_http_user_agent_settings(base::WrapUnique( | 142 storage_->set_http_user_agent_settings(base::WrapUnique( |
| 135 new net::StaticHttpUserAgentSettings("en-us,en", GetShellUserAgent()))); | 143 new net::StaticHttpUserAgentSettings("en-us,en", GetShellUserAgent()))); |
| 136 | 144 |
| 137 std::unique_ptr<net::HostResolver> host_resolver( | 145 std::unique_ptr<net::HostResolver> host_resolver( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 scoped_refptr<base::SingleThreadTaskRunner> | 266 scoped_refptr<base::SingleThreadTaskRunner> |
| 259 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 267 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 260 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 268 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 261 } | 269 } |
| 262 | 270 |
| 263 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 271 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
| 264 return url_request_context_->host_resolver(); | 272 return url_request_context_->host_resolver(); |
| 265 } | 273 } |
| 266 | 274 |
| 267 } // namespace content | 275 } // namespace content |
| OLD | NEW |