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 16 matching lines...) Expand all Loading... | |
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/quota_policy_channel_id_store.h" | 29 #include "chrome/browser/net/quota_policy_channel_id_store.h" |
30 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" | 30 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" |
31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
33 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "components/data_reduction_proxy/content/data_reduction_proxy_ui_servic e.h" | |
37 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h" | 38 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h" |
38 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.h" | 39 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.h" |
39 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" | 40 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" |
40 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h" |
41 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" | 42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" |
42 #include "components/domain_reliability/monitor.h" | 43 #include "components/domain_reliability/monitor.h" |
43 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/cookie_store_factory.h" | 45 #include "content/public/browser/cookie_store_factory.h" |
45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/resource_context.h" | 47 #include "content/public/browser/resource_context.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, | 133 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, |
133 storage::SpecialStoragePolicy* special_storage_policy, | 134 storage::SpecialStoragePolicy* special_storage_policy, |
134 scoped_ptr<domain_reliability::DomainReliabilityMonitor> | 135 scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
135 domain_reliability_monitor, | 136 domain_reliability_monitor, |
136 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, | 137 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, |
137 scoped_ptr<DataReductionProxyChromeConfigurator> | 138 scoped_ptr<DataReductionProxyChromeConfigurator> |
138 data_reduction_proxy_chrome_configurator, | 139 data_reduction_proxy_chrome_configurator, |
139 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 140 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
140 data_reduction_proxy_params, | 141 data_reduction_proxy_params, |
141 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 142 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
142 data_reduction_proxy_statistics_prefs) { | 143 data_reduction_proxy_statistics_prefs, |
144 scoped_ptr<data_reduction_proxy::DataReductionProxyUIService> | |
bengr
2014/10/31 17:06:47
Hmm. This UI service won't be available on iOS. I'
| |
145 data_reduction_proxy_ui_service) { | |
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
144 DCHECK(!io_data_->lazy_params_); | 147 DCHECK(!io_data_->lazy_params_); |
145 DCHECK(predictor); | 148 DCHECK(predictor); |
146 | 149 |
147 LazyParams* lazy_params = new LazyParams(); | 150 LazyParams* lazy_params = new LazyParams(); |
148 | 151 |
149 lazy_params->cookie_path = cookie_path; | 152 lazy_params->cookie_path = cookie_path; |
150 lazy_params->channel_id_path = channel_id_path; | 153 lazy_params->channel_id_path = channel_id_path; |
151 lazy_params->cache_path = cache_path; | 154 lazy_params->cache_path = cache_path; |
152 lazy_params->cache_max_size = cache_max_size; | 155 lazy_params->cache_max_size = cache_max_size; |
(...skipping 19 matching lines...) Expand all Loading... | |
172 if (io_data_->domain_reliability_monitor_) | 175 if (io_data_->domain_reliability_monitor_) |
173 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 176 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); |
174 | 177 |
175 io_data_->set_data_reduction_proxy_unavailable_callback( | 178 io_data_->set_data_reduction_proxy_unavailable_callback( |
176 data_reduction_proxy_unavailable); | 179 data_reduction_proxy_unavailable); |
177 io_data_->set_data_reduction_proxy_chrome_configurator( | 180 io_data_->set_data_reduction_proxy_chrome_configurator( |
178 data_reduction_proxy_chrome_configurator.Pass()); | 181 data_reduction_proxy_chrome_configurator.Pass()); |
179 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); | 182 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); |
180 io_data_->set_data_reduction_proxy_statistics_prefs( | 183 io_data_->set_data_reduction_proxy_statistics_prefs( |
181 data_reduction_proxy_statistics_prefs.Pass()); | 184 data_reduction_proxy_statistics_prefs.Pass()); |
185 io_data_->set_data_reduction_proxy_ui_service( | |
bengr
2014/10/31 17:06:47
Now would be a good time to write a DataReductionP
megjablon
2014/12/11 23:32:04
Done.
| |
186 data_reduction_proxy_ui_service.Pass()); | |
182 } | 187 } |
183 | 188 |
184 content::ResourceContext* | 189 content::ResourceContext* |
185 ProfileImplIOData::Handle::GetResourceContext() const { | 190 ProfileImplIOData::Handle::GetResourceContext() const { |
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
187 LazyInitialize(); | 192 LazyInitialize(); |
188 return GetResourceContextNoInit(); | 193 return GetResourceContextNoInit(); |
189 } | 194 } |
190 | 195 |
191 content::ResourceContext* | 196 content::ResourceContext* |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 data_reduction_proxy_params(), | 437 data_reduction_proxy_params(), |
433 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); | 438 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); |
434 set_data_reduction_proxy_usage_stats( | 439 set_data_reduction_proxy_usage_stats( |
435 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | 440 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
436 (new data_reduction_proxy::DataReductionProxyUsageStats( | 441 (new data_reduction_proxy::DataReductionProxyUsageStats( |
437 data_reduction_proxy_params(), | 442 data_reduction_proxy_params(), |
438 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) | 443 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) |
439 .get()))); | 444 .get()))); |
440 data_reduction_proxy_usage_stats()->set_unavailable_callback( | 445 data_reduction_proxy_usage_stats()->set_unavailable_callback( |
441 data_reduction_proxy_unavailable_callback()); | 446 data_reduction_proxy_unavailable_callback()); |
447 #if defined(OS_ANDROID) | |
bengr
2014/10/31 17:06:47
Can you do this if the ui_service() is not NULL in
megjablon
2014/12/11 23:32:04
Done.
| |
448 data_reduction_proxy_ui_service()->set_proxy_config_getter( | |
449 base::Bind( | |
450 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO, | |
451 base::Unretained(data_reduction_proxy_chrome_configurator()))); | |
452 #endif | |
442 | 453 |
443 network_delegate()->set_data_reduction_proxy_enabled_pref( | 454 network_delegate()->set_data_reduction_proxy_enabled_pref( |
444 &data_reduction_proxy_enabled_); | 455 &data_reduction_proxy_enabled_); |
445 network_delegate()->set_data_reduction_proxy_params( | 456 network_delegate()->set_data_reduction_proxy_params( |
446 data_reduction_proxy_params()); | 457 data_reduction_proxy_params()); |
447 network_delegate()->set_data_reduction_proxy_usage_stats( | 458 network_delegate()->set_data_reduction_proxy_usage_stats( |
448 data_reduction_proxy_usage_stats()); | 459 data_reduction_proxy_usage_stats()); |
449 network_delegate()->set_data_reduction_proxy_auth_request_handler( | 460 network_delegate()->set_data_reduction_proxy_auth_request_handler( |
450 data_reduction_proxy_auth_request_handler()); | 461 data_reduction_proxy_auth_request_handler()); |
451 network_delegate()->set_data_reduction_proxy_statistics_prefs( | 462 network_delegate()->set_data_reduction_proxy_statistics_prefs( |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 transport_security_state()->DeleteAllDynamicDataSince(time); | 841 transport_security_state()->DeleteAllDynamicDataSince(time); |
831 DCHECK(http_server_properties_manager_); | 842 DCHECK(http_server_properties_manager_); |
832 http_server_properties_manager_->Clear(completion); | 843 http_server_properties_manager_->Clear(completion); |
833 } | 844 } |
834 | 845 |
835 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { | 846 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { |
836 return data_reduction_proxy_enabled_.GetValue() || | 847 return data_reduction_proxy_enabled_.GetValue() || |
837 CommandLine::ForCurrentProcess()->HasSwitch( | 848 CommandLine::ForCurrentProcess()->HasSwitch( |
838 data_reduction_proxy::switches::kEnableDataReductionProxy); | 849 data_reduction_proxy::switches::kEnableDataReductionProxy); |
839 } | 850 } |
OLD | NEW |