| 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_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 BrowserThread::PostTask( | 216 BrowserThread::PostTask( |
| 217 BrowserThread::IO, FROM_HERE, | 217 BrowserThread::IO, FROM_HERE, |
| 218 base::Bind( | 218 base::Bind( |
| 219 &ClearNetworkingHistorySinceOnIOThread, | 219 &ClearNetworkingHistorySinceOnIOThread, |
| 220 io_data_, | 220 io_data_, |
| 221 time)); | 221 time)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ProfileImplIOData::Handle::LazyInitialize() const { | 224 void ProfileImplIOData::Handle::LazyInitialize() const { |
| 225 if (!initialized_) { | 225 if (!initialized_) { |
| 226 // Set initialized_ to true at the beginning in case any of the objects |
| 227 // below try to get the ResourceContext pointer. |
| 228 initialized_ = true; |
| 226 io_data_->InitializeOnUIThread(profile_); | 229 io_data_->InitializeOnUIThread(profile_); |
| 227 PrefService* pref_service = profile_->GetPrefs(); | 230 PrefService* pref_service = profile_->GetPrefs(); |
| 228 io_data_->http_server_properties_manager_.reset( | 231 io_data_->http_server_properties_manager_.reset( |
| 229 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); | 232 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); |
| 230 ChromeNetworkDelegate::InitializeReferrersEnabled( | 233 ChromeNetworkDelegate::InitializeReferrersEnabled( |
| 231 io_data_->enable_referrers(), pref_service); | 234 io_data_->enable_referrers(), pref_service); |
| 232 io_data_->clear_local_state_on_exit()->Init( | 235 io_data_->clear_local_state_on_exit()->Init( |
| 233 prefs::kClearSiteDataOnExit, pref_service, NULL); | 236 prefs::kClearSiteDataOnExit, pref_service, NULL); |
| 234 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO); | 237 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO); |
| 235 io_data_->session_startup_pref()->Init( | 238 io_data_->session_startup_pref()->Init( |
| 236 prefs::kRestoreOnStartup, pref_service, NULL); | 239 prefs::kRestoreOnStartup, pref_service, NULL); |
| 237 io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO); | 240 io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO); |
| 238 #if defined(ENABLE_SAFE_BROWSING) | 241 #if defined(ENABLE_SAFE_BROWSING) |
| 239 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, | 242 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, |
| 240 pref_service, NULL); | 243 pref_service, NULL); |
| 241 io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO); | 244 io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO); |
| 242 #endif | 245 #endif |
| 243 initialized_ = true; | |
| 244 } | 246 } |
| 245 } | 247 } |
| 246 | 248 |
| 247 ProfileImplIOData::LazyParams::LazyParams() | 249 ProfileImplIOData::LazyParams::LazyParams() |
| 248 : cache_max_size(0), | 250 : cache_max_size(0), |
| 249 media_cache_max_size(0) {} | 251 media_cache_max_size(0) {} |
| 250 ProfileImplIOData::LazyParams::~LazyParams() {} | 252 ProfileImplIOData::LazyParams::~LazyParams() {} |
| 251 | 253 |
| 252 ProfileImplIOData::ProfileImplIOData() | 254 ProfileImplIOData::ProfileImplIOData() |
| 253 : ProfileIOData(false), | 255 : ProfileIOData(false), |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 scoped_refptr<ChromeURLRequestContext> | 509 scoped_refptr<ChromeURLRequestContext> |
| 508 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 510 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 509 scoped_refptr<ChromeURLRequestContext> main_context, | 511 scoped_refptr<ChromeURLRequestContext> main_context, |
| 510 const std::string& app_id) const { | 512 const std::string& app_id) const { |
| 511 // We create per-app contexts on demand, unlike the others above. | 513 // We create per-app contexts on demand, unlike the others above. |
| 512 scoped_refptr<ChromeURLRequestContext> app_request_context = | 514 scoped_refptr<ChromeURLRequestContext> app_request_context = |
| 513 InitializeAppRequestContext(main_context, app_id); | 515 InitializeAppRequestContext(main_context, app_id); |
| 514 DCHECK(app_request_context); | 516 DCHECK(app_request_context); |
| 515 return app_request_context; | 517 return app_request_context; |
| 516 } | 518 } |
| OLD | NEW |