| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } // namespace | 206 } // namespace |
| 207 | 207 |
| 208 void ProfileIOData::InitializeProfileParams(Profile* profile) { | 208 void ProfileIOData::InitializeProfileParams(Profile* profile) { |
| 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 210 PrefService* pref_service = profile->GetPrefs(); | 210 PrefService* pref_service = profile->GetPrefs(); |
| 211 | 211 |
| 212 scoped_ptr<ProfileParams> params(new ProfileParams); | 212 scoped_ptr<ProfileParams> params(new ProfileParams); |
| 213 params->is_incognito = profile->IsOffTheRecord(); | 213 params->is_incognito = profile->IsOffTheRecord(); |
| 214 params->clear_local_state_on_exit = | 214 params->clear_local_state_on_exit = |
| 215 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | 215 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); |
| 216 params->safe_browsing_enabled = profile->SafeBrowsingEnabled(); |
| 216 | 217 |
| 217 params->appcache_service = profile->GetAppCacheService(); | 218 params->appcache_service = profile->GetAppCacheService(); |
| 218 | 219 |
| 219 // Set up Accept-Language and Accept-Charset header values | 220 // Set up Accept-Language and Accept-Charset header values |
| 220 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 221 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 221 pref_service->GetString(prefs::kAcceptLanguages)); | 222 pref_service->GetString(prefs::kAcceptLanguages)); |
| 222 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); | 223 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); |
| 223 params->accept_charset = | 224 params->accept_charset = |
| 224 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); | 225 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); |
| 225 | 226 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 486 |
| 486 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); | 487 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); |
| 487 resource_context_.set_request_context(main_request_context_); | 488 resource_context_.set_request_context(main_request_context_); |
| 488 resource_context_.set_database_tracker(database_tracker_); | 489 resource_context_.set_database_tracker(database_tracker_); |
| 489 resource_context_.set_appcache_service(appcache_service_); | 490 resource_context_.set_appcache_service(appcache_service_); |
| 490 resource_context_.set_blob_storage_context(blob_storage_context_); | 491 resource_context_.set_blob_storage_context(blob_storage_context_); |
| 491 resource_context_.set_file_system_context(file_system_context_); | 492 resource_context_.set_file_system_context(file_system_context_); |
| 492 resource_context_.set_quota_manager(quota_manager_); | 493 resource_context_.set_quota_manager(quota_manager_); |
| 493 resource_context_.set_host_zoom_map(host_zoom_map_); | 494 resource_context_.set_host_zoom_map(host_zoom_map_); |
| 494 resource_context_.set_prerender_manager(prerender_manager_); | 495 resource_context_.set_prerender_manager(prerender_manager_); |
| 496 resource_context_.set_safe_browsing_enabled( |
| 497 profile_params_->safe_browsing_enabled); |
| 495 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); | 498 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); |
| 496 | 499 |
| 497 LazyInitializeInternal(profile_params_.get()); | 500 LazyInitializeInternal(profile_params_.get()); |
| 498 | 501 |
| 499 profile_params_.reset(); | 502 profile_params_.reset(); |
| 500 initialized_ = true; | 503 initialized_ = true; |
| 501 } | 504 } |
| 502 | 505 |
| 503 void ProfileIOData::ApplyProfileParamsToContext( | 506 void ProfileIOData::ApplyProfileParamsToContext( |
| 504 ChromeURLRequestContext* context) const { | 507 ChromeURLRequestContext* context) const { |
| 505 context->set_is_incognito(profile_params_->is_incognito); | 508 context->set_is_incognito(profile_params_->is_incognito); |
| 506 context->set_accept_language(profile_params_->accept_language); | 509 context->set_accept_language(profile_params_->accept_language); |
| 507 context->set_accept_charset(profile_params_->accept_charset); | 510 context->set_accept_charset(profile_params_->accept_charset); |
| 508 context->set_referrer_charset(profile_params_->referrer_charset); | 511 context->set_referrer_charset(profile_params_->referrer_charset); |
| 509 context->set_transport_security_state( | 512 context->set_transport_security_state( |
| 510 profile_params_->transport_security_state); | 513 profile_params_->transport_security_state); |
| 511 context->set_ssl_config_service(profile_params_->ssl_config_service); | 514 context->set_ssl_config_service(profile_params_->ssl_config_service); |
| 512 context->set_appcache_service(profile_params_->appcache_service); | 515 context->set_appcache_service(profile_params_->appcache_service); |
| 513 context->set_blob_storage_context(profile_params_->blob_storage_context); | 516 context->set_blob_storage_context(profile_params_->blob_storage_context); |
| 514 context->set_file_system_context(profile_params_->file_system_context); | 517 context->set_file_system_context(profile_params_->file_system_context); |
| 515 context->set_extension_info_map(profile_params_->extension_info_map); | 518 context->set_extension_info_map(profile_params_->extension_info_map); |
| 516 } | 519 } |
| 517 | 520 |
| 518 void ProfileIOData::ShutdownOnUIThread() { | 521 void ProfileIOData::ShutdownOnUIThread() { |
| 519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 520 enable_referrers_.Destroy(); | 523 enable_referrers_.Destroy(); |
| 521 } | 524 } |
| OLD | NEW |