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

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: Rebase 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/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_member.h" 12 #include "base/prefs/pref_member.h"
12 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
13 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
14 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/threading/worker_pool.h" 19 #include "base/threading/worker_pool.h"
20 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/chromeos/profiles/profile_helper.h" 22 #include "chrome/browser/chromeos/profiles/profile_helper.h"
21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 24 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
23 #include "chrome/browser/io_thread.h" 25 #include "chrome/browser/io_thread.h"
24 #include "chrome/browser/net/chrome_net_log.h" 26 #include "chrome/browser/net/chrome_net_log.h"
25 #include "chrome/browser/net/chrome_network_delegate.h" 27 #include "chrome/browser/net/chrome_network_delegate.h"
26 #include "chrome/browser/net/connect_interceptor.h" 28 #include "chrome/browser/net/connect_interceptor.h"
27 #include "chrome/browser/net/cookie_store_util.h" 29 #include "chrome/browser/net/cookie_store_util.h"
28 #include "chrome/browser/net/http_server_properties_manager_factory.h" 30 #include "chrome/browser/net/http_server_properties_manager_factory.h"
29 #include "chrome/browser/net/predictor.h" 31 #include "chrome/browser/net/predictor.h"
30 #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"
31 #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"
32 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/common/chrome_constants.h" 37 #include "chrome/common/chrome_constants.h"
34 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
36 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.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_conf igurator.h" 41 #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" 42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
40 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.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"
41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" 45 #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" 46 #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" 47 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h"
45 #include "components/domain_reliability/monitor.h" 48 #include "components/domain_reliability/monitor.h"
46 #include "content/public/browser/browser_thread.h" 49 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/cookie_store_factory.h" 50 #include "content/public/browser/cookie_store_factory.h"
48 #include "content/public/browser/notification_service.h" 51 #include "content/public/browser/notification_service.h"
49 #include "content/public/browser/resource_context.h" 52 #include "content/public/browser/resource_context.h"
50 #include "content/public/browser/storage_partition.h" 53 #include "content/public/browser/storage_partition.h"
51 #include "extensions/browser/extension_protocols.h" 54 #include "extensions/browser/extension_protocols.h"
52 #include "extensions/common/constants.h" 55 #include "extensions/common/constants.h"
(...skipping 30 matching lines...) Expand all
83 experiment_name == "ExperimentYes2") { 86 experiment_name == "ExperimentYes2") {
84 return net::CACHE_BACKEND_SIMPLE; 87 return net::CACHE_BACKEND_SIMPLE;
85 } 88 }
86 return net::CACHE_BACKEND_BLOCKFILE; 89 return net::CACHE_BACKEND_BLOCKFILE;
87 #endif 90 #endif
88 } 91 }
89 92
90 } // namespace 93 } // namespace
91 94
92 using content::BrowserThread; 95 using content::BrowserThread;
93 using data_reduction_proxy::DataReductionProxyParams;
94 96
95 ProfileImplIOData::Handle::Handle(Profile* profile) 97 ProfileImplIOData::Handle::Handle(Profile* profile)
96 : io_data_(new ProfileImplIOData), 98 : io_data_(new ProfileImplIOData),
97 profile_(profile), 99 profile_(profile),
98 initialized_(false) { 100 initialized_(false) {
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
100 DCHECK(profile); 102 DCHECK(profile);
101 } 103 }
102 104
103 ProfileImplIOData::Handle::~Handle() { 105 ProfileImplIOData::Handle::~Handle() {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
105 io_data_->data_reduction_proxy_statistics_prefs()->WritePrefs();
106
107 if (io_data_->predictor_ != NULL) { 107 if (io_data_->predictor_ != NULL) {
108 // io_data_->predictor_ might be NULL if Init() was never called 108 // io_data_->predictor_ might be NULL if Init() was never called
109 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). 109 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called).
110 bool save_prefs = true; 110 bool save_prefs = true;
111 #if defined(OS_CHROMEOS) 111 #if defined(OS_CHROMEOS)
112 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); 112 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_);
113 #endif 113 #endif
114 if (save_prefs) 114 if (save_prefs)
115 io_data_->predictor_->SaveStateForNextStartupAndTrim(); 115 io_data_->predictor_->SaveStateForNextStartupAndTrim();
116 io_data_->predictor_->ShutdownOnUIThread(); 116 io_data_->predictor_->ShutdownOnUIThread();
117 } 117 }
118 118
119 if (io_data_->http_server_properties_manager_) 119 if (io_data_->http_server_properties_manager_)
120 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); 120 io_data_->http_server_properties_manager_->ShutdownOnPrefThread();
121 121
122 io_data_->data_reduction_proxy_enabled_.Destroy(); 122 io_data_->data_reduction_proxy_io_data()->DestroyPrefsOnUIThread();
123 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); 123 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass());
124 } 124 }
125 125
126 void ProfileImplIOData::Handle::Init( 126 void ProfileImplIOData::Handle::Init(
127 const base::FilePath& cookie_path, 127 const base::FilePath& cookie_path,
128 const base::FilePath& channel_id_path, 128 const base::FilePath& channel_id_path,
129 const base::FilePath& cache_path, 129 const base::FilePath& cache_path,
130 int cache_max_size, 130 int cache_max_size,
131 const base::FilePath& media_cache_path, 131 const base::FilePath& media_cache_path,
132 int media_cache_max_size, 132 int media_cache_max_size,
133 const base::FilePath& extensions_cookie_path, 133 const base::FilePath& extensions_cookie_path,
134 const base::FilePath& profile_path, 134 const base::FilePath& profile_path,
135 const base::FilePath& infinite_cache_path, 135 const base::FilePath& infinite_cache_path,
136 chrome_browser_net::Predictor* predictor, 136 chrome_browser_net::Predictor* predictor,
137 content::CookieStoreConfig::SessionCookieMode session_cookie_mode, 137 content::CookieStoreConfig::SessionCookieMode session_cookie_mode,
138 storage::SpecialStoragePolicy* special_storage_policy, 138 storage::SpecialStoragePolicy* special_storage_policy,
139 scoped_ptr<domain_reliability::DomainReliabilityMonitor> 139 scoped_ptr<domain_reliability::DomainReliabilityMonitor>
140 domain_reliability_monitor, 140 domain_reliability_monitor) {
141 const base::Callback<void(bool)>& data_reduction_proxy_unavailable,
142 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
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)); 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
151 DCHECK(!io_data_->lazy_params_); 142 DCHECK(!io_data_->lazy_params_);
152 DCHECK(predictor); 143 DCHECK(predictor);
153 144
154 LazyParams* lazy_params = new LazyParams(); 145 LazyParams* lazy_params = new LazyParams();
155 146
156 lazy_params->cookie_path = cookie_path; 147 lazy_params->cookie_path = cookie_path;
157 lazy_params->channel_id_path = channel_id_path; 148 lazy_params->channel_id_path = channel_id_path;
158 lazy_params->cache_path = cache_path; 149 lazy_params->cache_path = cache_path;
159 lazy_params->cache_max_size = cache_max_size; 150 lazy_params->cache_max_size = cache_max_size;
(...skipping 12 matching lines...) Expand all
172 io_data_->app_cache_max_size_ = cache_max_size; 163 io_data_->app_cache_max_size_ = cache_max_size;
173 io_data_->app_media_cache_max_size_ = media_cache_max_size; 164 io_data_->app_media_cache_max_size_ = media_cache_max_size;
174 165
175 io_data_->predictor_.reset(predictor); 166 io_data_->predictor_.reset(predictor);
176 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); 167 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass();
177 168
178 io_data_->InitializeMetricsEnabledStateOnUIThread(); 169 io_data_->InitializeMetricsEnabledStateOnUIThread();
179 if (io_data_->domain_reliability_monitor_) 170 if (io_data_->domain_reliability_monitor_)
180 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); 171 io_data_->domain_reliability_monitor_->MoveToNetworkThread();
181 172
182 io_data_->set_data_reduction_proxy_unavailable_callback( 173 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log();
183 data_reduction_proxy_unavailable); 174
184 io_data_->set_data_reduction_proxy_configurator( 175 io_data_->set_data_reduction_proxy_io_data(
185 data_reduction_proxy_configurator.Pass()); 176 CreateDataReductionProxyChromeIOData(
186 io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); 177 net_log, profile_, profile_->GetPrefs(),
187 io_data_->set_data_reduction_proxy_statistics_prefs( 178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
188 data_reduction_proxy_statistics_prefs.Pass()); 179 BrowserThread::GetMessageLoopProxyForThread(
189 io_data_->set_data_reduction_proxy_event_store( 180 BrowserThread::UI)).Pass());
190 data_reduction_proxy_event_store.Pass()); 181
182 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)->
183 InitDataReductionProxySettings(
184 io_data_->data_reduction_proxy_io_data()->configurator(),
mmenke 2015/01/22 17:14:48 Optional: Can we just pass in the data_reduction_
bengr 2015/01/23 20:09:03 Done.
185 profile_->GetPrefs(),
186 g_browser_process->local_state(), profile_->GetRequestContext(),
187 net_log, io_data_->data_reduction_proxy_io_data()->event_store());
191 } 188 }
192 189
193 content::ResourceContext* 190 content::ResourceContext*
194 ProfileImplIOData::Handle::GetResourceContext() const { 191 ProfileImplIOData::Handle::GetResourceContext() const {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 LazyInitialize(); 193 LazyInitialize();
197 return GetResourceContextNoInit(); 194 return GetResourceContextNoInit();
198 } 195 }
199 196
200 content::ResourceContext* 197 content::ResourceContext*
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 io_data_->session_startup_pref()->Init( 357 io_data_->session_startup_pref()->Init(
361 prefs::kRestoreOnStartup, pref_service); 358 prefs::kRestoreOnStartup, pref_service);
362 io_data_->session_startup_pref()->MoveToThread( 359 io_data_->session_startup_pref()->MoveToThread(
363 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 360 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
364 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) 361 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
365 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, 362 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
366 pref_service); 363 pref_service);
367 io_data_->safe_browsing_enabled()->MoveToThread( 364 io_data_->safe_browsing_enabled()->MoveToThread(
368 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 365 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
369 #endif 366 #endif
370 io_data_->data_reduction_proxy_enabled_.Init(
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_); 367 io_data_->InitializeOnUIThread(profile_);
375 } 368 }
376 369
377 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> 370 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector>
378 ProfileImplIOData::Handle::GetAllContextGetters() { 371 ProfileImplIOData::Handle::GetAllContextGetters() {
379 ChromeURLRequestContextGetterMap::iterator iter; 372 ChromeURLRequestContextGetterMap::iterator iter;
380 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters( 373 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters(
381 new ChromeURLRequestContextGetterVector()); 374 new ChromeURLRequestContextGetterVector());
382 375
383 iter = isolated_media_request_context_getter_map_.begin(); 376 iter = isolated_media_request_context_getter_map_.begin();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 monitor->AddBakedInConfigs(); 444 monitor->AddBakedInConfigs();
452 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 445 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
453 chrome_network_delegate->set_domain_reliability_monitor(monitor); 446 chrome_network_delegate->set_domain_reliability_monitor(monitor);
454 } 447 }
455 448
456 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 449 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
457 tracked_objects::ScopedTracker tracking_profile2( 450 tracked_objects::ScopedTracker tracking_profile2(
458 FROM_HERE_WITH_EXPLICIT_FUNCTION( 451 FROM_HERE_WITH_EXPLICIT_FUNCTION(
459 "436671 ProfileImplIOData::InitializeInternal2")); 452 "436671 ProfileImplIOData::InitializeInternal2"));
460 453
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); 454 ApplyProfileParamsToContext(main_context);
508 455
509 if (http_server_properties_manager_) 456 if (http_server_properties_manager_)
510 http_server_properties_manager_->InitializeOnNetworkThread(); 457 http_server_properties_manager_->InitializeOnNetworkThread();
511 458
512 main_context->set_transport_security_state(transport_security_state()); 459 main_context->set_transport_security_state(transport_security_state());
513 460
514 main_context->set_net_log(io_thread->net_log()); 461 main_context->set_net_log(io_thread->net_log());
515 462
463 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate(
464 chrome_network_delegate.Pass(), true).Pass();
465
516 main_context->set_network_delegate(network_delegate_.get()); 466 main_context->set_network_delegate(network_delegate_.get());
517 467
518 main_context->set_http_server_properties(http_server_properties()); 468 main_context->set_http_server_properties(http_server_properties());
519 469
520 main_context->set_host_resolver( 470 main_context->set_host_resolver(
521 io_thread_globals->host_resolver.get()); 471 io_thread_globals->host_resolver.get());
522 main_context->set_cert_transparency_verifier( 472 main_context->set_cert_transparency_verifier(
523 io_thread_globals->cert_transparency_verifier.get()); 473 io_thread_globals->cert_transparency_verifier.get());
524 main_context->set_http_auth_handler_factory( 474 main_context->set_http_auth_handler_factory(
525 io_thread_globals->http_auth_handler_factory.get()); 475 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( 583 FROM_HERE_WITH_EXPLICIT_FUNCTION(
634 "436671 ProfileImplIOData::InitializeInternal8")); 584 "436671 ProfileImplIOData::InitializeInternal8"));
635 585
636 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 586 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
637 new net::URLRequestJobFactoryImpl()); 587 new net::URLRequestJobFactoryImpl());
638 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 588 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
639 // The data reduction proxy interceptor should be as close to the network 589 // The data reduction proxy interceptor should be as close to the network
640 // as possible. 590 // as possible.
641 request_interceptors.insert( 591 request_interceptors.insert(
642 request_interceptors.begin(), 592 request_interceptors.begin(),
643 new data_reduction_proxy::DataReductionProxyInterceptor( 593 data_reduction_proxy_io_data()->CreateInterceptor().release());
644 data_reduction_proxy_params(),
645 data_reduction_proxy_usage_stats(),
646 data_reduction_proxy_event_store()));
647 main_job_factory_ = SetUpJobFactoryDefaults( 594 main_job_factory_ = SetUpJobFactoryDefaults(
648 main_job_factory.Pass(), 595 main_job_factory.Pass(),
649 request_interceptors.Pass(), 596 request_interceptors.Pass(),
650 profile_params->protocol_handler_interceptor.Pass(), 597 profile_params->protocol_handler_interceptor.Pass(),
651 main_context->network_delegate(), 598 main_context->network_delegate(),
652 ftp_factory_.get()); 599 ftp_factory_.get());
653 main_context->set_job_factory(main_job_factory_.get()); 600 main_context->set_job_factory(main_job_factory_.get());
654 601
655 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 602 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
656 tracked_objects::ScopedTracker tracking_profile9( 603 tracked_objects::ScopedTracker tracking_profile9(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 context->SetCookieStore(cookie_store.get()); 737 context->SetCookieStore(cookie_store.get());
791 context->SetHttpTransactionFactory(app_http_cache.Pass()); 738 context->SetHttpTransactionFactory(app_http_cache.Pass());
792 739
793 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 740 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
794 new net::URLRequestJobFactoryImpl()); 741 new net::URLRequestJobFactoryImpl());
795 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 742 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
796 // The data reduction proxy interceptor should be as close to the network 743 // The data reduction proxy interceptor should be as close to the network
797 // as possible. 744 // as possible.
798 request_interceptors.insert( 745 request_interceptors.insert(
799 request_interceptors.begin(), 746 request_interceptors.begin(),
800 new data_reduction_proxy::DataReductionProxyInterceptor( 747 data_reduction_proxy_io_data()->CreateInterceptor().release());
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( 748 scoped_ptr<net::URLRequestJobFactory> top_job_factory(
805 SetUpJobFactoryDefaults(job_factory.Pass(), 749 SetUpJobFactoryDefaults(job_factory.Pass(),
806 request_interceptors.Pass(), 750 request_interceptors.Pass(),
807 protocol_handler_interceptor.Pass(), 751 protocol_handler_interceptor.Pass(),
808 main_context->network_delegate(), 752 main_context->network_delegate(),
809 ftp_factory_.get())); 753 ftp_factory_.get()));
810 context->SetJobFactory(top_job_factory.Pass()); 754 context->SetJobFactory(top_job_factory.Pass());
811 755
812 return context; 756 return context;
813 } 757 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 const base::Closure& completion) { 847 const base::Closure& completion) {
904 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 848 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
905 DCHECK(initialized()); 849 DCHECK(initialized());
906 850
907 DCHECK(transport_security_state()); 851 DCHECK(transport_security_state());
908 // Completes synchronously. 852 // Completes synchronously.
909 transport_security_state()->DeleteAllDynamicDataSince(time); 853 transport_security_state()->DeleteAllDynamicDataSince(time);
910 DCHECK(http_server_properties_manager_); 854 DCHECK(http_server_properties_manager_);
911 http_server_properties_manager_->Clear(completion); 855 http_server_properties_manager_->Clear(completion);
912 } 856 }
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