Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 684223003: Data Reduction Proxy Interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "net/base/cache_type.h" 54 #include "net/base/cache_type.h"
55 #include "net/base/sdch_manager.h" 55 #include "net/base/sdch_manager.h"
56 #include "net/ftp/ftp_network_layer.h" 56 #include "net/ftp/ftp_network_layer.h"
57 #include "net/http/http_cache.h" 57 #include "net/http/http_cache.h"
58 #include "net/http/http_server_properties_manager.h" 58 #include "net/http/http_server_properties_manager.h"
59 #include "net/ssl/channel_id_service.h" 59 #include "net/ssl/channel_id_service.h"
60 #include "net/url_request/url_request_intercepting_job_factory.h" 60 #include "net/url_request/url_request_intercepting_job_factory.h"
61 #include "net/url_request/url_request_job_factory_impl.h" 61 #include "net/url_request/url_request_job_factory_impl.h"
62 #include "storage/browser/quota/special_storage_policy.h" 62 #include "storage/browser/quota/special_storage_policy.h"
63 63
64 #if defined(OS_ANDROID)
bengr 2014/12/17 00:30:19 Include unconditionally.
megjablon 2014/12/23 02:18:03 We decided not to have a base class as discussed o
65 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_u i_service.h"
66 #endif
67
64 namespace { 68 namespace {
65 69
66 net::BackendType ChooseCacheBackendType() { 70 net::BackendType ChooseCacheBackendType() {
67 #if defined(OS_ANDROID) 71 #if defined(OS_ANDROID)
68 return net::CACHE_BACKEND_SIMPLE; 72 return net::CACHE_BACKEND_SIMPLE;
69 #else 73 #else
70 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 74 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
71 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { 75 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) {
72 const std::string opt_value = 76 const std::string opt_value =
73 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); 77 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 storage::SpecialStoragePolicy* special_storage_policy, 141 storage::SpecialStoragePolicy* special_storage_policy,
138 scoped_ptr<domain_reliability::DomainReliabilityMonitor> 142 scoped_ptr<domain_reliability::DomainReliabilityMonitor>
139 domain_reliability_monitor, 143 domain_reliability_monitor,
140 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, 144 const base::Callback<void(bool)>& data_reduction_proxy_unavailable,
141 scoped_ptr<DataReductionProxyChromeConfigurator> 145 scoped_ptr<DataReductionProxyChromeConfigurator>
142 data_reduction_proxy_chrome_configurator, 146 data_reduction_proxy_chrome_configurator,
143 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 147 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
144 data_reduction_proxy_params, 148 data_reduction_proxy_params,
145 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> 149 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
146 data_reduction_proxy_statistics_prefs, 150 data_reduction_proxy_statistics_prefs,
151 #if defined(OS_ANDROID)
bengr 2014/12/17 00:30:19 Remove #if defined
megjablon 2014/12/23 02:18:03 We decided not to have a base class as discussed o
152 scoped_ptr<data_reduction_proxy::DataReductionProxyUIService>
153 data_reduction_proxy_ui_service,
154 #endif
147 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> 155 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore>
148 data_reduction_proxy_event_store) { 156 data_reduction_proxy_event_store) {
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
150 DCHECK(!io_data_->lazy_params_); 158 DCHECK(!io_data_->lazy_params_);
151 DCHECK(predictor); 159 DCHECK(predictor);
152 160
153 LazyParams* lazy_params = new LazyParams(); 161 LazyParams* lazy_params = new LazyParams();
154 162
155 lazy_params->cookie_path = cookie_path; 163 lazy_params->cookie_path = cookie_path;
156 lazy_params->channel_id_path = channel_id_path; 164 lazy_params->channel_id_path = channel_id_path;
(...skipping 21 matching lines...) Expand all
178 if (io_data_->domain_reliability_monitor_) 186 if (io_data_->domain_reliability_monitor_)
179 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); 187 io_data_->domain_reliability_monitor_->MoveToNetworkThread();
180 188
181 io_data_->set_data_reduction_proxy_unavailable_callback( 189 io_data_->set_data_reduction_proxy_unavailable_callback(
182 data_reduction_proxy_unavailable); 190 data_reduction_proxy_unavailable);
183 io_data_->set_data_reduction_proxy_chrome_configurator( 191 io_data_->set_data_reduction_proxy_chrome_configurator(
184 data_reduction_proxy_chrome_configurator.Pass()); 192 data_reduction_proxy_chrome_configurator.Pass());
185 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); 193 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass());
186 io_data_->set_data_reduction_proxy_statistics_prefs( 194 io_data_->set_data_reduction_proxy_statistics_prefs(
187 data_reduction_proxy_statistics_prefs.Pass()); 195 data_reduction_proxy_statistics_prefs.Pass());
196 #if defined(OS_ANDROID)
bengr 2014/12/17 00:30:19 Remove #if defined
megjablon 2014/12/23 02:18:03 We decided not to have a base class as discussed o
197 io_data_->set_data_reduction_proxy_ui_service(
198 data_reduction_proxy_ui_service.Pass());
199 #endif
188 io_data_->set_data_reduction_proxy_event_store( 200 io_data_->set_data_reduction_proxy_event_store(
189 data_reduction_proxy_event_store.Pass()); 201 data_reduction_proxy_event_store.Pass());
190 } 202 }
191 203
192 content::ResourceContext* 204 content::ResourceContext*
193 ProfileImplIOData::Handle::GetResourceContext() const { 205 ProfileImplIOData::Handle::GetResourceContext() const {
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
195 LazyInitialize(); 207 LazyInitialize();
196 return GetResourceContextNoInit(); 208 return GetResourceContextNoInit();
197 } 209 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 data_reduction_proxy_params(), 461 data_reduction_proxy_params(),
450 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); 462 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))));
451 set_data_reduction_proxy_usage_stats( 463 set_data_reduction_proxy_usage_stats(
452 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> 464 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
453 (new data_reduction_proxy::DataReductionProxyUsageStats( 465 (new data_reduction_proxy::DataReductionProxyUsageStats(
454 data_reduction_proxy_params(), 466 data_reduction_proxy_params(),
455 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) 467 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)
456 .get()))); 468 .get())));
457 data_reduction_proxy_usage_stats()->set_unavailable_callback( 469 data_reduction_proxy_usage_stats()->set_unavailable_callback(
458 data_reduction_proxy_unavailable_callback()); 470 data_reduction_proxy_unavailable_callback());
471 #if defined(OS_ANDROID)
bengr 2014/12/17 00:30:19 Remove #if defined
megjablon 2014/12/23 02:18:03 We decided not to have a base class as discussed o
472 if (data_reduction_proxy_ui_service()) {
473 data_reduction_proxy_ui_service()->set_proxy_config_getter(
474 base::Bind(
475 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread,
476 base::Unretained(data_reduction_proxy_chrome_configurator())));
477 }
478 #endif
459 479
460 scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> 480 scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate>
461 data_reduction_proxy_network_delegate( 481 data_reduction_proxy_network_delegate(
462 new data_reduction_proxy::DataReductionProxyNetworkDelegate( 482 new data_reduction_proxy::DataReductionProxyNetworkDelegate(
463 chrome_network_delegate.Pass(), 483 chrome_network_delegate.Pass(),
464 data_reduction_proxy_params(), 484 data_reduction_proxy_params(),
465 data_reduction_proxy_auth_request_handler(), 485 data_reduction_proxy_auth_request_handler(),
466 base::Bind( 486 base::Bind(
467 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread, 487 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread,
468 base::Unretained(data_reduction_proxy_chrome_configurator())))); 488 base::Unretained(data_reduction_proxy_chrome_configurator()))));
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 transport_security_state()->DeleteAllDynamicDataSince(time); 872 transport_security_state()->DeleteAllDynamicDataSince(time);
853 DCHECK(http_server_properties_manager_); 873 DCHECK(http_server_properties_manager_);
854 http_server_properties_manager_->Clear(completion); 874 http_server_properties_manager_->Clear(completion);
855 } 875 }
856 876
857 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { 877 bool ProfileImplIOData::IsDataReductionProxyEnabled() const {
858 return data_reduction_proxy_enabled_.GetValue() || 878 return data_reduction_proxy_enabled_.GetValue() ||
859 CommandLine::ForCurrentProcess()->HasSwitch( 879 CommandLine::ForCurrentProcess()->HasSwitch(
860 data_reduction_proxy::switches::kEnableDataReductionProxy); 880 data_reduction_proxy::switches::kEnableDataReductionProxy);
861 } 881 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698