| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 | 160 |
| 161 void ProfileIOData::InitializeOnUIThread(Profile* profile) { | 161 void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
| 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 163 PrefService* pref_service = profile->GetPrefs(); | 163 PrefService* pref_service = profile->GetPrefs(); |
| 164 | 164 |
| 165 scoped_ptr<ProfileParams> params(new ProfileParams); | 165 scoped_ptr<ProfileParams> params(new ProfileParams); |
| 166 params->path = profile->GetPath(); | 166 params->path = profile->GetPath(); |
| 167 params->clear_local_state_on_exit = | |
| 168 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | |
| 169 | 167 |
| 170 // Set up Accept-Language and Accept-Charset header values | 168 // Set up Accept-Language and Accept-Charset header values |
| 171 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 169 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 172 pref_service->GetString(prefs::kAcceptLanguages)); | 170 pref_service->GetString(prefs::kAcceptLanguages)); |
| 173 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); | 171 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); |
| 174 params->accept_charset = | 172 params->accept_charset = |
| 175 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); | 173 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); |
| 176 | 174 |
| 177 // At this point, we don't know the charset of the referring page | 175 // At this point, we don't know the charset of the referring page |
| 178 // where a url request originates from. This is used to get a suggested | 176 // where a url request originates from. This is used to get a suggested |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 240 |
| 243 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( | 241 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( |
| 244 net::HttpTransactionFactory* http_factory) { | 242 net::HttpTransactionFactory* http_factory) { |
| 245 http_factory_.reset(http_factory); | 243 http_factory_.reset(http_factory); |
| 246 set_http_transaction_factory(http_factory); | 244 set_http_transaction_factory(http_factory); |
| 247 } | 245 } |
| 248 | 246 |
| 249 ProfileIOData::AppRequestContext::~AppRequestContext() {} | 247 ProfileIOData::AppRequestContext::~AppRequestContext() {} |
| 250 | 248 |
| 251 ProfileIOData::ProfileParams::ProfileParams() | 249 ProfileIOData::ProfileParams::ProfileParams() |
| 252 : clear_local_state_on_exit(false), | 250 : io_thread(NULL), |
| 253 io_thread(NULL), | |
| 254 #if defined(ENABLE_NOTIFICATIONS) | 251 #if defined(ENABLE_NOTIFICATIONS) |
| 255 notification_service(NULL), | 252 notification_service(NULL), |
| 256 #endif | 253 #endif |
| 257 profile(NULL) { | 254 profile(NULL) { |
| 258 } | 255 } |
| 259 | 256 |
| 260 ProfileIOData::ProfileParams::~ProfileParams() {} | 257 ProfileIOData::ProfileParams::~ProfileParams() {} |
| 261 | 258 |
| 262 ProfileIOData::ProfileIOData(bool is_incognito) | 259 ProfileIOData::ProfileIOData(bool is_incognito) |
| 263 : initialized_(false), | 260 : initialized_(false), |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 context->set_referrer_charset(profile_params_->referrer_charset); | 564 context->set_referrer_charset(profile_params_->referrer_charset); |
| 568 context->set_ssl_config_service(profile_params_->ssl_config_service); | 565 context->set_ssl_config_service(profile_params_->ssl_config_service); |
| 569 } | 566 } |
| 570 | 567 |
| 571 void ProfileIOData::ShutdownOnUIThread() { | 568 void ProfileIOData::ShutdownOnUIThread() { |
| 572 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 573 enable_referrers_.Destroy(); | 570 enable_referrers_.Destroy(); |
| 574 #if !defined(OS_CHROMEOS) | 571 #if !defined(OS_CHROMEOS) |
| 575 enable_metrics_.Destroy(); | 572 enable_metrics_.Destroy(); |
| 576 #endif | 573 #endif |
| 577 clear_local_state_on_exit_.Destroy(); | |
| 578 safe_browsing_enabled_.Destroy(); | 574 safe_browsing_enabled_.Destroy(); |
| 579 session_startup_pref_.Destroy(); | 575 session_startup_pref_.Destroy(); |
| 580 #if defined(ENABLE_CONFIGURATION_POLICY) | 576 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 581 if (url_blacklist_manager_.get()) | 577 if (url_blacklist_manager_.get()) |
| 582 url_blacklist_manager_->ShutdownOnUIThread(); | 578 url_blacklist_manager_->ShutdownOnUIThread(); |
| 583 #endif | 579 #endif |
| 584 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 580 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
| 585 if (!posted) | 581 if (!posted) |
| 586 delete this; | 582 delete this; |
| 587 } | 583 } |
| 588 | 584 |
| 589 void ProfileIOData::set_server_bound_cert_service( | 585 void ProfileIOData::set_server_bound_cert_service( |
| 590 net::ServerBoundCertService* server_bound_cert_service) const { | 586 net::ServerBoundCertService* server_bound_cert_service) const { |
| 591 server_bound_cert_service_.reset(server_bound_cert_service); | 587 server_bound_cert_service_.reset(server_bound_cert_service); |
| 592 } | 588 } |
| 593 | 589 |
| 594 void ProfileIOData::DestroyResourceContext() { | 590 void ProfileIOData::DestroyResourceContext() { |
| 595 resource_context_.reset(); | 591 resource_context_.reset(); |
| 596 } | 592 } |
| OLD | NEW |