| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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/spdyproxy/data_reduction_proxy_chrome_io_data.h" | 33 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
| 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 35 #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" |
| 36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
| 38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 40 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | |
| 42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | |
| 44 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | |
| 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | |
| 47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | |
| 48 #include "components/domain_reliability/monitor.h" | 43 #include "components/domain_reliability/monitor.h" |
| 49 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/cookie_store_factory.h" | 45 #include "content/public/browser/cookie_store_factory.h" |
| 51 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 52 #include "content/public/browser/resource_context.h" | 47 #include "content/public/browser/resource_context.h" |
| 53 #include "content/public/browser/storage_partition.h" | 48 #include "content/public/browser/storage_partition.h" |
| 54 #include "extensions/browser/extension_protocols.h" | 49 #include "extensions/browser/extension_protocols.h" |
| 55 #include "extensions/common/constants.h" | 50 #include "extensions/common/constants.h" |
| 56 #include "net/base/cache_type.h" | 51 #include "net/base/cache_type.h" |
| 57 #include "net/base/sdch_manager.h" | 52 #include "net/base/sdch_manager.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 io_data_->app_cache_max_size_ = cache_max_size; | 158 io_data_->app_cache_max_size_ = cache_max_size; |
| 164 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 159 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
| 165 | 160 |
| 166 io_data_->predictor_.reset(predictor); | 161 io_data_->predictor_.reset(predictor); |
| 167 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); | 162 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); |
| 168 | 163 |
| 169 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 164 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 170 if (io_data_->domain_reliability_monitor_) | 165 if (io_data_->domain_reliability_monitor_) |
| 171 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 166 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); |
| 172 | 167 |
| 173 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); | |
| 174 | |
| 175 io_data_->set_data_reduction_proxy_io_data( | |
| 176 CreateDataReductionProxyChromeIOData( | |
| 177 net_log, profile_, profile_->GetPrefs(), | |
| 178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
| 179 BrowserThread::GetMessageLoopProxyForThread( | |
| 180 BrowserThread::UI)).Pass()); | |
| 181 | |
| 182 // TODO(tbansal): Move this to IO thread once the data reduction proxy | 168 // TODO(tbansal): Move this to IO thread once the data reduction proxy |
| 183 // params are unified into a single object. | 169 // params are unified into a single object. |
| 184 bool enable_quic_for_data_reduction_proxy = | 170 bool enable_quic_for_data_reduction_proxy = |
| 185 IOThread::ShouldEnableQuicForDataReductionProxy(); | 171 IOThread::ShouldEnableQuicForDataReductionProxy(); |
| 186 | 172 |
| 173 io_data_->set_data_reduction_proxy_io_data( |
| 174 CreateDataReductionProxyChromeIOData( |
| 175 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), |
| 176 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 177 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 178 enable_quic_for_data_reduction_proxy) |
| 179 .Pass()); |
| 180 |
| 187 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)-> | 181 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)-> |
| 188 InitDataReductionProxySettings(io_data_->data_reduction_proxy_io_data(), | 182 InitDataReductionProxySettings( |
| 189 profile_->GetPrefs(), | 183 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(), |
| 190 g_browser_process->local_state(), | 184 profile_->GetRequestContext(), |
| 191 profile_->GetRequestContext(), | 185 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)); |
| 192 enable_quic_for_data_reduction_proxy); | |
| 193 } | 186 } |
| 194 | 187 |
| 195 content::ResourceContext* | 188 content::ResourceContext* |
| 196 ProfileImplIOData::Handle::GetResourceContext() const { | 189 ProfileImplIOData::Handle::GetResourceContext() const { |
| 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 198 LazyInitialize(); | 191 LazyInitialize(); |
| 199 return GetResourceContextNoInit(); | 192 return GetResourceContextNoInit(); |
| 200 } | 193 } |
| 201 | 194 |
| 202 content::ResourceContext* | 195 content::ResourceContext* |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 451 |
| 459 ApplyProfileParamsToContext(main_context); | 452 ApplyProfileParamsToContext(main_context); |
| 460 | 453 |
| 461 if (http_server_properties_manager_) | 454 if (http_server_properties_manager_) |
| 462 http_server_properties_manager_->InitializeOnNetworkThread(); | 455 http_server_properties_manager_->InitializeOnNetworkThread(); |
| 463 | 456 |
| 464 main_context->set_transport_security_state(transport_security_state()); | 457 main_context->set_transport_security_state(transport_security_state()); |
| 465 | 458 |
| 466 main_context->set_net_log(io_thread->net_log()); | 459 main_context->set_net_log(io_thread->net_log()); |
| 467 | 460 |
| 468 data_reduction_proxy_io_data()->Init(); | |
| 469 | |
| 470 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate( | 461 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| 471 chrome_network_delegate.Pass(), true).Pass(); | 462 chrome_network_delegate.Pass(), true).Pass(); |
| 472 | 463 |
| 473 main_context->set_network_delegate(network_delegate_.get()); | 464 main_context->set_network_delegate(network_delegate_.get()); |
| 474 | 465 |
| 475 main_context->set_http_server_properties(http_server_properties()); | 466 main_context->set_http_server_properties(http_server_properties()); |
| 476 | 467 |
| 477 main_context->set_host_resolver( | 468 main_context->set_host_resolver( |
| 478 io_thread_globals->host_resolver.get()); | 469 io_thread_globals->host_resolver.get()); |
| 479 main_context->set_cert_transparency_verifier( | 470 main_context->set_cert_transparency_verifier( |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 const base::Closure& completion) { | 846 const base::Closure& completion) { |
| 856 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 847 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 857 DCHECK(initialized()); | 848 DCHECK(initialized()); |
| 858 | 849 |
| 859 DCHECK(transport_security_state()); | 850 DCHECK(transport_security_state()); |
| 860 // Completes synchronously. | 851 // Completes synchronously. |
| 861 transport_security_state()->DeleteAllDynamicDataSince(time); | 852 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 862 DCHECK(http_server_properties_manager_); | 853 DCHECK(http_server_properties_manager_); |
| 863 http_server_properties_manager_->Clear(completion); | 854 http_server_properties_manager_->Clear(completion); |
| 864 } | 855 } |
| OLD | NEW |