| 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/chrome_plugin_service_filter.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 20 #include "chrome/browser/extensions/extension_info_map.h" | 21 #include "chrome/browser/extensions/extension_info_map.h" |
| 21 #include "chrome/browser/extensions/extension_protocols.h" | 22 #include "chrome/browser/extensions/extension_protocols.h" |
| 22 #include "chrome/browser/io_thread.h" | 23 #include "chrome/browser/io_thread.h" |
| 23 #include "chrome/browser/media/media_internals.h" | 24 #include "chrome/browser/media/media_internals.h" |
| 24 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 25 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 26 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
| 26 #include "chrome/browser/net/chrome_net_log.h" | 27 #include "chrome/browser/net/chrome_net_log.h" |
| 27 #include "chrome/browser/net/chrome_network_delegate.h" | 28 #include "chrome/browser/net/chrome_network_delegate.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return profile->GetPrerenderManager(); | 185 return profile->GetPrerenderManager(); |
| 185 return NULL; | 186 return NULL; |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace | 189 } // namespace |
| 189 | 190 |
| 190 void ProfileIOData::InitializeProfileParams(Profile* profile) { | 191 void ProfileIOData::InitializeProfileParams(Profile* profile) { |
| 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 192 PrefService* pref_service = profile->GetPrefs(); | 193 PrefService* pref_service = profile->GetPrefs(); |
| 193 | 194 |
| 195 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 196 profile, resource_context_); |
| 197 |
| 194 scoped_ptr<ProfileParams> params(new ProfileParams); | 198 scoped_ptr<ProfileParams> params(new ProfileParams); |
| 195 params->is_incognito = profile->IsOffTheRecord(); | 199 params->is_incognito = profile->IsOffTheRecord(); |
| 196 params->clear_local_state_on_exit = | 200 params->clear_local_state_on_exit = |
| 197 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | 201 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); |
| 198 | 202 |
| 199 params->appcache_service = profile->GetAppCacheService(); | 203 params->appcache_service = profile->GetAppCacheService(); |
| 200 | 204 |
| 201 // Set up Accept-Language and Accept-Charset header values | 205 // Set up Accept-Language and Accept-Charset header values |
| 202 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 206 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 203 pref_service->GetString(prefs::kAcceptLanguages)); | 207 pref_service->GetString(prefs::kAcceptLanguages)); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 context->set_transport_security_state( | 505 context->set_transport_security_state( |
| 502 profile_params_->transport_security_state); | 506 profile_params_->transport_security_state); |
| 503 context->set_ssl_config_service(profile_params_->ssl_config_service); | 507 context->set_ssl_config_service(profile_params_->ssl_config_service); |
| 504 } | 508 } |
| 505 | 509 |
| 506 void ProfileIOData::ShutdownOnUIThread() { | 510 void ProfileIOData::ShutdownOnUIThread() { |
| 507 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 511 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 508 enable_referrers_.Destroy(); | 512 enable_referrers_.Destroy(); |
| 509 clear_local_state_on_exit_.Destroy(); | 513 clear_local_state_on_exit_.Destroy(); |
| 510 safe_browsing_enabled_.Destroy(); | 514 safe_browsing_enabled_.Destroy(); |
| 515 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 516 resource_context_); |
| 511 BrowserThread::PostTask( | 517 BrowserThread::PostTask( |
| 512 BrowserThread::IO, FROM_HERE, | 518 BrowserThread::IO, FROM_HERE, |
| 513 base::Bind( | 519 base::Bind( |
| 514 &ResourceDispatcherHost::CancelRequestsForContext, | 520 &ResourceDispatcherHost::CancelRequestsForContext, |
| 515 base::Unretained(g_browser_process->resource_dispatcher_host()), | 521 base::Unretained(g_browser_process->resource_dispatcher_host()), |
| 516 &resource_context_)); | 522 &resource_context_)); |
| 517 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 523 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 518 new DeleteTask<ProfileIOData>(this)); | 524 new DeleteTask<ProfileIOData>(this)); |
| 519 if (!posted) | 525 if (!posted) |
| 520 delete this; | 526 delete this; |
| 521 } | 527 } |
| OLD | NEW |