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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/prefs/pref_member.h" | 11 #include "base/prefs/pref_member.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
22 #include "chrome/browser/io_thread.h" | 22 #include "chrome/browser/io_thread.h" |
23 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
24 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
25 #include "chrome/browser/net/connect_interceptor.h" | 25 #include "chrome/browser/net/connect_interceptor.h" |
26 #include "chrome/browser/net/cookie_store_util.h" | 26 #include "chrome/browser/net/cookie_store_util.h" |
27 #include "chrome/browser/net/http_server_properties_manager.h" | 27 #include "chrome/browser/net/http_server_properties_manager_factory.h" |
28 #include "chrome/browser/net/predictor.h" | 28 #include "chrome/browser/net/predictor.h" |
29 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" | 29 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
35 #include "components/domain_reliability/monitor.h" | 35 #include "components/domain_reliability/monitor.h" |
36 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/cookie_store_factory.h" | 37 #include "content/public/browser/cookie_store_factory.h" |
38 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
39 #include "content/public/browser/resource_context.h" | 39 #include "content/public/browser/resource_context.h" |
40 #include "content/public/browser/storage_partition.h" | 40 #include "content/public/browser/storage_partition.h" |
41 #include "extensions/browser/extension_protocols.h" | 41 #include "extensions/browser/extension_protocols.h" |
42 #include "extensions/common/constants.h" | 42 #include "extensions/common/constants.h" |
43 #include "net/base/cache_type.h" | 43 #include "net/base/cache_type.h" |
44 #include "net/base/sdch_dictionary_fetcher.h" | 44 #include "net/base/sdch_dictionary_fetcher.h" |
45 #include "net/base/sdch_manager.h" | 45 #include "net/base/sdch_manager.h" |
46 #include "net/ftp/ftp_network_layer.h" | 46 #include "net/ftp/ftp_network_layer.h" |
47 #include "net/http/http_cache.h" | 47 #include "net/http/http_cache.h" |
| 48 #include "net/http/http_server_properties_manager.h" |
48 #include "net/ssl/server_bound_cert_service.h" | 49 #include "net/ssl/server_bound_cert_service.h" |
49 #include "net/url_request/url_request_job_factory_impl.h" | 50 #include "net/url_request/url_request_job_factory_impl.h" |
50 #include "webkit/browser/quota/special_storage_policy.h" | 51 #include "webkit/browser/quota/special_storage_policy.h" |
51 | 52 |
52 namespace { | 53 namespace { |
53 | 54 |
54 net::BackendType ChooseCacheBackendType() { | 55 net::BackendType ChooseCacheBackendType() { |
55 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
56 return net::CACHE_BACKEND_SIMPLE; | 57 return net::CACHE_BACKEND_SIMPLE; |
57 #else | 58 #else |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); | 97 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); |
97 #endif | 98 #endif |
98 if (save_prefs) { | 99 if (save_prefs) { |
99 io_data_->predictor_->SaveStateForNextStartupAndTrim( | 100 io_data_->predictor_->SaveStateForNextStartupAndTrim( |
100 profile_->GetPrefs()); | 101 profile_->GetPrefs()); |
101 } | 102 } |
102 io_data_->predictor_->ShutdownOnUIThread(); | 103 io_data_->predictor_->ShutdownOnUIThread(); |
103 } | 104 } |
104 | 105 |
105 if (io_data_->http_server_properties_manager_) | 106 if (io_data_->http_server_properties_manager_) |
106 io_data_->http_server_properties_manager_->ShutdownOnUIThread(); | 107 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); |
107 io_data_->ShutdownOnUIThread(); | 108 io_data_->ShutdownOnUIThread(); |
108 } | 109 } |
109 | 110 |
110 void ProfileImplIOData::Handle::Init( | 111 void ProfileImplIOData::Handle::Init( |
111 const base::FilePath& cookie_path, | 112 const base::FilePath& cookie_path, |
112 const base::FilePath& server_bound_cert_path, | 113 const base::FilePath& server_bound_cert_path, |
113 const base::FilePath& cache_path, | 114 const base::FilePath& cache_path, |
114 int cache_max_size, | 115 int cache_max_size, |
115 const base::FilePath& media_cache_path, | 116 const base::FilePath& media_cache_path, |
116 int media_cache_max_size, | 117 int media_cache_max_size, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 307 |
307 void ProfileImplIOData::Handle::LazyInitialize() const { | 308 void ProfileImplIOData::Handle::LazyInitialize() const { |
308 if (initialized_) | 309 if (initialized_) |
309 return; | 310 return; |
310 | 311 |
311 // Set initialized_ to true at the beginning in case any of the objects | 312 // Set initialized_ to true at the beginning in case any of the objects |
312 // below try to get the ResourceContext pointer. | 313 // below try to get the ResourceContext pointer. |
313 initialized_ = true; | 314 initialized_ = true; |
314 PrefService* pref_service = profile_->GetPrefs(); | 315 PrefService* pref_service = profile_->GetPrefs(); |
315 io_data_->http_server_properties_manager_ = | 316 io_data_->http_server_properties_manager_ = |
316 new chrome_browser_net::HttpServerPropertiesManager(pref_service); | 317 chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager( |
| 318 pref_service); |
317 io_data_->set_http_server_properties( | 319 io_data_->set_http_server_properties( |
318 scoped_ptr<net::HttpServerProperties>( | 320 scoped_ptr<net::HttpServerProperties>( |
319 io_data_->http_server_properties_manager_)); | 321 io_data_->http_server_properties_manager_)); |
320 io_data_->session_startup_pref()->Init( | 322 io_data_->session_startup_pref()->Init( |
321 prefs::kRestoreOnStartup, pref_service); | 323 prefs::kRestoreOnStartup, pref_service); |
322 io_data_->session_startup_pref()->MoveToThread( | 324 io_data_->session_startup_pref()->MoveToThread( |
323 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 325 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
324 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 326 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
325 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, | 327 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, |
326 pref_service); | 328 pref_service); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 IOThread* const io_thread = profile_params->io_thread; | 372 IOThread* const io_thread = profile_params->io_thread; |
371 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 373 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
372 | 374 |
373 network_delegate()->set_predictor(predictor_.get()); | 375 network_delegate()->set_predictor(predictor_.get()); |
374 | 376 |
375 // Initialize context members. | 377 // Initialize context members. |
376 | 378 |
377 ApplyProfileParamsToContext(main_context); | 379 ApplyProfileParamsToContext(main_context); |
378 | 380 |
379 if (http_server_properties_manager_) | 381 if (http_server_properties_manager_) |
380 http_server_properties_manager_->InitializeOnIOThread(); | 382 http_server_properties_manager_->InitializeOnNetworkThread(); |
381 | 383 |
382 main_context->set_transport_security_state(transport_security_state()); | 384 main_context->set_transport_security_state(transport_security_state()); |
383 | 385 |
384 main_context->set_net_log(io_thread->net_log()); | 386 main_context->set_net_log(io_thread->net_log()); |
385 | 387 |
386 main_context->set_network_delegate(network_delegate()); | 388 main_context->set_network_delegate(network_delegate()); |
387 | 389 |
388 main_context->set_http_server_properties(http_server_properties()); | 390 main_context->set_http_server_properties(http_server_properties()); |
389 | 391 |
390 main_context->set_host_resolver( | 392 main_context->set_host_resolver( |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 const base::Closure& completion) { | 752 const base::Closure& completion) { |
751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 753 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
752 DCHECK(initialized()); | 754 DCHECK(initialized()); |
753 | 755 |
754 DCHECK(transport_security_state()); | 756 DCHECK(transport_security_state()); |
755 // Completes synchronously. | 757 // Completes synchronously. |
756 transport_security_state()->DeleteAllDynamicDataSince(time); | 758 transport_security_state()->DeleteAllDynamicDataSince(time); |
757 DCHECK(http_server_properties_manager_); | 759 DCHECK(http_server_properties_manager_); |
758 http_server_properties_manager_->Clear(completion); | 760 http_server_properties_manager_->Clear(completion); |
759 } | 761 } |
OLD | NEW |