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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 ProfileImplIOData::Handle::~Handle() { | 54 ProfileImplIOData::Handle::~Handle() { |
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
56 if (io_data_->predictor_.get() != NULL) { | 56 if (io_data_->predictor_.get() != NULL) { |
57 // io_data_->predictor_ might be NULL if Init() was never called | 57 // io_data_->predictor_ might be NULL if Init() was never called |
58 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). | 58 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). |
59 PrefService* user_prefs = profile_->GetPrefs(); | 59 PrefService* user_prefs = profile_->GetPrefs(); |
60 io_data_->predictor_->ShutdownOnUIThread(user_prefs); | 60 io_data_->predictor_->ShutdownOnUIThread(user_prefs); |
61 } | 61 } |
62 | 62 |
63 if (io_data_->http_server_properties_manager()) | 63 if (io_data_->http_server_properties_manager_) |
64 io_data_->http_server_properties_manager()->ShutdownOnUIThread(); | 64 io_data_->http_server_properties_manager_->ShutdownOnUIThread(); |
65 io_data_->ShutdownOnUIThread(); | 65 io_data_->ShutdownOnUIThread(); |
66 } | 66 } |
67 | 67 |
68 void ProfileImplIOData::Handle::Init( | 68 void ProfileImplIOData::Handle::Init( |
69 const FilePath& cookie_path, | 69 const FilePath& cookie_path, |
70 const FilePath& server_bound_cert_path, | 70 const FilePath& server_bound_cert_path, |
71 const FilePath& cache_path, | 71 const FilePath& cache_path, |
72 int cache_max_size, | 72 int cache_max_size, |
73 const FilePath& media_cache_path, | 73 const FilePath& media_cache_path, |
74 int media_cache_max_size, | 74 int media_cache_max_size, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 void ProfileImplIOData::Handle::LazyInitialize() const { | 262 void ProfileImplIOData::Handle::LazyInitialize() const { |
263 if (initialized_) | 263 if (initialized_) |
264 return; | 264 return; |
265 | 265 |
266 // Set initialized_ to true at the beginning in case any of the objects | 266 // Set initialized_ to true at the beginning in case any of the objects |
267 // below try to get the ResourceContext pointer. | 267 // below try to get the ResourceContext pointer. |
268 initialized_ = true; | 268 initialized_ = true; |
269 PrefService* pref_service = profile_->GetPrefs(); | 269 PrefService* pref_service = profile_->GetPrefs(); |
270 io_data_->set_http_server_properties_manager( | 270 io_data_->http_server_properties_manager_ = |
271 new chrome_browser_net::HttpServerPropertiesManager(pref_service)); | 271 new chrome_browser_net::HttpServerPropertiesManager(pref_service); |
| 272 io_data_->set_http_server_properties( |
| 273 io_data_->http_server_properties_manager_); |
272 io_data_->session_startup_pref()->Init( | 274 io_data_->session_startup_pref()->Init( |
273 prefs::kRestoreOnStartup, pref_service, NULL); | 275 prefs::kRestoreOnStartup, pref_service, NULL); |
274 io_data_->session_startup_pref()->MoveToThread( | 276 io_data_->session_startup_pref()->MoveToThread( |
275 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 277 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
276 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 278 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
277 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, | 279 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, |
278 pref_service, NULL); | 280 pref_service, NULL); |
279 io_data_->safe_browsing_enabled()->MoveToThread( | 281 io_data_->safe_browsing_enabled()->MoveToThread( |
280 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 282 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
281 #endif | 283 #endif |
(...skipping 27 matching lines...) Expand all Loading... |
309 // a cycle, and the user has limited control. | 311 // a cycle, and the user has limited control. |
310 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && | 312 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
311 (chrome::kRecordModeEnabled || | 313 (chrome::kRecordModeEnabled || |
312 command_line.HasSwitch(switches::kVisitURLs)); | 314 command_line.HasSwitch(switches::kVisitURLs)); |
313 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 315 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
314 | 316 |
315 // Initialize context members. | 317 // Initialize context members. |
316 | 318 |
317 ApplyProfileParamsToContext(main_context); | 319 ApplyProfileParamsToContext(main_context); |
318 | 320 |
319 if (http_server_properties_manager()) | 321 if (http_server_properties_manager_) |
320 http_server_properties_manager()->InitializeOnIOThread(); | 322 http_server_properties_manager_->InitializeOnIOThread(); |
321 | 323 |
322 main_context->set_transport_security_state(transport_security_state()); | 324 main_context->set_transport_security_state(transport_security_state()); |
323 | 325 |
324 main_context->set_net_log(io_thread->net_log()); | 326 main_context->set_net_log(io_thread->net_log()); |
325 | 327 |
326 main_context->set_network_delegate(network_delegate()); | 328 main_context->set_network_delegate(network_delegate()); |
327 | 329 |
328 main_context->set_http_server_properties(http_server_properties_manager()); | 330 main_context->set_http_server_properties(http_server_properties()); |
329 | 331 |
330 main_context->set_host_resolver( | 332 main_context->set_host_resolver( |
331 io_thread_globals->host_resolver.get()); | 333 io_thread_globals->host_resolver.get()); |
332 main_context->set_cert_verifier( | 334 main_context->set_cert_verifier( |
333 io_thread_globals->cert_verifier.get()); | 335 io_thread_globals->cert_verifier.get()); |
334 main_context->set_http_auth_handler_factory( | 336 main_context->set_http_auth_handler_factory( |
335 io_thread_globals->http_auth_handler_factory.get()); | 337 io_thread_globals->http_auth_handler_factory.get()); |
336 | 338 |
337 main_context->set_fraudulent_certificate_reporter( | 339 main_context->set_fraudulent_certificate_reporter( |
338 fraudulent_certificate_reporter()); | 340 fraudulent_certificate_reporter()); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 675 } |
674 | 676 |
675 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 677 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
676 base::Time time, | 678 base::Time time, |
677 const base::Closure& completion) { | 679 const base::Closure& completion) { |
678 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 680 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
679 LazyInitialize(); | 681 LazyInitialize(); |
680 | 682 |
681 DCHECK(transport_security_state()); | 683 DCHECK(transport_security_state()); |
682 transport_security_state()->DeleteSince(time); // Completes synchronously. | 684 transport_security_state()->DeleteSince(time); // Completes synchronously. |
683 DCHECK(http_server_properties_manager()); | 685 DCHECK(http_server_properties_manager_); |
684 http_server_properties_manager()->Clear(completion); | 686 http_server_properties_manager_->Clear(completion); |
685 } | 687 } |
OLD | NEW |