| 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/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/browser/browser_thread.h" | 25 #include "content/browser/browser_thread.h" |
| 26 #include "content/browser/resource_context.h" | 26 #include "content/browser/resource_context.h" |
| 27 #include "net/base/origin_bound_cert_service.h" | 27 #include "net/base/origin_bound_cert_service.h" |
| 28 #include "net/ftp/ftp_network_layer.h" | 28 #include "net/ftp/ftp_network_layer.h" |
| 29 #include "net/http/http_cache.h" | 29 #include "net/http/http_cache.h" |
| 30 #include "net/url_request/url_request_job_factory.h" | 30 #include "net/url_request/url_request_job_factory.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 void DeleteTransportSecurityStateSinceOnIOThread( | 34 void ClearNetworkingHistorySinceOnIOThread( |
| 35 ProfileImplIOData* io_data, base::Time time) { | 35 ProfileImplIOData* io_data, base::Time time) { |
| 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 37 io_data->transport_security_state()->DeleteSince(time); | 37 io_data->transport_security_state()->DeleteSince(time); |
| 38 io_data->http_server_properties()->DeleteAll(); |
| 38 } | 39 } |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 ProfileImplIOData::Handle::Handle(Profile* profile) | 43 ProfileImplIOData::Handle::Handle(Profile* profile) |
| 43 : io_data_(new ProfileImplIOData), | 44 : io_data_(new ProfileImplIOData), |
| 44 profile_(profile), | 45 profile_(profile), |
| 45 initialized_(false) { | 46 initialized_(false) { |
| 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 47 DCHECK(profile); | 48 DCHECK(profile); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 180 |
| 180 | 181 |
| 181 ChromeURLRequestContextGetter* context = | 182 ChromeURLRequestContextGetter* context = |
| 182 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 183 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
| 183 profile_, io_data_, app_id); | 184 profile_, io_data_, app_id); |
| 184 app_request_context_getter_map_[app_id] = context; | 185 app_request_context_getter_map_[app_id] = context; |
| 185 | 186 |
| 186 return context; | 187 return context; |
| 187 } | 188 } |
| 188 | 189 |
| 189 void ProfileImplIOData::Handle::DeleteTransportSecurityStateSince( | 190 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( |
| 190 base::Time time) { | 191 base::Time time) { |
| 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 192 LazyInitialize(); | 193 LazyInitialize(); |
| 193 | 194 |
| 194 BrowserThread::PostTask( | 195 BrowserThread::PostTask( |
| 195 BrowserThread::IO, FROM_HERE, | 196 BrowserThread::IO, FROM_HERE, |
| 196 base::Bind( | 197 base::Bind( |
| 197 &DeleteTransportSecurityStateSinceOnIOThread, | 198 &ClearNetworkingHistorySinceOnIOThread, |
| 198 io_data_, | 199 io_data_, |
| 199 time)); | 200 time)); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void ProfileImplIOData::Handle::LazyInitialize() const { | 203 void ProfileImplIOData::Handle::LazyInitialize() const { |
| 203 if (!initialized_) { | 204 if (!initialized_) { |
| 204 io_data_->InitializeOnUIThread(profile_); | 205 io_data_->InitializeOnUIThread(profile_); |
| 205 ChromeNetworkDelegate::InitializeReferrersEnabled( | 206 ChromeNetworkDelegate::InitializeReferrersEnabled( |
| 206 io_data_->enable_referrers(), profile_->GetPrefs()); | 207 io_data_->enable_referrers(), profile_->GetPrefs()); |
| 207 io_data_->clear_local_state_on_exit()->Init( | 208 io_data_->clear_local_state_on_exit()->Init( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 transport_security_state()); | 254 transport_security_state()); |
| 254 extensions_context->set_transport_security_state(transport_security_state()); | 255 extensions_context->set_transport_security_state(transport_security_state()); |
| 255 | 256 |
| 256 main_context->set_net_log(io_thread->net_log()); | 257 main_context->set_net_log(io_thread->net_log()); |
| 257 media_request_context_->set_net_log(io_thread->net_log()); | 258 media_request_context_->set_net_log(io_thread->net_log()); |
| 258 extensions_context->set_net_log(io_thread->net_log()); | 259 extensions_context->set_net_log(io_thread->net_log()); |
| 259 | 260 |
| 260 main_context->set_network_delegate(network_delegate()); | 261 main_context->set_network_delegate(network_delegate()); |
| 261 media_request_context_->set_network_delegate(network_delegate()); | 262 media_request_context_->set_network_delegate(network_delegate()); |
| 262 | 263 |
| 264 main_context->set_http_server_properties(http_server_properties()); |
| 265 media_request_context_->set_http_server_properties(http_server_properties()); |
| 266 |
| 263 main_context->set_host_resolver( | 267 main_context->set_host_resolver( |
| 264 io_thread_globals->host_resolver.get()); | 268 io_thread_globals->host_resolver.get()); |
| 265 media_request_context_->set_host_resolver( | 269 media_request_context_->set_host_resolver( |
| 266 io_thread_globals->host_resolver.get()); | 270 io_thread_globals->host_resolver.get()); |
| 267 main_context->set_cert_verifier( | 271 main_context->set_cert_verifier( |
| 268 io_thread_globals->cert_verifier.get()); | 272 io_thread_globals->cert_verifier.get()); |
| 269 media_request_context_->set_cert_verifier( | 273 media_request_context_->set_cert_verifier( |
| 270 io_thread_globals->cert_verifier.get()); | 274 io_thread_globals->cert_verifier.get()); |
| 271 main_context->set_dnsrr_resolver( | 275 main_context->set_dnsrr_resolver( |
| 272 io_thread_globals->dnsrr_resolver.get()); | 276 io_thread_globals->dnsrr_resolver.get()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 net::HttpCache* main_cache = new net::HttpCache( | 350 net::HttpCache* main_cache = new net::HttpCache( |
| 347 main_context->host_resolver(), | 351 main_context->host_resolver(), |
| 348 main_context->cert_verifier(), | 352 main_context->cert_verifier(), |
| 349 main_context->origin_bound_cert_service(), | 353 main_context->origin_bound_cert_service(), |
| 350 main_context->dnsrr_resolver(), | 354 main_context->dnsrr_resolver(), |
| 351 main_context->dns_cert_checker(), | 355 main_context->dns_cert_checker(), |
| 352 main_context->proxy_service(), | 356 main_context->proxy_service(), |
| 353 main_context->ssl_config_service(), | 357 main_context->ssl_config_service(), |
| 354 main_context->http_auth_handler_factory(), | 358 main_context->http_auth_handler_factory(), |
| 355 main_context->network_delegate(), | 359 main_context->network_delegate(), |
| 360 main_context->http_server_properties(), |
| 356 main_context->net_log(), | 361 main_context->net_log(), |
| 357 main_backend); | 362 main_backend); |
| 358 | 363 |
| 359 net::HttpCache::DefaultBackend* media_backend = | 364 net::HttpCache::DefaultBackend* media_backend = |
| 360 new net::HttpCache::DefaultBackend( | 365 new net::HttpCache::DefaultBackend( |
| 361 net::MEDIA_CACHE, lazy_params_->media_cache_path, | 366 net::MEDIA_CACHE, lazy_params_->media_cache_path, |
| 362 lazy_params_->media_cache_max_size, | 367 lazy_params_->media_cache_max_size, |
| 363 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 368 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 364 net::HttpNetworkSession* main_network_session = main_cache->GetSession(); | 369 net::HttpNetworkSession* main_network_session = main_cache->GetSession(); |
| 365 net::HttpCache* media_cache = | 370 net::HttpCache* media_cache = |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 scoped_refptr<ChromeURLRequestContext> | 467 scoped_refptr<ChromeURLRequestContext> |
| 463 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 468 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 464 scoped_refptr<ChromeURLRequestContext> main_context, | 469 scoped_refptr<ChromeURLRequestContext> main_context, |
| 465 const std::string& app_id) const { | 470 const std::string& app_id) const { |
| 466 // We create per-app contexts on demand, unlike the others above. | 471 // We create per-app contexts on demand, unlike the others above. |
| 467 scoped_refptr<ChromeURLRequestContext> app_request_context = | 472 scoped_refptr<ChromeURLRequestContext> app_request_context = |
| 468 InitializeAppRequestContext(main_context, app_id); | 473 InitializeAppRequestContext(main_context, app_id); |
| 469 DCHECK(app_request_context); | 474 DCHECK(app_request_context); |
| 470 return app_request_context; | 475 return app_request_context; |
| 471 } | 476 } |
| OLD | NEW |