| 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 26 matching lines...) Expand all Loading... |
| 37 #include "content/public/browser/storage_partition.h" | 37 #include "content/public/browser/storage_partition.h" |
| 38 #include "extensions/common/constants.h" | 38 #include "extensions/common/constants.h" |
| 39 #include "net/base/cache_type.h" | 39 #include "net/base/cache_type.h" |
| 40 #include "net/ftp/ftp_network_layer.h" | 40 #include "net/ftp/ftp_network_layer.h" |
| 41 #include "net/http/http_cache.h" | 41 #include "net/http/http_cache.h" |
| 42 #include "net/ssl/server_bound_cert_service.h" | 42 #include "net/ssl/server_bound_cert_service.h" |
| 43 #include "net/url_request/protocol_intercept_job_factory.h" | 43 #include "net/url_request/protocol_intercept_job_factory.h" |
| 44 #include "net/url_request/url_request_job_factory_impl.h" | 44 #include "net/url_request/url_request_job_factory_impl.h" |
| 45 #include "webkit/quota/special_storage_policy.h" | 45 #include "webkit/quota/special_storage_policy.h" |
| 46 | 46 |
| 47 #if defined(OS_ANDROID) |
| 48 #include "chrome/app/android/chrome_data_reduction_proxy_android.h" |
| 49 #endif |
| 50 |
| 47 namespace { | 51 namespace { |
| 48 | 52 |
| 49 net::BackendType ChooseCacheBackendType() { | 53 net::BackendType ChooseCacheBackendType() { |
| 50 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 54 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 51 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { | 55 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { |
| 52 const std::string opt_value = | 56 const std::string opt_value = |
| 53 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); | 57 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); |
| 54 if (LowerCaseEqualsASCII(opt_value, "off")) | 58 if (LowerCaseEqualsASCII(opt_value, "off")) |
| 55 return net::CACHE_BACKEND_BLOCKFILE; | 59 return net::CACHE_BACKEND_BLOCKFILE; |
| 56 if (opt_value == "" || LowerCaseEqualsASCII(opt_value, "on")) | 60 if (opt_value == "" || LowerCaseEqualsASCII(opt_value, "on")) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 ChooseCacheBackendType(), | 414 ChooseCacheBackendType(), |
| 411 lazy_params_->cache_path, | 415 lazy_params_->cache_path, |
| 412 lazy_params_->cache_max_size, | 416 lazy_params_->cache_max_size, |
| 413 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 417 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 414 net::HttpNetworkSession::Params network_session_params; | 418 net::HttpNetworkSession::Params network_session_params; |
| 415 PopulateNetworkSessionParams(profile_params, &network_session_params); | 419 PopulateNetworkSessionParams(profile_params, &network_session_params); |
| 416 net::HttpCache* main_cache = new net::HttpCache( | 420 net::HttpCache* main_cache = new net::HttpCache( |
| 417 network_session_params, main_backend); | 421 network_session_params, main_backend); |
| 418 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); | 422 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); |
| 419 | 423 |
| 424 #if defined(OS_ANDROID) |
| 425 ChromeDataReductionProxyAndroid::Init(main_cache->GetSession()); |
| 426 #endif |
| 427 |
| 420 if (record_mode || playback_mode) { | 428 if (record_mode || playback_mode) { |
| 421 main_cache->set_mode( | 429 main_cache->set_mode( |
| 422 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); | 430 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); |
| 423 } | 431 } |
| 424 | 432 |
| 425 main_http_factory_.reset(main_cache); | 433 main_http_factory_.reset(main_cache); |
| 426 main_context->set_http_transaction_factory(main_cache); | 434 main_context->set_http_transaction_factory(main_cache); |
| 427 | 435 |
| 428 #if !defined(DISABLE_FTP_SUPPORT) | 436 #if !defined(DISABLE_FTP_SUPPORT) |
| 429 ftp_factory_.reset( | 437 ftp_factory_.reset( |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 const base::Closure& completion) { | 689 const base::Closure& completion) { |
| 682 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 690 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 683 DCHECK(initialized()); | 691 DCHECK(initialized()); |
| 684 | 692 |
| 685 DCHECK(transport_security_state()); | 693 DCHECK(transport_security_state()); |
| 686 // Completes synchronously. | 694 // Completes synchronously. |
| 687 transport_security_state()->DeleteAllDynamicDataSince(time); | 695 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 688 DCHECK(http_server_properties_manager_); | 696 DCHECK(http_server_properties_manager_); |
| 689 http_server_properties_manager_->Clear(completion); | 697 http_server_properties_manager_->Clear(completion); |
| 690 } | 698 } |
| OLD | NEW |