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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
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 | 226 return; |
227 // below try to get the ResourceContext pointer. | 227 |
228 initialized_ = true; | 228 // Set initialized_ to true at the beginning in case any of the objects |
229 io_data_->InitializeOnUIThread(profile_); | 229 // below try to get the ResourceContext pointer. |
230 PrefService* pref_service = profile_->GetPrefs(); | 230 initialized_ = true; |
231 io_data_->http_server_properties_manager_.reset( | 231 PrefService* pref_service = profile_->GetPrefs(); |
232 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); | 232 io_data_->http_server_properties_manager_.reset( |
233 ChromeNetworkDelegate::InitializeReferrersEnabled( | 233 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); |
234 io_data_->enable_referrers(), pref_service); | 234 ChromeNetworkDelegate::InitializeReferrersEnabled( |
235 io_data_->clear_local_state_on_exit()->Init( | 235 io_data_->enable_referrers(), pref_service); |
236 prefs::kClearSiteDataOnExit, pref_service, NULL); | 236 io_data_->clear_local_state_on_exit()->Init( |
237 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO); | 237 prefs::kClearSiteDataOnExit, pref_service, NULL); |
238 io_data_->session_startup_pref()->Init( | 238 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO); |
239 prefs::kRestoreOnStartup, pref_service, NULL); | 239 io_data_->session_startup_pref()->Init( |
240 io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO); | 240 prefs::kRestoreOnStartup, pref_service, NULL); |
| 241 io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO); |
241 #if defined(ENABLE_SAFE_BROWSING) | 242 #if defined(ENABLE_SAFE_BROWSING) |
242 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, | 243 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, |
243 pref_service, NULL); | 244 pref_service, NULL); |
244 io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO); | 245 io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO); |
245 #endif | 246 #endif |
246 } | 247 io_data_->InitializeOnUIThread(profile_); |
247 } | 248 } |
248 | 249 |
249 ProfileImplIOData::LazyParams::LazyParams() | 250 ProfileImplIOData::LazyParams::LazyParams() |
250 : cache_max_size(0), | 251 : cache_max_size(0), |
251 media_cache_max_size(0) {} | 252 media_cache_max_size(0) {} |
252 ProfileImplIOData::LazyParams::~LazyParams() {} | 253 ProfileImplIOData::LazyParams::~LazyParams() {} |
253 | 254 |
254 ProfileImplIOData::ProfileImplIOData() | 255 ProfileImplIOData::ProfileImplIOData() |
255 : ProfileIOData(false), | 256 : ProfileIOData(false), |
256 clear_local_state_on_exit_(false) {} | 257 clear_local_state_on_exit_(false) {} |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 scoped_refptr<ChromeURLRequestContext> | 510 scoped_refptr<ChromeURLRequestContext> |
510 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 511 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
511 scoped_refptr<ChromeURLRequestContext> main_context, | 512 scoped_refptr<ChromeURLRequestContext> main_context, |
512 const std::string& app_id) const { | 513 const std::string& app_id) const { |
513 // We create per-app contexts on demand, unlike the others above. | 514 // We create per-app contexts on demand, unlike the others above. |
514 scoped_refptr<ChromeURLRequestContext> app_request_context = | 515 scoped_refptr<ChromeURLRequestContext> app_request_context = |
515 InitializeAppRequestContext(main_context, app_id); | 516 InitializeAppRequestContext(main_context, app_id); |
516 DCHECK(app_request_context); | 517 DCHECK(app_request_context); |
517 return app_request_context; | 518 return app_request_context; |
518 } | 519 } |
OLD | NEW |