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" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 const base::Callback<Profile*(void)>& profile_getter) { | 182 const base::Callback<Profile*(void)>& profile_getter) { |
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
184 Profile* profile = profile_getter.Run(); | 184 Profile* profile = profile_getter.Run(); |
185 if (profile) | 185 if (profile) |
186 return profile->GetPrerenderManager(); | 186 return profile->GetPrerenderManager(); |
187 return NULL; | 187 return NULL; |
188 } | 188 } |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 | 191 |
192 void ProfileIOData::InitializeProfileParams(Profile* profile) { | 192 void ProfileIOData::InitializeProfileParams(Profile* profile) { |
willchan no longer on Chromium
2011/09/06 20:49:27
Please rename this to InitializeOnUIThread() since
Joao da Silva
2011/09/06 21:07:16
Done.
| |
193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
194 PrefService* pref_service = profile->GetPrefs(); | 194 PrefService* pref_service = profile->GetPrefs(); |
195 | 195 |
196 scoped_ptr<ProfileParams> params(new ProfileParams); | 196 scoped_ptr<ProfileParams> params(new ProfileParams); |
197 params->is_incognito = profile->IsOffTheRecord(); | 197 params->is_incognito = profile->IsOffTheRecord(); |
198 params->clear_local_state_on_exit = | 198 params->clear_local_state_on_exit = |
199 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | 199 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); |
200 | 200 |
201 params->appcache_service = profile->GetAppCacheService(); | 201 params->appcache_service = profile->GetAppCacheService(); |
202 | 202 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 params->blob_storage_context = profile->GetBlobStorageContext(); | 237 params->blob_storage_context = profile->GetBlobStorageContext(); |
238 params->file_system_context = profile->GetFileSystemContext(); | 238 params->file_system_context = profile->GetFileSystemContext(); |
239 params->quota_manager = profile->GetQuotaManager(); | 239 params->quota_manager = profile->GetQuotaManager(); |
240 params->extension_info_map = profile->GetExtensionInfoMap(); | 240 params->extension_info_map = profile->GetExtensionInfoMap(); |
241 params->notification_service = | 241 params->notification_service = |
242 DesktopNotificationServiceFactory::GetForProfile(profile); | 242 DesktopNotificationServiceFactory::GetForProfile(profile); |
243 params->prerender_manager_getter = | 243 params->prerender_manager_getter = |
244 base::Bind(&GetPrerenderManagerOnUI, profile_getter); | 244 base::Bind(&GetPrerenderManagerOnUI, profile_getter); |
245 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); | 245 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); |
246 | 246 |
247 #if defined(ENABLE_CONFIGURATION_POLICY) | |
248 params->url_blacklist_manager.reset( | |
249 new policy::URLBlacklistManager(pref_service)); | |
250 #endif | |
251 | |
252 params->proxy_config_service.reset( | 247 params->proxy_config_service.reset( |
253 ProxyServiceFactory::CreateProxyConfigService( | 248 ProxyServiceFactory::CreateProxyConfigService( |
254 profile->GetProxyConfigTracker())); | 249 profile->GetProxyConfigTracker())); |
255 params->profile = profile; | 250 params->profile = profile; |
256 profile_params_.reset(params.release()); | 251 profile_params_.reset(params.release()); |
252 | |
253 // The URLBlacklistManager has to be created on the UI thread to register | |
254 // observers of |pref_service|, and it also has to clean up on | |
255 // ShutdownOnUIThread to release these observers on the right thread. | |
256 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | |
257 // in particular when this ProfileIOData isn't |initialized_| during deletion. | |
258 #if defined(ENABLE_CONFIGURATION_POLICY) | |
259 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); | |
260 #endif | |
257 } | 261 } |
258 | 262 |
259 ProfileIOData::AppRequestContext::AppRequestContext() {} | 263 ProfileIOData::AppRequestContext::AppRequestContext() {} |
260 ProfileIOData::AppRequestContext::~AppRequestContext() {} | 264 ProfileIOData::AppRequestContext::~AppRequestContext() {} |
261 | 265 |
262 void ProfileIOData::AppRequestContext::SetCookieStore( | 266 void ProfileIOData::AppRequestContext::SetCookieStore( |
263 net::CookieStore* cookie_store) { | 267 net::CookieStore* cookie_store) { |
264 cookie_store_ = cookie_store; | 268 cookie_store_ = cookie_store; |
265 set_cookie_store(cookie_store); | 269 set_cookie_store(cookie_store); |
266 } | 270 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 main_request_context_ = new ChromeURLRequestContext; | 407 main_request_context_ = new ChromeURLRequestContext; |
404 extensions_request_context_ = new ChromeURLRequestContext; | 408 extensions_request_context_ = new ChromeURLRequestContext; |
405 | 409 |
406 profile_params_->appcache_service->set_request_context(main_request_context_); | 410 profile_params_->appcache_service->set_request_context(main_request_context_); |
407 | 411 |
408 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); | 412 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); |
409 | 413 |
410 network_delegate_.reset(new ChromeNetworkDelegate( | 414 network_delegate_.reset(new ChromeNetworkDelegate( |
411 io_thread_globals->extension_event_router_forwarder.get(), | 415 io_thread_globals->extension_event_router_forwarder.get(), |
412 profile_params_->extension_info_map, | 416 profile_params_->extension_info_map, |
413 profile_params_->url_blacklist_manager.get(), | 417 url_blacklist_manager_.get(), |
414 profile_params_->profile, | 418 profile_params_->profile, |
415 &enable_referrers_)); | 419 &enable_referrers_)); |
416 | 420 |
417 dns_cert_checker_.reset( | 421 dns_cert_checker_.reset( |
418 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), | 422 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), |
419 main_request_context_)); | 423 main_request_context_)); |
420 | 424 |
421 proxy_service_.reset( | 425 proxy_service_.reset( |
422 ProxyServiceFactory::CreateProxyService( | 426 ProxyServiceFactory::CreateProxyService( |
423 io_thread->net_log(), | 427 io_thread->net_log(), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 database_tracker_ = profile_params_->database_tracker; | 477 database_tracker_ = profile_params_->database_tracker; |
474 appcache_service_ = profile_params_->appcache_service; | 478 appcache_service_ = profile_params_->appcache_service; |
475 blob_storage_context_ = profile_params_->blob_storage_context; | 479 blob_storage_context_ = profile_params_->blob_storage_context; |
476 file_system_context_ = profile_params_->file_system_context; | 480 file_system_context_ = profile_params_->file_system_context; |
477 quota_manager_ = profile_params_->quota_manager; | 481 quota_manager_ = profile_params_->quota_manager; |
478 host_zoom_map_ = profile_params_->host_zoom_map; | 482 host_zoom_map_ = profile_params_->host_zoom_map; |
479 host_content_settings_map_ = profile_params_->host_content_settings_map; | 483 host_content_settings_map_ = profile_params_->host_content_settings_map; |
480 notification_service_ = profile_params_->notification_service; | 484 notification_service_ = profile_params_->notification_service; |
481 extension_info_map_ = profile_params_->extension_info_map; | 485 extension_info_map_ = profile_params_->extension_info_map; |
482 prerender_manager_getter_ = profile_params_->prerender_manager_getter; | 486 prerender_manager_getter_ = profile_params_->prerender_manager_getter; |
483 url_blacklist_manager_.swap(profile_params_->url_blacklist_manager); | |
484 | 487 |
485 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); | 488 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); |
486 resource_context_.set_request_context(main_request_context_); | 489 resource_context_.set_request_context(main_request_context_); |
487 resource_context_.set_database_tracker(database_tracker_); | 490 resource_context_.set_database_tracker(database_tracker_); |
488 resource_context_.set_appcache_service(appcache_service_); | 491 resource_context_.set_appcache_service(appcache_service_); |
489 resource_context_.set_blob_storage_context(blob_storage_context_); | 492 resource_context_.set_blob_storage_context(blob_storage_context_); |
490 resource_context_.set_file_system_context(file_system_context_); | 493 resource_context_.set_file_system_context(file_system_context_); |
491 resource_context_.set_quota_manager(quota_manager_); | 494 resource_context_.set_quota_manager(quota_manager_); |
492 resource_context_.set_host_zoom_map(host_zoom_map_); | 495 resource_context_.set_host_zoom_map(host_zoom_map_); |
493 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); | 496 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 533 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
531 new DeleteTask<ProfileIOData>(this)); | 534 new DeleteTask<ProfileIOData>(this)); |
532 if (!posted) | 535 if (!posted) |
533 delete this; | 536 delete this; |
534 } | 537 } |
535 | 538 |
536 void ProfileIOData::set_origin_bound_cert_service( | 539 void ProfileIOData::set_origin_bound_cert_service( |
537 net::OriginBoundCertService* origin_bound_cert_service) const { | 540 net::OriginBoundCertService* origin_bound_cert_service) const { |
538 origin_bound_cert_service_.reset(origin_bound_cert_service); | 541 origin_bound_cert_service_.reset(origin_bound_cert_service); |
539 } | 542 } |
OLD | NEW |