Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/shell/browser/shell_url_request_context_getter.cc

Issue 2399643002: Ship Referrer-Policy header (Closed)
Patch Set: remove some more missed ShouldEnableReferrerPolicyHeader() spots Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 file_task_runner_); 106 file_task_runner_);
107 } 107 }
108 108
109 std::unique_ptr<net::ProxyService> 109 std::unique_ptr<net::ProxyService>
110 ShellURLRequestContextGetter::GetProxyService() { 110 ShellURLRequestContextGetter::GetProxyService() {
111 // TODO(jam): use v8 if possible, look at chrome code. 111 // TODO(jam): use v8 if possible, look at chrome code.
112 return net::ProxyService::CreateUsingSystemProxyResolver( 112 return net::ProxyService::CreateUsingSystemProxyResolver(
113 std::move(proxy_config_service_), 0, url_request_context_->net_log()); 113 std::move(proxy_config_service_), 0, url_request_context_->net_log());
114 } 114 }
115 115
116 bool ShellURLRequestContextGetter::ShouldEnableReferrerPolicyHeader() {
117 return base::CommandLine::ForCurrentProcess()->HasSwitch(
118 switches::kEnableExperimentalWebPlatformFeatures);
119 }
120
121 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { 116 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
122 DCHECK_CURRENTLY_ON(BrowserThread::IO); 117 DCHECK_CURRENTLY_ON(BrowserThread::IO);
123 118
124 if (!url_request_context_) { 119 if (!url_request_context_) {
125 const base::CommandLine& command_line = 120 const base::CommandLine& command_line =
126 *base::CommandLine::ForCurrentProcess(); 121 *base::CommandLine::ForCurrentProcess();
127 122
128 url_request_context_.reset(new net::URLRequestContext()); 123 url_request_context_.reset(new net::URLRequestContext());
129 url_request_context_->set_net_log(net_log_); 124 url_request_context_->set_net_log(net_log_);
130 network_delegate_ = CreateNetworkDelegate(); 125 network_delegate_ = CreateNetworkDelegate();
131 url_request_context_->set_network_delegate(network_delegate_.get()); 126 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());
136 storage_.reset( 127 storage_.reset(
137 new net::URLRequestContextStorage(url_request_context_.get())); 128 new net::URLRequestContextStorage(url_request_context_.get()));
138 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); 129 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig()));
139 storage_->set_channel_id_service(base::WrapUnique( 130 storage_->set_channel_id_service(base::WrapUnique(
140 new net::ChannelIDService(new net::DefaultChannelIDStore(NULL), 131 new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
141 base::WorkerPool::GetTaskRunner(true)))); 132 base::WorkerPool::GetTaskRunner(true))));
142 storage_->set_http_user_agent_settings( 133 storage_->set_http_user_agent_settings(
143 base::MakeUnique<net::StaticHttpUserAgentSettings>( 134 base::MakeUnique<net::StaticHttpUserAgentSettings>(
144 "en-us,en", GetShellUserAgent())); 135 "en-us,en", GetShellUserAgent()));
145 136
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 scoped_refptr<base::SingleThreadTaskRunner> 258 scoped_refptr<base::SingleThreadTaskRunner>
268 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 259 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
269 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 260 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
270 } 261 }
271 262
272 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 263 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
273 return url_request_context_->host_resolver(); 264 return url_request_context_->host_resolver();
274 } 265 }
275 266
276 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_url_request_context_getter.h ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698