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

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

Issue 778463002: Wrapped data reduction proxy initialization into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@network-delegate
Patch Set: Addressed comments from sclittle Created 5 years, 11 months 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 10 matching lines...) Expand all
21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
23 #include "chrome/browser/io_thread.h" 23 #include "chrome/browser/io_thread.h"
24 #include "chrome/browser/net/chrome_net_log.h" 24 #include "chrome/browser/net/chrome_net_log.h"
25 #include "chrome/browser/net/chrome_network_delegate.h" 25 #include "chrome/browser/net/chrome_network_delegate.h"
26 #include "chrome/browser/net/connect_interceptor.h" 26 #include "chrome/browser/net/connect_interceptor.h"
27 #include "chrome/browser/net/cookie_store_util.h" 27 #include "chrome/browser/net/cookie_store_util.h"
28 #include "chrome/browser/net/http_server_properties_manager_factory.h" 28 #include "chrome/browser/net/http_server_properties_manager_factory.h"
29 #include "chrome/browser/net/predictor.h" 29 #include "chrome/browser/net/predictor.h"
30 #include "chrome/browser/net/quota_policy_channel_id_store.h" 30 #include "chrome/browser/net/quota_policy_channel_id_store.h"
31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
32 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/common/chrome_constants.h" 32 #include "chrome/common/chrome_constants.h"
34 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
36 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
37 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h" 36 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
38 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h"
39 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte rceptor.h"
40 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h"
41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h"
42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h"
43 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" 37 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h"
45 #include "components/domain_reliability/monitor.h" 38 #include "components/domain_reliability/monitor.h"
46 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/cookie_store_factory.h" 40 #include "content/public/browser/cookie_store_factory.h"
48 #include "content/public/browser/notification_service.h" 41 #include "content/public/browser/notification_service.h"
49 #include "content/public/browser/resource_context.h" 42 #include "content/public/browser/resource_context.h"
50 #include "content/public/browser/storage_partition.h" 43 #include "content/public/browser/storage_partition.h"
51 #include "extensions/browser/extension_protocols.h" 44 #include "extensions/browser/extension_protocols.h"
52 #include "extensions/common/constants.h" 45 #include "extensions/common/constants.h"
53 #include "net/base/cache_type.h" 46 #include "net/base/cache_type.h"
(...skipping 29 matching lines...) Expand all
83 experiment_name == "ExperimentYes2") { 76 experiment_name == "ExperimentYes2") {
84 return net::CACHE_BACKEND_SIMPLE; 77 return net::CACHE_BACKEND_SIMPLE;
85 } 78 }
86 return net::CACHE_BACKEND_BLOCKFILE; 79 return net::CACHE_BACKEND_BLOCKFILE;
87 #endif 80 #endif
88 } 81 }
89 82
90 } // namespace 83 } // namespace
91 84
92 using content::BrowserThread; 85 using content::BrowserThread;
93 using data_reduction_proxy::DataReductionProxyParams;
94 86
95 ProfileImplIOData::Handle::Handle(Profile* profile) 87 ProfileImplIOData::Handle::Handle(Profile* profile)
96 : io_data_(new ProfileImplIOData), 88 : io_data_(new ProfileImplIOData),
97 profile_(profile), 89 profile_(profile),
98 initialized_(false) { 90 initialized_(false) {
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
100 DCHECK(profile); 92 DCHECK(profile);
101 } 93 }
102 94
103 ProfileImplIOData::Handle::~Handle() { 95 ProfileImplIOData::Handle::~Handle() {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
105 io_data_->data_reduction_proxy_statistics_prefs()->WritePrefs();
106
107 if (io_data_->predictor_ != NULL) { 97 if (io_data_->predictor_ != NULL) {
108 // io_data_->predictor_ might be NULL if Init() was never called 98 // io_data_->predictor_ might be NULL if Init() was never called
109 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). 99 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called).
110 bool save_prefs = true; 100 bool save_prefs = true;
111 #if defined(OS_CHROMEOS) 101 #if defined(OS_CHROMEOS)
112 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); 102 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_);
113 #endif 103 #endif
114 if (save_prefs) 104 if (save_prefs)
115 io_data_->predictor_->SaveStateForNextStartupAndTrim(); 105 io_data_->predictor_->SaveStateForNextStartupAndTrim();
116 io_data_->predictor_->ShutdownOnUIThread(); 106 io_data_->predictor_->ShutdownOnUIThread();
117 } 107 }
118 108
119 if (io_data_->http_server_properties_manager_) 109 if (io_data_->http_server_properties_manager_)
120 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); 110 io_data_->http_server_properties_manager_->ShutdownOnPrefThread();
121 111
122 io_data_->data_reduction_proxy_enabled_.Destroy(); 112 io_data_->data_reduction_proxy_io_data()->DestroyPrefsOnUIThread();
123 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); 113 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass());
124 } 114 }
125 115
126 void ProfileImplIOData::Handle::Init( 116 void ProfileImplIOData::Handle::Init(
127 const base::FilePath& cookie_path, 117 const base::FilePath& cookie_path,
128 const base::FilePath& channel_id_path, 118 const base::FilePath& channel_id_path,
129 const base::FilePath& cache_path, 119 const base::FilePath& cache_path,
130 int cache_max_size, 120 int cache_max_size,
131 const base::FilePath& media_cache_path, 121 const base::FilePath& media_cache_path,
132 int media_cache_max_size, 122 int media_cache_max_size,
133 const base::FilePath& extensions_cookie_path, 123 const base::FilePath& extensions_cookie_path,
134 const base::FilePath& profile_path, 124 const base::FilePath& profile_path,
135 const base::FilePath& infinite_cache_path, 125 const base::FilePath& infinite_cache_path,
136 chrome_browser_net::Predictor* predictor, 126 chrome_browser_net::Predictor* predictor,
137 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, 127 content::CookieStoreConfig::SessionCookieMode session_cookie_mode,
138 storage::SpecialStoragePolicy* special_storage_policy, 128 storage::SpecialStoragePolicy* special_storage_policy,
139 scoped_ptr<domain_reliability::DomainReliabilityMonitor> 129 scoped_ptr<domain_reliability::DomainReliabilityMonitor>
140 domain_reliability_monitor, 130 domain_reliability_monitor,
141 const base::Callback<void(bool)>& data_reduction_proxy_unavailable, 131 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
142 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> 132 data_reduction_proxy_io_data) {
143 data_reduction_proxy_configurator,
144 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
145 data_reduction_proxy_params,
146 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
147 data_reduction_proxy_statistics_prefs,
148 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore>
149 data_reduction_proxy_event_store) {
150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
151 DCHECK(!io_data_->lazy_params_); 134 DCHECK(!io_data_->lazy_params_);
152 DCHECK(predictor); 135 DCHECK(predictor);
153 136
154 LazyParams* lazy_params = new LazyParams(); 137 LazyParams* lazy_params = new LazyParams();
155 138
156 lazy_params->cookie_path = cookie_path; 139 lazy_params->cookie_path = cookie_path;
157 lazy_params->channel_id_path = channel_id_path; 140 lazy_params->channel_id_path = channel_id_path;
158 lazy_params->cache_path = cache_path; 141 lazy_params->cache_path = cache_path;
159 lazy_params->cache_max_size = cache_max_size; 142 lazy_params->cache_max_size = cache_max_size;
(...skipping 12 matching lines...) Expand all
172 io_data_->app_cache_max_size_ = cache_max_size; 155 io_data_->app_cache_max_size_ = cache_max_size;
173 io_data_->app_media_cache_max_size_ = media_cache_max_size; 156 io_data_->app_media_cache_max_size_ = media_cache_max_size;
174 157
175 io_data_->predictor_.reset(predictor); 158 io_data_->predictor_.reset(predictor);
176 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); 159 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass();
177 160
178 io_data_->InitializeMetricsEnabledStateOnUIThread(); 161 io_data_->InitializeMetricsEnabledStateOnUIThread();
179 if (io_data_->domain_reliability_monitor_) 162 if (io_data_->domain_reliability_monitor_)
180 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); 163 io_data_->domain_reliability_monitor_->MoveToNetworkThread();
181 164
182 io_data_->set_data_reduction_proxy_unavailable_callback( 165 io_data_->set_data_reduction_proxy_io_data(
183 data_reduction_proxy_unavailable); 166 data_reduction_proxy_io_data.Pass());
184 io_data_->set_data_reduction_proxy_configurator(
185 data_reduction_proxy_configurator.Pass());
186 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass());
187 io_data_->set_data_reduction_proxy_statistics_prefs(
188 data_reduction_proxy_statistics_prefs.Pass());
189 io_data_->set_data_reduction_proxy_event_store(
190 data_reduction_proxy_event_store.Pass());
191 } 167 }
192 168
193 content::ResourceContext* 169 content::ResourceContext*
194 ProfileImplIOData::Handle::GetResourceContext() const { 170 ProfileImplIOData::Handle::GetResourceContext() const {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 LazyInitialize(); 172 LazyInitialize();
197 return GetResourceContextNoInit(); 173 return GetResourceContextNoInit();
198 } 174 }
199 175
200 content::ResourceContext* 176 content::ResourceContext*
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 io_data_->session_startup_pref()->Init( 336 io_data_->session_startup_pref()->Init(
361 prefs::kRestoreOnStartup, pref_service); 337 prefs::kRestoreOnStartup, pref_service);
362 io_data_->session_startup_pref()->MoveToThread( 338 io_data_->session_startup_pref()->MoveToThread(
363 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 339 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
364 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) 340 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
365 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, 341 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
366 pref_service); 342 pref_service);
367 io_data_->safe_browsing_enabled()->MoveToThread( 343 io_data_->safe_browsing_enabled()->MoveToThread(
368 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 344 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
369 #endif 345 #endif
370 io_data_->data_reduction_proxy_enabled_.Init( 346 io_data_->data_reduction_proxy_io_data()->InitPrefsOnUIThread(pref_service);
mmenke 2015/01/16 19:03:20 We're already passing the prefs to CreateDataReduc
bengr 2015/01/17 00:20:47 Done.
371 data_reduction_proxy::prefs::kDataReductionProxyEnabled, pref_service);
372 io_data_->data_reduction_proxy_enabled_.MoveToThread(
373 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
374 io_data_->InitializeOnUIThread(profile_); 347 io_data_->InitializeOnUIThread(profile_);
375 } 348 }
376 349
377 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> 350 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector>
378 ProfileImplIOData::Handle::GetAllContextGetters() { 351 ProfileImplIOData::Handle::GetAllContextGetters() {
379 ChromeURLRequestContextGetterMap::iterator iter; 352 ChromeURLRequestContextGetterMap::iterator iter;
380 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters( 353 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters(
381 new ChromeURLRequestContextGetterVector()); 354 new ChromeURLRequestContextGetterVector());
382 355
383 iter = isolated_media_request_context_getter_map_.begin(); 356 iter = isolated_media_request_context_getter_map_.begin();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 monitor->AddBakedInConfigs(); 424 monitor->AddBakedInConfigs();
452 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 425 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
453 chrome_network_delegate->set_domain_reliability_monitor(monitor); 426 chrome_network_delegate->set_domain_reliability_monitor(monitor);
454 } 427 }
455 428
456 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 429 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
457 tracked_objects::ScopedTracker tracking_profile2( 430 tracked_objects::ScopedTracker tracking_profile2(
458 FROM_HERE_WITH_EXPLICIT_FUNCTION( 431 FROM_HERE_WITH_EXPLICIT_FUNCTION(
459 "436671 ProfileImplIOData::InitializeInternal2")); 432 "436671 ProfileImplIOData::InitializeInternal2"));
460 433
461 set_data_reduction_proxy_auth_request_handler(
462 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
463 (new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
464 DataReductionProxyChromeSettings::GetClient(),
465 data_reduction_proxy_params(),
466 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))));
467 set_data_reduction_proxy_usage_stats(
468 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
469 (new data_reduction_proxy::DataReductionProxyUsageStats(
470 data_reduction_proxy_params(),
471 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)
472 .get())));
473 data_reduction_proxy_usage_stats()->set_unavailable_callback(
474 data_reduction_proxy_unavailable_callback());
475
476 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
477 tracked_objects::ScopedTracker tracking_profile3(
478 FROM_HERE_WITH_EXPLICIT_FUNCTION(
479 "436671 ProfileImplIOData::InitializeInternal3"));
480
481 scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate>
482 data_reduction_proxy_network_delegate(
483 new data_reduction_proxy::DataReductionProxyNetworkDelegate(
484 chrome_network_delegate.Pass(),
485 data_reduction_proxy_params(),
486 data_reduction_proxy_auth_request_handler(),
487 base::Bind(
488 &data_reduction_proxy::DataReductionProxyConfigurator::
489 GetProxyConfigOnIOThread,
490 base::Unretained(data_reduction_proxy_configurator()))));
491 data_reduction_proxy_network_delegate->InitProxyConfigOverrider(
492 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
493 data_reduction_proxy_network_delegate->InitStatisticsPrefsAndUMA(
494 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
495 data_reduction_proxy_statistics_prefs(),
496 &data_reduction_proxy_enabled_,
497 data_reduction_proxy_usage_stats());
498 network_delegate_ = data_reduction_proxy_network_delegate.Pass();
499
500 // Initialize context members.
501
502 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
503 tracked_objects::ScopedTracker tracking_profile4(
504 FROM_HERE_WITH_EXPLICIT_FUNCTION(
505 "436671 ProfileImplIOData::InitializeInternal4"));
506
507 ApplyProfileParamsToContext(main_context); 434 ApplyProfileParamsToContext(main_context);
508 435
509 if (http_server_properties_manager_) 436 if (http_server_properties_manager_)
510 http_server_properties_manager_->InitializeOnNetworkThread(); 437 http_server_properties_manager_->InitializeOnNetworkThread();
511 438
512 main_context->set_transport_security_state(transport_security_state()); 439 main_context->set_transport_security_state(transport_security_state());
513 440
514 main_context->set_net_log(io_thread->net_log()); 441 main_context->set_net_log(io_thread->net_log());
515 442
443 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate(
444 chrome_network_delegate.Pass(), true).Pass();
445
516 main_context->set_network_delegate(network_delegate_.get()); 446 main_context->set_network_delegate(network_delegate_.get());
517 447
518 main_context->set_http_server_properties(http_server_properties()); 448 main_context->set_http_server_properties(http_server_properties());
519 449
520 main_context->set_host_resolver( 450 main_context->set_host_resolver(
521 io_thread_globals->host_resolver.get()); 451 io_thread_globals->host_resolver.get());
522 main_context->set_cert_transparency_verifier( 452 main_context->set_cert_transparency_verifier(
523 io_thread_globals->cert_transparency_verifier.get()); 453 io_thread_globals->cert_transparency_verifier.get());
524 main_context->set_http_auth_handler_factory( 454 main_context->set_http_auth_handler_factory(
525 io_thread_globals->http_auth_handler_factory.get()); 455 io_thread_globals->http_auth_handler_factory.get());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 FROM_HERE_WITH_EXPLICIT_FUNCTION( 563 FROM_HERE_WITH_EXPLICIT_FUNCTION(
634 "436671 ProfileImplIOData::InitializeInternal8")); 564 "436671 ProfileImplIOData::InitializeInternal8"));
635 565
636 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 566 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
637 new net::URLRequestJobFactoryImpl()); 567 new net::URLRequestJobFactoryImpl());
638 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 568 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
639 // The data reduction proxy interceptor should be as close to the network 569 // The data reduction proxy interceptor should be as close to the network
640 // as possible. 570 // as possible.
641 request_interceptors.insert( 571 request_interceptors.insert(
642 request_interceptors.begin(), 572 request_interceptors.begin(),
643 new data_reduction_proxy::DataReductionProxyInterceptor( 573 data_reduction_proxy_io_data()->CreateInterceptor());
644 data_reduction_proxy_params(),
645 data_reduction_proxy_usage_stats(),
646 data_reduction_proxy_event_store()));
647 main_job_factory_ = SetUpJobFactoryDefaults( 574 main_job_factory_ = SetUpJobFactoryDefaults(
648 main_job_factory.Pass(), 575 main_job_factory.Pass(),
649 request_interceptors.Pass(), 576 request_interceptors.Pass(),
650 profile_params->protocol_handler_interceptor.Pass(), 577 profile_params->protocol_handler_interceptor.Pass(),
651 main_context->network_delegate(), 578 main_context->network_delegate(),
652 ftp_factory_.get()); 579 ftp_factory_.get());
653 main_context->set_job_factory(main_job_factory_.get()); 580 main_context->set_job_factory(main_job_factory_.get());
654 581
655 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 582 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
656 tracked_objects::ScopedTracker tracking_profile9( 583 tracked_objects::ScopedTracker tracking_profile9(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 context->SetCookieStore(cookie_store.get()); 717 context->SetCookieStore(cookie_store.get());
791 context->SetHttpTransactionFactory(app_http_cache.Pass()); 718 context->SetHttpTransactionFactory(app_http_cache.Pass());
792 719
793 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 720 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
794 new net::URLRequestJobFactoryImpl()); 721 new net::URLRequestJobFactoryImpl());
795 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 722 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
796 // The data reduction proxy interceptor should be as close to the network 723 // The data reduction proxy interceptor should be as close to the network
797 // as possible. 724 // as possible.
798 request_interceptors.insert( 725 request_interceptors.insert(
799 request_interceptors.begin(), 726 request_interceptors.begin(),
800 new data_reduction_proxy::DataReductionProxyInterceptor( 727 data_reduction_proxy_io_data()->CreateInterceptor());
801 data_reduction_proxy_params(),
802 data_reduction_proxy_usage_stats(),
803 data_reduction_proxy_event_store()));
804 scoped_ptr<net::URLRequestJobFactory> top_job_factory( 728 scoped_ptr<net::URLRequestJobFactory> top_job_factory(
805 SetUpJobFactoryDefaults(job_factory.Pass(), 729 SetUpJobFactoryDefaults(job_factory.Pass(),
806 request_interceptors.Pass(), 730 request_interceptors.Pass(),
807 protocol_handler_interceptor.Pass(), 731 protocol_handler_interceptor.Pass(),
808 main_context->network_delegate(), 732 main_context->network_delegate(),
809 ftp_factory_.get())); 733 ftp_factory_.get()));
810 context->SetJobFactory(top_job_factory.Pass()); 734 context->SetJobFactory(top_job_factory.Pass());
811 735
812 return context; 736 return context;
813 } 737 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 const base::Closure& completion) { 827 const base::Closure& completion) {
904 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 828 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
905 DCHECK(initialized()); 829 DCHECK(initialized());
906 830
907 DCHECK(transport_security_state()); 831 DCHECK(transport_security_state());
908 // Completes synchronously. 832 // Completes synchronously.
909 transport_security_state()->DeleteAllDynamicDataSince(time); 833 transport_security_state()->DeleteAllDynamicDataSince(time);
910 DCHECK(http_server_properties_manager_); 834 DCHECK(http_server_properties_manager_);
911 http_server_properties_manager_->Clear(completion); 835 http_server_properties_manager_->Clear(completion);
912 } 836 }
913
914 bool ProfileImplIOData::IsDataReductionProxyEnabled() const {
915 return data_reduction_proxy_enabled_.GetValue() ||
916 base::CommandLine::ForCurrentProcess()->HasSwitch(
917 data_reduction_proxy::switches::kEnableDataReductionProxy);
918 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698