OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/content_settings/host_content_settings_map.h" | 21 #include "chrome/browser/content_settings/host_content_settings_map.h" |
22 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 22 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
23 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 23 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
24 #include "chrome/browser/download/download_service.h" | 24 #include "chrome/browser/download/download_service.h" |
25 #include "chrome/browser/download/download_service_factory.h" | 25 #include "chrome/browser/download/download_service_factory.h" |
26 #include "chrome/browser/extensions/extension_info_map.h" | 26 #include "chrome/browser/extensions/extension_info_map.h" |
27 #include "chrome/browser/extensions/extension_protocols.h" | 27 #include "chrome/browser/extensions/extension_protocols.h" |
28 #include "chrome/browser/extensions/extension_resource_protocols.h" | 28 #include "chrome/browser/extensions/extension_resource_protocols.h" |
29 #include "chrome/browser/extensions/extension_system.h" | 29 #include "chrome/browser/extensions/extension_system.h" |
30 #include "chrome/browser/io_thread.h" | 30 #include "chrome/browser/io_thread.h" |
| 31 #include "chrome/browser/net/cache_stats.h" |
31 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 32 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
32 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" | 33 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
33 #include "chrome/browser/net/chrome_net_log.h" | 34 #include "chrome/browser/net/chrome_net_log.h" |
34 #include "chrome/browser/net/chrome_network_delegate.h" | 35 #include "chrome/browser/net/chrome_network_delegate.h" |
35 #include "chrome/browser/net/http_server_properties_manager.h" | 36 #include "chrome/browser/net/http_server_properties_manager.h" |
36 #include "chrome/browser/net/proxy_service_factory.h" | 37 #include "chrome/browser/net/proxy_service_factory.h" |
37 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 38 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
38 #include "chrome/browser/net/transport_security_persister.h" | 39 #include "chrome/browser/net/transport_security_persister.h" |
39 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 40 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
40 #include "chrome/browser/policy/url_blacklist_manager.h" | 41 #include "chrome/browser/policy/url_blacklist_manager.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 #endif | 209 #endif |
209 | 210 |
210 initialized_on_UI_thread_ = true; | 211 initialized_on_UI_thread_ = true; |
211 | 212 |
212 // We need to make sure that content initializes its own data structures that | 213 // We need to make sure that content initializes its own data structures that |
213 // are associated with each ResourceContext because we might post this | 214 // are associated with each ResourceContext because we might post this |
214 // object to the IO thread after this function. | 215 // object to the IO thread after this function. |
215 BrowserContext::EnsureResourceContextInitialized(profile); | 216 BrowserContext::EnsureResourceContextInitialized(profile); |
216 } | 217 } |
217 | 218 |
218 ProfileIOData::AppRequestContext::AppRequestContext() {} | 219 ProfileIOData::AppRequestContext::AppRequestContext( |
| 220 chrome_browser_net::CacheStats* cache_stats) |
| 221 : ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_APP, |
| 222 cache_stats) { |
| 223 } |
219 | 224 |
220 void ProfileIOData::AppRequestContext::SetCookieStore( | 225 void ProfileIOData::AppRequestContext::SetCookieStore( |
221 net::CookieStore* cookie_store) { | 226 net::CookieStore* cookie_store) { |
222 cookie_store_ = cookie_store; | 227 cookie_store_ = cookie_store; |
223 set_cookie_store(cookie_store); | 228 set_cookie_store(cookie_store); |
224 } | 229 } |
225 | 230 |
226 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( | 231 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( |
227 net::HttpTransactionFactory* http_factory) { | 232 net::HttpTransactionFactory* http_factory) { |
228 http_factory_.reset(http_factory); | 233 http_factory_.reset(http_factory); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 449 |
445 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 450 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
446 CHECK(initialized_on_UI_thread_); | 451 CHECK(initialized_on_UI_thread_); |
447 | 452 |
448 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. | 453 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. |
449 CHECK(profile_params_.get()); | 454 CHECK(profile_params_.get()); |
450 | 455 |
451 IOThread* const io_thread = profile_params_->io_thread; | 456 IOThread* const io_thread = profile_params_->io_thread; |
452 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 457 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
453 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 458 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 459 cache_stats_ = GetCacheStats(io_thread_globals); |
454 | 460 |
455 // Create the common request contexts. | 461 // Create the common request contexts. |
456 main_request_context_.reset(new ChromeURLRequestContext); | 462 main_request_context_.reset( |
457 extensions_request_context_.reset(new ChromeURLRequestContext); | 463 new ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_MAIN, |
| 464 cache_stats_)); |
| 465 extensions_request_context_.reset( |
| 466 new ChromeURLRequestContext( |
| 467 ChromeURLRequestContext::CONTEXT_TYPE_EXTENSIONS, |
| 468 cache_stats_)); |
458 | 469 |
459 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); | 470 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); |
460 | 471 |
461 network_delegate_.reset(new ChromeNetworkDelegate( | 472 network_delegate_.reset(new ChromeNetworkDelegate( |
462 io_thread_globals->extension_event_router_forwarder.get(), | 473 io_thread_globals->extension_event_router_forwarder.get(), |
463 profile_params_->extension_info_map, | 474 profile_params_->extension_info_map, |
464 url_blacklist_manager_.get(), | 475 url_blacklist_manager_.get(), |
465 profile_params_->profile, | 476 profile_params_->profile, |
466 profile_params_->cookie_settings, | 477 profile_params_->cookie_settings, |
467 &enable_referrers_)); | 478 &enable_referrers_, |
| 479 cache_stats_)); |
468 | 480 |
469 fraudulent_certificate_reporter_.reset( | 481 fraudulent_certificate_reporter_.reset( |
470 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 482 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
471 main_request_context_.get())); | 483 main_request_context_.get())); |
472 | 484 |
473 proxy_service_.reset( | 485 proxy_service_.reset( |
474 ProxyServiceFactory::CreateProxyService( | 486 ProxyServiceFactory::CreateProxyService( |
475 io_thread->net_log(), | 487 io_thread->net_log(), |
476 io_thread_globals->proxy_script_fetcher_context.get(), | 488 io_thread_globals->proxy_script_fetcher_context.get(), |
477 profile_params_->proxy_config_service.release(), | 489 profile_params_->proxy_config_service.release(), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 590 } |
579 | 591 |
580 void ProfileIOData::set_server_bound_cert_service( | 592 void ProfileIOData::set_server_bound_cert_service( |
581 net::ServerBoundCertService* server_bound_cert_service) const { | 593 net::ServerBoundCertService* server_bound_cert_service) const { |
582 server_bound_cert_service_.reset(server_bound_cert_service); | 594 server_bound_cert_service_.reset(server_bound_cert_service); |
583 } | 595 } |
584 | 596 |
585 void ProfileIOData::DestroyResourceContext() { | 597 void ProfileIOData::DestroyResourceContext() { |
586 resource_context_.reset(); | 598 resource_context_.reset(); |
587 } | 599 } |
OLD | NEW |