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" |
(...skipping 14 matching lines...) Expand all Loading... |
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.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/data_reduction_proxy/common/data_reduction_proxy_pref_names
.h" | |
36 #include "components/domain_reliability/monitor.h" | 35 #include "components/domain_reliability/monitor.h" |
37 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/cookie_store_factory.h" | 37 #include "content/public/browser/cookie_store_factory.h" |
39 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
40 #include "content/public/browser/resource_context.h" | 39 #include "content/public/browser/resource_context.h" |
41 #include "content/public/browser/storage_partition.h" | 40 #include "content/public/browser/storage_partition.h" |
42 #include "extensions/browser/extension_protocols.h" | 41 #include "extensions/browser/extension_protocols.h" |
43 #include "extensions/common/constants.h" | 42 #include "extensions/common/constants.h" |
44 #include "net/base/cache_type.h" | 43 #include "net/base/cache_type.h" |
45 #include "net/base/sdch_dictionary_fetcher.h" | 44 #include "net/base/sdch_dictionary_fetcher.h" |
46 #include "net/base/sdch_manager.h" | 45 #include "net/base/sdch_manager.h" |
47 #include "net/ftp/ftp_network_layer.h" | 46 #include "net/ftp/ftp_network_layer.h" |
48 #include "net/http/http_cache.h" | 47 #include "net/http/http_cache.h" |
49 #include "net/ssl/server_bound_cert_service.h" | 48 #include "net/ssl/server_bound_cert_service.h" |
50 #include "net/url_request/url_request_job_factory_impl.h" | 49 #include "net/url_request/url_request_job_factory_impl.h" |
51 #include "webkit/browser/quota/special_storage_policy.h" | 50 #include "webkit/browser/quota/special_storage_policy.h" |
52 | 51 |
53 #if defined(OS_ANDROID) || defined(OS_IOS) | |
54 #if defined(SPDY_PROXY_AUTH_VALUE) | |
55 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | |
56 #endif | |
57 #endif | |
58 | |
59 namespace { | 52 namespace { |
60 | 53 |
61 net::BackendType ChooseCacheBackendType() { | 54 net::BackendType ChooseCacheBackendType() { |
62 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
63 return net::CACHE_BACKEND_SIMPLE; | 56 return net::CACHE_BACKEND_SIMPLE; |
64 #else | 57 #else |
65 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 58 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
66 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { | 59 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { |
67 const std::string opt_value = | 60 const std::string opt_value = |
68 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); | 61 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 net::DISK_CACHE, | 458 net::DISK_CACHE, |
466 ChooseCacheBackendType(), | 459 ChooseCacheBackendType(), |
467 lazy_params_->cache_path, | 460 lazy_params_->cache_path, |
468 lazy_params_->cache_max_size, | 461 lazy_params_->cache_max_size, |
469 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) | 462 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) |
470 .get()); | 463 .get()); |
471 scoped_ptr<net::HttpCache> main_cache = CreateMainHttpFactory( | 464 scoped_ptr<net::HttpCache> main_cache = CreateMainHttpFactory( |
472 profile_params, main_backend); | 465 profile_params, main_backend); |
473 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); | 466 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); |
474 | 467 |
475 #if defined(OS_ANDROID) || defined(OS_IOS) | |
476 #if defined(SPDY_PROXY_AUTH_VALUE) | |
477 data_reduction_proxy::DataReductionProxySettings:: | |
478 InitDataReductionProxySession( | |
479 main_cache->GetSession(), | |
480 io_thread_globals->data_reduction_proxy_params.get()); | |
481 #endif | |
482 #endif | |
483 | |
484 if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) { | 468 if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) { |
485 main_cache->set_mode( | 469 main_cache->set_mode( |
486 chrome_browser_net::IsCookieRecordMode() ? | 470 chrome_browser_net::IsCookieRecordMode() ? |
487 net::HttpCache::RECORD : net::HttpCache::PLAYBACK); | 471 net::HttpCache::RECORD : net::HttpCache::PLAYBACK); |
488 } | 472 } |
489 | 473 |
490 main_http_factory_.reset(main_cache.release()); | 474 main_http_factory_.reset(main_cache.release()); |
491 main_context->set_http_transaction_factory(main_http_factory_.get()); | 475 main_context->set_http_transaction_factory(main_http_factory_.get()); |
492 | 476 |
493 #if !defined(DISABLE_FTP_SUPPORT) | 477 #if !defined(DISABLE_FTP_SUPPORT) |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 const base::Closure& completion) { | 750 const base::Closure& completion) { |
767 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
768 DCHECK(initialized()); | 752 DCHECK(initialized()); |
769 | 753 |
770 DCHECK(transport_security_state()); | 754 DCHECK(transport_security_state()); |
771 // Completes synchronously. | 755 // Completes synchronously. |
772 transport_security_state()->DeleteAllDynamicDataSince(time); | 756 transport_security_state()->DeleteAllDynamicDataSince(time); |
773 DCHECK(http_server_properties_manager_); | 757 DCHECK(http_server_properties_manager_); |
774 http_server_properties_manager_->Clear(completion); | 758 http_server_properties_manager_->Clear(completion); |
775 } | 759 } |
OLD | NEW |