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 <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
27 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" | 27 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" |
28 #include "chrome/browser/io_thread.h" | 28 #include "chrome/browser/io_thread.h" |
29 #include "chrome/browser/net/chrome_network_delegate.h" | 29 #include "chrome/browser/net/chrome_network_delegate.h" |
30 #include "chrome/browser/net/http_server_properties_manager_factory.h" | 30 #include "chrome/browser/net/http_server_properties_manager_factory.h" |
31 #include "chrome/browser/net/predictor.h" | 31 #include "chrome/browser/net/predictor.h" |
32 #include "chrome/browser/net/quota_policy_channel_id_store.h" | 32 #include "chrome/browser/net/quota_policy_channel_id_store.h" |
33 #include "chrome/browser/net/sdch_owner_pref_storage.h" | |
34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" | 33 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
37 #include "chrome/browser/previews/previews_service.h" | 36 #include "chrome/browser/previews/previews_service.h" |
38 #include "chrome/browser/previews/previews_service_factory.h" | 37 #include "chrome/browser/previews/previews_service_factory.h" |
39 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/common/chrome_constants.h" | 39 #include "chrome/common/chrome_constants.h" |
41 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
43 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
54 #include "components/previews/core/previews_io_data.h" | 53 #include "components/previews/core/previews_io_data.h" |
55 #include "content/public/browser/browser_thread.h" | 54 #include "content/public/browser/browser_thread.h" |
56 #include "content/public/browser/cookie_store_factory.h" | 55 #include "content/public/browser/cookie_store_factory.h" |
57 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
58 #include "content/public/browser/resource_context.h" | 57 #include "content/public/browser/resource_context.h" |
59 #include "content/public/browser/storage_partition.h" | 58 #include "content/public/browser/storage_partition.h" |
60 #include "extensions/browser/extension_protocols.h" | 59 #include "extensions/browser/extension_protocols.h" |
61 #include "extensions/common/constants.h" | 60 #include "extensions/common/constants.h" |
62 #include "extensions/features/features.h" | 61 #include "extensions/features/features.h" |
63 #include "net/base/cache_type.h" | 62 #include "net/base/cache_type.h" |
64 #include "net/base/sdch_manager.h" | |
65 #include "net/cookies/cookie_store.h" | 63 #include "net/cookies/cookie_store.h" |
66 #include "net/http/http_cache.h" | 64 #include "net/http/http_cache.h" |
67 #include "net/http/http_network_session.h" | 65 #include "net/http/http_network_session.h" |
68 #include "net/http/http_server_properties_manager.h" | 66 #include "net/http/http_server_properties_manager.h" |
69 #include "net/sdch/sdch_owner.h" | |
70 #include "net/ssl/channel_id_service.h" | 67 #include "net/ssl/channel_id_service.h" |
71 #include "net/url_request/url_request_context_storage.h" | 68 #include "net/url_request/url_request_context_storage.h" |
72 #include "net/url_request/url_request_intercepting_job_factory.h" | 69 #include "net/url_request/url_request_intercepting_job_factory.h" |
73 #include "net/url_request/url_request_job_factory_impl.h" | 70 #include "net/url_request/url_request_job_factory_impl.h" |
74 #include "storage/browser/quota/special_storage_policy.h" | 71 #include "storage/browser/quota/special_storage_policy.h" |
75 | 72 |
76 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
77 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor. h" | 74 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor. h" |
78 #endif // defined(OS_ANDROID) | 75 #endif // defined(OS_ANDROID) |
79 | 76 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 | 432 |
436 if (media_request_context_) | 433 if (media_request_context_) |
437 media_request_context_->AssertNoURLRequests(); | 434 media_request_context_->AssertNoURLRequests(); |
438 } | 435 } |
439 | 436 |
440 void ProfileImplIOData::InitializeInternal( | 437 void ProfileImplIOData::InitializeInternal( |
441 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, | 438 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, |
442 ProfileParams* profile_params, | 439 ProfileParams* profile_params, |
443 content::ProtocolHandlerMap* protocol_handlers, | 440 content::ProtocolHandlerMap* protocol_handlers, |
444 content::URLRequestInterceptorScopedVector request_interceptors) const { | 441 content::URLRequestInterceptorScopedVector request_interceptors) const { |
445 // Set up a persistent store for use by the network stack on the IO thread. | |
446 base::FilePath network_json_store_filepath( | |
447 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); | |
xunjieli
2017/02/28 19:38:42
chrome::kNetworkPersistentStateFilename is only us
| |
448 network_json_store_ = new JsonPrefStore( | |
449 network_json_store_filepath, | |
450 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, | |
451 BrowserThread::GetBlockingPool()), | |
452 std::unique_ptr<PrefFilter>()); | |
453 network_json_store_->ReadPrefsAsync(nullptr); | |
454 | |
455 net::URLRequestContext* main_context = main_request_context(); | 442 net::URLRequestContext* main_context = main_request_context(); |
456 net::URLRequestContextStorage* main_context_storage = | 443 net::URLRequestContextStorage* main_context_storage = |
457 main_request_context_storage(); | 444 main_request_context_storage(); |
458 | 445 |
459 IOThread* const io_thread = profile_params->io_thread; | 446 IOThread* const io_thread = profile_params->io_thread; |
460 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 447 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
461 | 448 |
462 if (lazy_params_->domain_reliability_monitor) { | 449 if (lazy_params_->domain_reliability_monitor) { |
463 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. | 450 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. |
464 domain_reliability_monitor_ = | 451 domain_reliability_monitor_ = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 std::move(profile_params->protocol_handler_interceptor), | 546 std::move(profile_params->protocol_handler_interceptor), |
560 main_context->network_delegate(), | 547 main_context->network_delegate(), |
561 io_thread_globals->host_resolver.get())); | 548 io_thread_globals->host_resolver.get())); |
562 main_context->set_network_quality_estimator( | 549 main_context->set_network_quality_estimator( |
563 io_thread_globals->network_quality_estimator.get()); | 550 io_thread_globals->network_quality_estimator.get()); |
564 | 551 |
565 #if BUILDFLAG(ENABLE_EXTENSIONS) | 552 #if BUILDFLAG(ENABLE_EXTENSIONS) |
566 InitializeExtensionsRequestContext(profile_params); | 553 InitializeExtensionsRequestContext(profile_params); |
567 #endif | 554 #endif |
568 | 555 |
569 // Setup SDCH for this profile. | |
570 std::unique_ptr<net::SdchManager> sdch_manager(new net::SdchManager()); | |
571 sdch_policy_.reset(new net::SdchOwner(sdch_manager.get(), main_context)); | |
572 sdch_policy_->EnablePersistentStorage( | |
573 std::unique_ptr<net::SdchOwner::PrefStorage>( | |
574 new chrome_browser_net::SdchOwnerPrefStorage( | |
575 network_json_store_.get()))); | |
576 main_context_storage->set_sdch_manager(std::move(sdch_manager)); | |
577 | |
578 // Create a media request context based on the main context, but using a | 556 // Create a media request context based on the main context, but using a |
579 // media cache. It shares the same job factory as the main context. | 557 // media cache. It shares the same job factory as the main context. |
580 StoragePartitionDescriptor details(profile_path_, false); | 558 StoragePartitionDescriptor details(profile_path_, false); |
581 media_request_context_.reset( | 559 media_request_context_.reset( |
582 InitializeMediaRequestContext(main_context, details, "main_media")); | 560 InitializeMediaRequestContext(main_context, details, "main_media")); |
583 lazy_params_.reset(); | 561 lazy_params_.reset(); |
584 } | 562 } |
585 | 563 |
586 void ProfileImplIOData:: | 564 void ProfileImplIOData:: |
587 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { | 565 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
812 const base::Closure& completion) { | 790 const base::Closure& completion) { |
813 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 791 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
814 DCHECK(initialized()); | 792 DCHECK(initialized()); |
815 | 793 |
816 DCHECK(transport_security_state()); | 794 DCHECK(transport_security_state()); |
817 // Completes synchronously. | 795 // Completes synchronously. |
818 transport_security_state()->DeleteAllDynamicDataSince(time); | 796 transport_security_state()->DeleteAllDynamicDataSince(time); |
819 DCHECK(http_server_properties_manager_); | 797 DCHECK(http_server_properties_manager_); |
820 http_server_properties_manager_->Clear(completion); | 798 http_server_properties_manager_->Clear(completion); |
821 } | 799 } |
OLD | NEW |