| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "net/base/cache_type.h" | 55 #include "net/base/cache_type.h" |
| 56 #include "net/base/sdch_manager.h" | 56 #include "net/base/sdch_manager.h" |
| 57 #include "net/ftp/ftp_network_layer.h" | 57 #include "net/ftp/ftp_network_layer.h" |
| 58 #include "net/http/http_cache.h" | 58 #include "net/http/http_cache.h" |
| 59 #include "net/http/http_server_properties_manager.h" | 59 #include "net/http/http_server_properties_manager.h" |
| 60 #include "net/ssl/channel_id_service.h" | 60 #include "net/ssl/channel_id_service.h" |
| 61 #include "net/url_request/url_request_intercepting_job_factory.h" | 61 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 62 #include "net/url_request/url_request_job_factory_impl.h" | 62 #include "net/url_request/url_request_job_factory_impl.h" |
| 63 #include "storage/browser/quota/special_storage_policy.h" | 63 #include "storage/browser/quota/special_storage_policy.h" |
| 64 | 64 |
| 65 #if defined(OS_ANDROID) |
| 66 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_u
i_service.h" |
| 67 #endif |
| 68 |
| 65 namespace { | 69 namespace { |
| 66 | 70 |
| 67 net::BackendType ChooseCacheBackendType() { | 71 net::BackendType ChooseCacheBackendType() { |
| 68 #if defined(OS_ANDROID) | 72 #if defined(OS_ANDROID) |
| 69 return net::CACHE_BACKEND_SIMPLE; | 73 return net::CACHE_BACKEND_SIMPLE; |
| 70 #else | 74 #else |
| 71 const base::CommandLine& command_line = | 75 const base::CommandLine& command_line = |
| 72 *base::CommandLine::ForCurrentProcess(); | 76 *base::CommandLine::ForCurrentProcess(); |
| 73 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { | 77 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { |
| 74 const std::string opt_value = | 78 const std::string opt_value = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 storage::SpecialStoragePolicy* special_storage_policy, | 143 storage::SpecialStoragePolicy* special_storage_policy, |
| 140 scoped_ptr<domain_reliability::DomainReliabilityMonitor> | 144 scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
| 141 domain_reliability_monitor, | 145 domain_reliability_monitor, |
| 142 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, | 146 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, |
| 143 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | 147 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
| 144 data_reduction_proxy_configurator, | 148 data_reduction_proxy_configurator, |
| 145 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 149 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
| 146 data_reduction_proxy_params, | 150 data_reduction_proxy_params, |
| 147 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 151 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
| 148 data_reduction_proxy_statistics_prefs, | 152 data_reduction_proxy_statistics_prefs, |
| 153 #if defined(OS_ANDROID) |
| 154 scoped_ptr<data_reduction_proxy::DataReductionProxyUIService> |
| 155 data_reduction_proxy_ui_service, |
| 156 #endif |
| 149 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> | 157 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> |
| 150 data_reduction_proxy_event_store) { | 158 data_reduction_proxy_event_store) { |
| 151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 152 DCHECK(!io_data_->lazy_params_); | 160 DCHECK(!io_data_->lazy_params_); |
| 153 DCHECK(predictor); | 161 DCHECK(predictor); |
| 154 | 162 |
| 155 LazyParams* lazy_params = new LazyParams(); | 163 LazyParams* lazy_params = new LazyParams(); |
| 156 | 164 |
| 157 lazy_params->cookie_path = cookie_path; | 165 lazy_params->cookie_path = cookie_path; |
| 158 lazy_params->channel_id_path = channel_id_path; | 166 lazy_params->channel_id_path = channel_id_path; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 180 if (io_data_->domain_reliability_monitor_) | 188 if (io_data_->domain_reliability_monitor_) |
| 181 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 189 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); |
| 182 | 190 |
| 183 io_data_->set_data_reduction_proxy_unavailable_callback( | 191 io_data_->set_data_reduction_proxy_unavailable_callback( |
| 184 data_reduction_proxy_unavailable); | 192 data_reduction_proxy_unavailable); |
| 185 io_data_->set_data_reduction_proxy_configurator( | 193 io_data_->set_data_reduction_proxy_configurator( |
| 186 data_reduction_proxy_configurator.Pass()); | 194 data_reduction_proxy_configurator.Pass()); |
| 187 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); | 195 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); |
| 188 io_data_->set_data_reduction_proxy_statistics_prefs( | 196 io_data_->set_data_reduction_proxy_statistics_prefs( |
| 189 data_reduction_proxy_statistics_prefs.Pass()); | 197 data_reduction_proxy_statistics_prefs.Pass()); |
| 198 #if defined(OS_ANDROID) |
| 199 io_data_->set_data_reduction_proxy_ui_service( |
| 200 data_reduction_proxy_ui_service.Pass()); |
| 201 #endif |
| 190 io_data_->set_data_reduction_proxy_event_store( | 202 io_data_->set_data_reduction_proxy_event_store( |
| 191 data_reduction_proxy_event_store.Pass()); | 203 data_reduction_proxy_event_store.Pass()); |
| 192 } | 204 } |
| 193 | 205 |
| 194 content::ResourceContext* | 206 content::ResourceContext* |
| 195 ProfileImplIOData::Handle::GetResourceContext() const { | 207 ProfileImplIOData::Handle::GetResourceContext() const { |
| 196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 197 LazyInitialize(); | 209 LazyInitialize(); |
| 198 return GetResourceContextNoInit(); | 210 return GetResourceContextNoInit(); |
| 199 } | 211 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 data_reduction_proxy_params(), | 478 data_reduction_proxy_params(), |
| 467 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); | 479 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); |
| 468 set_data_reduction_proxy_usage_stats( | 480 set_data_reduction_proxy_usage_stats( |
| 469 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | 481 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
| 470 (new data_reduction_proxy::DataReductionProxyUsageStats( | 482 (new data_reduction_proxy::DataReductionProxyUsageStats( |
| 471 data_reduction_proxy_params(), | 483 data_reduction_proxy_params(), |
| 472 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) | 484 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) |
| 473 .get()))); | 485 .get()))); |
| 474 data_reduction_proxy_usage_stats()->set_unavailable_callback( | 486 data_reduction_proxy_usage_stats()->set_unavailable_callback( |
| 475 data_reduction_proxy_unavailable_callback()); | 487 data_reduction_proxy_unavailable_callback()); |
| 488 #if defined(OS_ANDROID) |
| 489 if (data_reduction_proxy_ui_service()) { |
| 490 data_reduction_proxy_ui_service()->set_proxy_config_getter( |
| 491 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: |
| 492 GetProxyConfigOnIOThread, |
| 493 base::Unretained(data_reduction_proxy_configurator()))); |
| 494 } |
| 495 #endif |
| 476 | 496 |
| 477 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. | 497 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 478 tracked_objects::ScopedTracker tracking_profile3( | 498 tracked_objects::ScopedTracker tracking_profile3( |
| 479 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 499 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 480 "436671 ProfileImplIOData::InitializeInternal3")); | 500 "436671 ProfileImplIOData::InitializeInternal3")); |
| 481 | 501 |
| 482 scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> | 502 scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> |
| 483 data_reduction_proxy_network_delegate( | 503 data_reduction_proxy_network_delegate( |
| 484 new data_reduction_proxy::DataReductionProxyNetworkDelegate( | 504 new data_reduction_proxy::DataReductionProxyNetworkDelegate( |
| 485 chrome_network_delegate.Pass(), | 505 chrome_network_delegate.Pass(), |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 transport_security_state()->DeleteAllDynamicDataSince(time); | 930 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 911 DCHECK(http_server_properties_manager_); | 931 DCHECK(http_server_properties_manager_); |
| 912 http_server_properties_manager_->Clear(completion); | 932 http_server_properties_manager_->Clear(completion); |
| 913 } | 933 } |
| 914 | 934 |
| 915 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { | 935 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { |
| 916 return data_reduction_proxy_enabled_.GetValue() || | 936 return data_reduction_proxy_enabled_.GetValue() || |
| 917 base::CommandLine::ForCurrentProcess()->HasSwitch( | 937 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 918 data_reduction_proxy::switches::kEnableDataReductionProxy); | 938 data_reduction_proxy::switches::kEnableDataReductionProxy); |
| 919 } | 939 } |
| OLD | NEW |