OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/profiles/off_the_record_profile_io_data.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
13 #include "chrome/browser/net/chrome_net_log.h" | 14 #include "chrome/browser/net/chrome_net_log.h" |
14 #include "chrome/browser/net/chrome_network_delegate.h" | 15 #include "chrome/browser/net/chrome_network_delegate.h" |
15 #include "chrome/browser/net/chrome_url_request_context.h" | 16 #include "chrome/browser/net/chrome_url_request_context.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/chrome_switches.h" | |
17 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
20 #include "content/browser/resource_context.h" | 22 #include "content/browser/resource_context.h" |
21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
22 #include "net/base/default_origin_bound_cert_store.h" | 24 #include "net/base/default_origin_bound_cert_store.h" |
23 #include "net/base/origin_bound_cert_service.h" | 25 #include "net/base/origin_bound_cert_service.h" |
24 #include "net/ftp/ftp_network_layer.h" | 26 #include "net/ftp/ftp_network_layer.h" |
25 #include "net/http/http_cache.h" | 27 #include "net/http/http_cache.h" |
26 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 ProfileParams* profile_params) const { | 149 ProfileParams* profile_params) const { |
148 ChromeURLRequestContext* main_context = main_request_context(); | 150 ChromeURLRequestContext* main_context = main_request_context(); |
149 ChromeURLRequestContext* extensions_context = extensions_request_context(); | 151 ChromeURLRequestContext* extensions_context = extensions_request_context(); |
150 | 152 |
151 IOThread* const io_thread = profile_params->io_thread; | 153 IOThread* const io_thread = profile_params->io_thread; |
152 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 154 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
153 | 155 |
154 ApplyProfileParamsToContext(main_context); | 156 ApplyProfileParamsToContext(main_context); |
155 ApplyProfileParamsToContext(extensions_context); | 157 ApplyProfileParamsToContext(extensions_context); |
156 | 158 |
157 main_context->set_transport_security_state(transport_security_state()); | 159 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
158 extensions_context->set_transport_security_state(transport_security_state()); | 160 transport_security_state_.reset(new net::TransportSecurityState( |
161 command_line.GetSwitchValueASCII(switches::kHstsHosts))); | |
162 | |
163 main_context->set_transport_security_state(transport_security_state_.get()); | |
wtc
2012/01/06 18:45:52
One reason I am confused is this code: it seems to
agl
2012/01/06 19:08:47
I don't believe so. There's a main_context (a.k.a.
| |
164 extensions_context->set_transport_security_state( | |
165 transport_security_state_.get()); | |
159 | 166 |
160 main_context->set_net_log(io_thread->net_log()); | 167 main_context->set_net_log(io_thread->net_log()); |
161 extensions_context->set_net_log(io_thread->net_log()); | 168 extensions_context->set_net_log(io_thread->net_log()); |
162 | 169 |
163 main_context->set_network_delegate(network_delegate()); | 170 main_context->set_network_delegate(network_delegate()); |
164 | 171 |
165 main_context->set_host_resolver( | 172 main_context->set_host_resolver( |
166 io_thread_globals->host_resolver.get()); | 173 io_thread_globals->host_resolver.get()); |
167 main_context->set_cert_verifier( | 174 main_context->set_cert_verifier( |
168 io_thread_globals->cert_verifier.get()); | 175 io_thread_globals->cert_verifier.get()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 scoped_refptr<ChromeURLRequestContext> | 267 scoped_refptr<ChromeURLRequestContext> |
261 OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext( | 268 OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext( |
262 scoped_refptr<ChromeURLRequestContext> main_context, | 269 scoped_refptr<ChromeURLRequestContext> main_context, |
263 const std::string& app_id) const { | 270 const std::string& app_id) const { |
264 // We create per-app contexts on demand, unlike the others above. | 271 // We create per-app contexts on demand, unlike the others above. |
265 scoped_refptr<ChromeURLRequestContext> app_request_context = | 272 scoped_refptr<ChromeURLRequestContext> app_request_context = |
266 InitializeAppRequestContext(main_context, app_id); | 273 InitializeAppRequestContext(main_context, app_id); |
267 DCHECK(app_request_context); | 274 DCHECK(app_request_context); |
268 return app_request_context; | 275 return app_request_context; |
269 } | 276 } |
OLD | NEW |