Chromium Code Reviews| 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 = | |
| 217 pref_service->GetBoolean(prefs::kSafeBrowsingEnabled); | |
| 216 | 218 |
| 217 params->appcache_service = profile->GetAppCacheService(); | 219 params->appcache_service = profile->GetAppCacheService(); |
| 218 | 220 |
| 219 // Set up Accept-Language and Accept-Charset header values | 221 // Set up Accept-Language and Accept-Charset header values |
| 220 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 222 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 221 pref_service->GetString(prefs::kAcceptLanguages)); | 223 pref_service->GetString(prefs::kAcceptLanguages)); |
| 222 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); | 224 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); |
| 223 params->accept_charset = | 225 params->accept_charset = |
| 224 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); | 226 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); |
| 225 | 227 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 | 487 |
| 486 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); | 488 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); |
| 487 resource_context_.set_request_context(main_request_context_); | 489 resource_context_.set_request_context(main_request_context_); |
| 488 resource_context_.set_database_tracker(database_tracker_); | 490 resource_context_.set_database_tracker(database_tracker_); |
| 489 resource_context_.set_appcache_service(appcache_service_); | 491 resource_context_.set_appcache_service(appcache_service_); |
| 490 resource_context_.set_blob_storage_context(blob_storage_context_); | 492 resource_context_.set_blob_storage_context(blob_storage_context_); |
| 491 resource_context_.set_file_system_context(file_system_context_); | 493 resource_context_.set_file_system_context(file_system_context_); |
| 492 resource_context_.set_quota_manager(quota_manager_); | 494 resource_context_.set_quota_manager(quota_manager_); |
| 493 resource_context_.set_host_zoom_map(host_zoom_map_); | 495 resource_context_.set_host_zoom_map(host_zoom_map_); |
| 494 resource_context_.set_prerender_manager(prerender_manager_); | 496 resource_context_.set_prerender_manager(prerender_manager_); |
| 497 resource_context_.set_safe_browsing_enabled( | |
| 498 profile_params_->safe_browsing_enabled); | |
|
Joao da Silva
2011/06/24 14:32:04
This won't handle changes to the preference. For e
Miranda Callahan
2011/07/07 17:35:50
Excellent idea -- done.
mattm
2011/07/07 21:34:55
Note that the client side detection still wouldn't
| |
| 495 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); | 499 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); |
| 496 | 500 |
| 497 LazyInitializeInternal(profile_params_.get()); | 501 LazyInitializeInternal(profile_params_.get()); |
| 498 | 502 |
| 499 profile_params_.reset(); | 503 profile_params_.reset(); |
| 500 initialized_ = true; | 504 initialized_ = true; |
| 501 } | 505 } |
| 502 | 506 |
| 503 void ProfileIOData::ApplyProfileParamsToContext( | 507 void ProfileIOData::ApplyProfileParamsToContext( |
| 504 ChromeURLRequestContext* context) const { | 508 ChromeURLRequestContext* context) const { |
| 505 context->set_is_incognito(profile_params_->is_incognito); | 509 context->set_is_incognito(profile_params_->is_incognito); |
| 506 context->set_accept_language(profile_params_->accept_language); | 510 context->set_accept_language(profile_params_->accept_language); |
| 507 context->set_accept_charset(profile_params_->accept_charset); | 511 context->set_accept_charset(profile_params_->accept_charset); |
| 508 context->set_referrer_charset(profile_params_->referrer_charset); | 512 context->set_referrer_charset(profile_params_->referrer_charset); |
| 509 context->set_transport_security_state( | 513 context->set_transport_security_state( |
| 510 profile_params_->transport_security_state); | 514 profile_params_->transport_security_state); |
| 511 context->set_ssl_config_service(profile_params_->ssl_config_service); | 515 context->set_ssl_config_service(profile_params_->ssl_config_service); |
| 512 context->set_appcache_service(profile_params_->appcache_service); | 516 context->set_appcache_service(profile_params_->appcache_service); |
| 513 context->set_blob_storage_context(profile_params_->blob_storage_context); | 517 context->set_blob_storage_context(profile_params_->blob_storage_context); |
| 514 context->set_file_system_context(profile_params_->file_system_context); | 518 context->set_file_system_context(profile_params_->file_system_context); |
| 515 context->set_extension_info_map(profile_params_->extension_info_map); | 519 context->set_extension_info_map(profile_params_->extension_info_map); |
| 516 } | 520 } |
| 517 | 521 |
| 518 void ProfileIOData::ShutdownOnUIThread() { | 522 void ProfileIOData::ShutdownOnUIThread() { |
| 519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 523 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 520 enable_referrers_.Destroy(); | 524 enable_referrers_.Destroy(); |
| 521 } | 525 } |
| OLD | NEW |