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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 | 257 |
257 if (main_request_context_.get()) | 258 if (main_request_context_.get()) |
258 main_request_context_->AssertNoURLRequests(); | 259 main_request_context_->AssertNoURLRequests(); |
259 if (extensions_request_context_.get()) | 260 if (extensions_request_context_.get()) |
260 extensions_request_context_->AssertNoURLRequests(); | 261 extensions_request_context_->AssertNoURLRequests(); |
261 for (AppRequestContextMap::iterator it = app_request_context_map_.begin(); | 262 for (AppRequestContextMap::iterator it = app_request_context_map_.begin(); |
262 it != app_request_context_map_.end(); ++it) { | 263 it != app_request_context_map_.end(); ++it) { |
263 it->second->AssertNoURLRequests(); | 264 it->second->AssertNoURLRequests(); |
264 delete it->second; | 265 delete it->second; |
265 } | 266 } |
267 chrome_browser_net::CacheStats* cache_stats = GetCacheStats(); | |
268 if (cache_stats) | |
269 cache_stats->UnregisterMainURLRequestContext(main_request_context_.get()); | |
266 } | 270 } |
267 | 271 |
268 // static | 272 // static |
269 ProfileIOData* ProfileIOData::FromResourceContext( | 273 ProfileIOData* ProfileIOData::FromResourceContext( |
270 content::ResourceContext* rc) { | 274 content::ResourceContext* rc) { |
271 return (static_cast<ResourceContext*>(rc))->io_data_; | 275 return (static_cast<ResourceContext*>(rc))->io_data_; |
272 } | 276 } |
273 | 277 |
274 // static | 278 // static |
275 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 279 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 IOThread* const io_thread = profile_params_->io_thread; | 453 IOThread* const io_thread = profile_params_->io_thread; |
450 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 454 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
451 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 455 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
452 | 456 |
453 // Create the common request contexts. | 457 // Create the common request contexts. |
454 main_request_context_.reset(new ChromeURLRequestContext); | 458 main_request_context_.reset(new ChromeURLRequestContext); |
455 extensions_request_context_.reset(new ChromeURLRequestContext); | 459 extensions_request_context_.reset(new ChromeURLRequestContext); |
456 | 460 |
457 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); | 461 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); |
458 | 462 |
463 chrome_browser_net::CacheStats* cache_stats = GetCacheStats(); | |
464 if (cache_stats) | |
465 cache_stats->RegisterMainURLRequestContext(main_request_context_.get()); | |
466 | |
459 network_delegate_.reset(new ChromeNetworkDelegate( | 467 network_delegate_.reset(new ChromeNetworkDelegate( |
460 io_thread_globals->extension_event_router_forwarder.get(), | 468 io_thread_globals->extension_event_router_forwarder.get(), |
461 profile_params_->extension_info_map, | 469 profile_params_->extension_info_map, |
462 url_blacklist_manager_.get(), | 470 url_blacklist_manager_.get(), |
463 profile_params_->profile, | 471 profile_params_->profile, |
464 profile_params_->cookie_settings, | 472 profile_params_->cookie_settings, |
465 &enable_referrers_)); | 473 &enable_referrers_, |
474 cache_stats)); | |
466 | 475 |
467 fraudulent_certificate_reporter_.reset( | 476 fraudulent_certificate_reporter_.reset( |
468 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 477 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
469 main_request_context_.get())); | 478 main_request_context_.get())); |
470 | 479 |
471 proxy_service_.reset( | 480 proxy_service_.reset( |
472 ProxyServiceFactory::CreateProxyService( | 481 ProxyServiceFactory::CreateProxyService( |
473 io_thread->net_log(), | 482 io_thread->net_log(), |
474 io_thread_globals->proxy_script_fetcher_context.get(), | 483 io_thread_globals->proxy_script_fetcher_context.get(), |
475 profile_params_->proxy_config_service.release(), | 484 profile_params_->proxy_config_service.release(), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
576 } | 585 } |
577 | 586 |
578 void ProfileIOData::set_server_bound_cert_service( | 587 void ProfileIOData::set_server_bound_cert_service( |
579 net::ServerBoundCertService* server_bound_cert_service) const { | 588 net::ServerBoundCertService* server_bound_cert_service) const { |
580 server_bound_cert_service_.reset(server_bound_cert_service); | 589 server_bound_cert_service_.reset(server_bound_cert_service); |
581 } | 590 } |
582 | 591 |
583 void ProfileIOData::DestroyResourceContext() { | 592 void ProfileIOData::DestroyResourceContext() { |
584 resource_context_.reset(); | 593 resource_context_.reset(); |
585 } | 594 } |
595 | |
596 chrome_browser_net::CacheStats* ProfileIOData::GetCacheStats() const { | |
rvargas (doing something else)
2012/07/26 02:13:43
ditto
tburkard
2012/07/26 02:50:54
Done.
| |
597 DCHECK(profile_params_.get()); | |
rvargas (doing something else)
2012/07/26 02:13:43
We usually don't dcheck things that will crash the
tburkard
2012/07/26 02:50:54
Done.
| |
598 return profile_params_->io_thread->globals()->cache_stats.get(); | |
599 } | |
OLD | NEW |