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_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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/task.h" | 16 #include "base/task.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
20 #include "chrome/browser/extensions/extension_info_map.h" | 20 #include "chrome/browser/extensions/extension_info_map.h" |
21 #include "chrome/browser/extensions/extension_protocols.h" | 21 #include "chrome/browser/extensions/extension_protocols.h" |
22 #include "chrome/browser/io_thread.h" | 22 #include "chrome/browser/io_thread.h" |
23 #include "chrome/browser/media/media_internals.h" | 23 #include "chrome/browser/media/media_internals.h" |
24 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 24 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
26 #include "chrome/browser/net/chrome_net_log.h" | 26 #include "chrome/browser/net/chrome_net_log.h" |
27 #include "chrome/browser/net/chrome_network_delegate.h" | 27 #include "chrome/browser/net/chrome_network_delegate.h" |
| 28 #include "chrome/browser/net/http_server_properties_manager.h" |
28 #include "chrome/browser/net/pref_proxy_config_service.h" | 29 #include "chrome/browser/net/pref_proxy_config_service.h" |
29 #include "chrome/browser/net/proxy_service_factory.h" | 30 #include "chrome/browser/net/proxy_service_factory.h" |
30 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
31 #include "chrome/browser/policy/url_blacklist_manager.h" | 32 #include "chrome/browser/policy/url_blacklist_manager.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
33 #include "chrome/browser/prerender/prerender_manager.h" | 34 #include "chrome/browser/prerender/prerender_manager.h" |
34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
36 #include "chrome/browser/transport_security_persister.h" | 37 #include "chrome/browser/transport_security_persister.h" |
37 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 38 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 params->prerender_manager_getter = | 248 params->prerender_manager_getter = |
248 base::Bind(&GetPrerenderManagerOnUI, profile_getter); | 249 base::Bind(&GetPrerenderManagerOnUI, profile_getter); |
249 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); | 250 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); |
250 | 251 |
251 params->proxy_config_service.reset( | 252 params->proxy_config_service.reset( |
252 ProxyServiceFactory::CreateProxyConfigService( | 253 ProxyServiceFactory::CreateProxyConfigService( |
253 profile->GetProxyConfigTracker())); | 254 profile->GetProxyConfigTracker())); |
254 params->profile = profile; | 255 params->profile = profile; |
255 profile_params_.reset(params.release()); | 256 profile_params_.reset(params.release()); |
256 | 257 |
257 // The URLBlacklistManager has to be created on the UI thread to register | 258 // URLBlacklistManager and HttpServerPropertiesManager have to be created on |
258 // observers of |pref_service|, and it also has to clean up on | 259 // the UI thread to register observers of |pref_service|, and it also has to |
259 // ShutdownOnUIThread to release these observers on the right thread. | 260 // clean up on ShutdownOnUIThread to release these observers on the right |
260 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 261 // thread. Don't pass it in |profile_params_| to make sure it is correctly |
261 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 262 // cleaned up, in particular when this ProfileIOData isn't |initialized_| |
| 263 // during deletion. |
262 #if defined(ENABLE_CONFIGURATION_POLICY) | 264 #if defined(ENABLE_CONFIGURATION_POLICY) |
263 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); | 265 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); |
264 #endif | 266 #endif |
| 267 http_server_properties_manager_.reset( |
| 268 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); |
| 269 |
265 } | 270 } |
266 | 271 |
267 ProfileIOData::AppRequestContext::AppRequestContext() {} | 272 ProfileIOData::AppRequestContext::AppRequestContext() {} |
268 ProfileIOData::AppRequestContext::~AppRequestContext() {} | 273 ProfileIOData::AppRequestContext::~AppRequestContext() {} |
269 | 274 |
270 void ProfileIOData::AppRequestContext::SetCookieStore( | 275 void ProfileIOData::AppRequestContext::SetCookieStore( |
271 net::CookieStore* cookie_store) { | 276 net::CookieStore* cookie_store) { |
272 cookie_store_ = cookie_store; | 277 cookie_store_ = cookie_store; |
273 set_cookie_store(cookie_store); | 278 set_cookie_store(cookie_store); |
274 } | 279 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 535 |
531 void ProfileIOData::ShutdownOnUIThread() { | 536 void ProfileIOData::ShutdownOnUIThread() { |
532 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
533 enable_referrers_.Destroy(); | 538 enable_referrers_.Destroy(); |
534 clear_local_state_on_exit_.Destroy(); | 539 clear_local_state_on_exit_.Destroy(); |
535 safe_browsing_enabled_.Destroy(); | 540 safe_browsing_enabled_.Destroy(); |
536 #if defined(ENABLE_CONFIGURATION_POLICY) | 541 #if defined(ENABLE_CONFIGURATION_POLICY) |
537 if (url_blacklist_manager_.get()) | 542 if (url_blacklist_manager_.get()) |
538 url_blacklist_manager_->ShutdownOnUIThread(); | 543 url_blacklist_manager_->ShutdownOnUIThread(); |
539 #endif | 544 #endif |
| 545 if (http_server_properties_manager_.get()) |
| 546 http_server_properties_manager_->ShutdownOnUIThread(); |
540 BrowserThread::PostTask( | 547 BrowserThread::PostTask( |
541 BrowserThread::IO, FROM_HERE, | 548 BrowserThread::IO, FROM_HERE, |
542 base::Bind( | 549 base::Bind( |
543 &ResourceDispatcherHost::CancelRequestsForContext, | 550 &ResourceDispatcherHost::CancelRequestsForContext, |
544 base::Unretained(g_browser_process->resource_dispatcher_host()), | 551 base::Unretained(g_browser_process->resource_dispatcher_host()), |
545 &resource_context_)); | 552 &resource_context_)); |
546 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 553 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
547 new DeleteTask<ProfileIOData>(this)); | 554 new DeleteTask<ProfileIOData>(this)); |
548 if (!posted) | 555 if (!posted) |
549 delete this; | 556 delete this; |
550 } | 557 } |
551 | 558 |
552 void ProfileIOData::set_origin_bound_cert_service( | 559 void ProfileIOData::set_origin_bound_cert_service( |
553 net::OriginBoundCertService* origin_bound_cert_service) const { | 560 net::OriginBoundCertService* origin_bound_cert_service) const { |
554 origin_bound_cert_service_.reset(origin_bound_cert_service); | 561 origin_bound_cert_service_.reset(origin_bound_cert_service); |
555 } | 562 } |
OLD | NEW |