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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 15 #include "chrome/browser/extensions/user_script_master.h" | 15 #include "chrome/browser/extensions/user_script_master.h" |
| 16 #include "chrome/browser/io_thread.h" | 16 #include "chrome/browser/io_thread.h" |
| 17 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 17 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 18 #include "chrome/browser/net/pref_proxy_config_service.h" | 18 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 19 #include "chrome/browser/net/proxy_service_factory.h" | 19 #include "chrome/browser/net/proxy_service_factory.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/prefs/pref_member.h" | |
| 21 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
| 26 #include "content/common/notification_service.h" | 27 #include "content/common/notification_service.h" |
| 27 #include "net/http/http_util.h" | 28 #include "net/http/http_util.h" |
| 28 #include "net/proxy/proxy_config_service_fixed.h" | 29 #include "net/proxy/proxy_config_service_fixed.h" |
| 29 #include "net/proxy/proxy_script_fetcher_impl.h" | 30 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 30 #include "net/proxy/proxy_service.h" | 31 #include "net/proxy/proxy_service.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 181 |
| 181 ProfileIOData::RequestContext::RequestContext() {} | 182 ProfileIOData::RequestContext::RequestContext() {} |
| 182 ProfileIOData::RequestContext::~RequestContext() {} | 183 ProfileIOData::RequestContext::~RequestContext() {} |
| 183 | 184 |
| 184 ProfileIOData::ProfileParams::ProfileParams() | 185 ProfileIOData::ProfileParams::ProfileParams() |
| 185 : is_incognito(false), | 186 : is_incognito(false), |
| 186 clear_local_state_on_exit(false), | 187 clear_local_state_on_exit(false), |
| 187 profile_id(Profile::kInvalidProfileId) {} | 188 profile_id(Profile::kInvalidProfileId) {} |
| 188 ProfileIOData::ProfileParams::~ProfileParams() {} | 189 ProfileIOData::ProfileParams::~ProfileParams() {} |
| 189 | 190 |
| 190 ProfileIOData::ProfileIOData(bool is_incognito) | 191 ProfileIOData::ProfileIOData(Profile* profile, bool is_incognito) |
| 191 : initialized_(false) { | 192 : enable_referrers_(new BooleanPrefMember()), |
| 193 initialized_(false) { | |
| 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 195 // We can't lazily initialize |enable_referrers_| because it is used on the UI | |
| 196 // thread as well as the IO thread, which might lead to race conditions | |
| 197 // otherwise. | |
| 198 enable_referrers_->Init(prefs::kEnableReferrers, | |
| 199 profile->GetPrefs(), | |
| 200 NULL); | |
| 201 enable_referrers_->MoveToThread(BrowserThread::IO); | |
| 193 } | 202 } |
| 194 | 203 |
| 195 ProfileIOData::~ProfileIOData() { | 204 ProfileIOData::~ProfileIOData() { |
| 196 // If we have never initialized ProfileIOData, then Handle may hold the only | 205 // If we have never initialized ProfileIOData, then Handle may hold the only |
| 197 // reference to it. The important thing is to make sure it hasn't been | 206 // reference to it. The important thing is to make sure it hasn't been |
| 198 // initialized yet, because the lazily initialized variables are supposed to | 207 // initialized yet, because the lazily initialized variables are supposed to |
| 199 // live on the IO thread. | 208 // live on the IO thread. |
| 200 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) | 209 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) |
| 201 DCHECK(!initialized_); | 210 DCHECK(!initialized_); |
| 202 else | 211 else |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 context->set_transport_security_state( | 273 context->set_transport_security_state( |
| 265 profile_params.transport_security_state); | 274 profile_params.transport_security_state); |
| 266 context->set_ssl_config_service(profile_params.ssl_config_service); | 275 context->set_ssl_config_service(profile_params.ssl_config_service); |
| 267 context->set_database_tracker(profile_params.database_tracker); | 276 context->set_database_tracker(profile_params.database_tracker); |
| 268 context->set_appcache_service(profile_params.appcache_service); | 277 context->set_appcache_service(profile_params.appcache_service); |
| 269 context->set_blob_storage_context(profile_params.blob_storage_context); | 278 context->set_blob_storage_context(profile_params.blob_storage_context); |
| 270 context->set_file_system_context(profile_params.file_system_context); | 279 context->set_file_system_context(profile_params.file_system_context); |
| 271 context->set_extension_info_map(profile_params.extension_info_map); | 280 context->set_extension_info_map(profile_params.extension_info_map); |
| 272 context->set_prerender_manager(profile_params.prerender_manager); | 281 context->set_prerender_manager(profile_params.prerender_manager); |
| 273 } | 282 } |
| 283 | |
| 284 void ProfileIOData::Shutdown() { | |
|
willchan no longer on Chromium
2011/04/12 16:34:18
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::U
Bernhard Bauer
2011/04/13 11:17:20
Done.
| |
| 285 enable_referrers_->Destroy(); | |
| 286 } | |
| OLD | NEW |