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" |
11 #include "base/prefs/pref_member.h" | 11 #include "base/prefs/pref_member.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
22 #include "chrome/browser/io_thread.h" | 22 #include "chrome/browser/io_thread.h" |
23 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
24 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
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_factory.h" | 27 #include "chrome/browser/net/http_server_properties_manager_factory.h" |
28 #include "chrome/browser/net/predictor.h" | 28 #include "chrome/browser/net/predictor.h" |
| 29 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
29 #include "chrome/browser/net/sqlite_channel_id_store.h" | 30 #include "chrome/browser/net/sqlite_channel_id_store.h" |
30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
35 #include "components/domain_reliability/monitor.h" | 36 #include "components/domain_reliability/monitor.h" |
36 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/cookie_store_factory.h" | 38 #include "content/public/browser/cookie_store_factory.h" |
38 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int media_cache_max_size, | 147 int media_cache_max_size, |
147 const base::FilePath& extensions_cookie_path, | 148 const base::FilePath& extensions_cookie_path, |
148 const base::FilePath& profile_path, | 149 const base::FilePath& profile_path, |
149 const base::FilePath& infinite_cache_path, | 150 const base::FilePath& infinite_cache_path, |
150 chrome_browser_net::Predictor* predictor, | 151 chrome_browser_net::Predictor* predictor, |
151 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, | 152 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, |
152 quota::SpecialStoragePolicy* special_storage_policy, | 153 quota::SpecialStoragePolicy* special_storage_policy, |
153 scoped_ptr<domain_reliability::DomainReliabilityMonitor> | 154 scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
154 domain_reliability_monitor, | 155 domain_reliability_monitor, |
155 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, | 156 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, |
| 157 scoped_ptr<DataReductionProxyChromeConfigurator> |
| 158 data_reduction_proxy_chrome_configurator, |
156 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 159 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
157 data_reduction_proxy_params) { | 160 data_reduction_proxy_params) { |
158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
159 DCHECK(!io_data_->lazy_params_); | 162 DCHECK(!io_data_->lazy_params_); |
160 DCHECK(predictor); | 163 DCHECK(predictor); |
161 | 164 |
162 LazyParams* lazy_params = new LazyParams(); | 165 LazyParams* lazy_params = new LazyParams(); |
163 | 166 |
164 lazy_params->cookie_path = cookie_path; | 167 lazy_params->cookie_path = cookie_path; |
165 lazy_params->channel_id_path = channel_id_path; | 168 lazy_params->channel_id_path = channel_id_path; |
(...skipping 15 matching lines...) Expand all Loading... |
181 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 184 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
182 | 185 |
183 io_data_->predictor_.reset(predictor); | 186 io_data_->predictor_.reset(predictor); |
184 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); | 187 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); |
185 | 188 |
186 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 189 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
187 | 190 |
188 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 191 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
189 io_data_->data_reduction_proxy_unavailable_callback_ = | 192 io_data_->data_reduction_proxy_unavailable_callback_ = |
190 data_reduction_proxy_unavailable; | 193 data_reduction_proxy_unavailable; |
| 194 io_data_->data_reduction_proxy_chrome_configurator_ = |
| 195 data_reduction_proxy_chrome_configurator.Pass(); |
191 io_data_->data_reduction_proxy_params_ = | 196 io_data_->data_reduction_proxy_params_ = |
192 data_reduction_proxy_params.Pass(); | 197 data_reduction_proxy_params.Pass(); |
193 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 198 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
194 } | 199 } |
195 | 200 |
196 content::ResourceContext* | 201 content::ResourceContext* |
197 ProfileImplIOData::Handle::GetResourceContext() const { | 202 ProfileImplIOData::Handle::GetResourceContext() const { |
198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
199 LazyInitialize(); | 204 LazyInitialize(); |
200 return GetResourceContextNoInit(); | 205 return GetResourceContextNoInit(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 433 |
429 | 434 |
430 network_delegate()->set_data_reduction_proxy_params( | 435 network_delegate()->set_data_reduction_proxy_params( |
431 data_reduction_proxy_params_.get()); | 436 data_reduction_proxy_params_.get()); |
432 network_delegate()->set_data_reduction_proxy_usage_stats( | 437 network_delegate()->set_data_reduction_proxy_usage_stats( |
433 data_reduction_proxy_usage_stats_.get()); | 438 data_reduction_proxy_usage_stats_.get()); |
434 network_delegate()->set_data_reduction_proxy_auth_request_handler( | 439 network_delegate()->set_data_reduction_proxy_auth_request_handler( |
435 data_reduction_proxy_auth_request_handler_.get()); | 440 data_reduction_proxy_auth_request_handler_.get()); |
436 network_delegate()->set_on_resolve_proxy_handler( | 441 network_delegate()->set_on_resolve_proxy_handler( |
437 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); | 442 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
| 443 network_delegate()->set_proxy_config_getter( |
| 444 base::Bind( |
| 445 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO, |
| 446 base::Unretained(data_reduction_proxy_chrome_configurator_.get()))); |
438 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 447 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
439 | 448 |
440 network_delegate()->set_predictor(predictor_.get()); | 449 network_delegate()->set_predictor(predictor_.get()); |
441 | 450 |
442 // Initialize context members. | 451 // Initialize context members. |
443 | 452 |
444 ApplyProfileParamsToContext(main_context); | 453 ApplyProfileParamsToContext(main_context); |
445 | 454 |
446 if (http_server_properties_manager_) | 455 if (http_server_properties_manager_) |
447 http_server_properties_manager_->InitializeOnNetworkThread(); | 456 http_server_properties_manager_->InitializeOnNetworkThread(); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 const base::Closure& completion) { | 826 const base::Closure& completion) { |
818 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 827 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
819 DCHECK(initialized()); | 828 DCHECK(initialized()); |
820 | 829 |
821 DCHECK(transport_security_state()); | 830 DCHECK(transport_security_state()); |
822 // Completes synchronously. | 831 // Completes synchronously. |
823 transport_security_state()->DeleteAllDynamicDataSince(time); | 832 transport_security_state()->DeleteAllDynamicDataSince(time); |
824 DCHECK(http_server_properties_manager_); | 833 DCHECK(http_server_properties_manager_); |
825 http_server_properties_manager_->Clear(completion); | 834 http_server_properties_manager_->Clear(completion); |
826 } | 835 } |
OLD | NEW |