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

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 comment from mmenke 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()->ShutdownOnUIThread();
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();
mmenke 2015/01/23 20:48:54 optional: Don't think const is necessary here.
bengr 2015/01/23 22:33:42 Leaving as is for now, because this is how the cod
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(io_data_->data_reduction_proxy_io_data(),
184 profile_->GetPrefs(),
185 g_browser_process->local_state(),
186 profile_->GetRequestContext());
191 } 187 }
192 188
193 content::ResourceContext* 189 content::ResourceContext*
194 ProfileImplIOData::Handle::GetResourceContext() const { 190 ProfileImplIOData::Handle::GetResourceContext() const {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 LazyInitialize(); 192 LazyInitialize();
197 return GetResourceContextNoInit(); 193 return GetResourceContextNoInit();
198 } 194 }
199 195
200 content::ResourceContext* 196 content::ResourceContext*
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 io_data_->session_startup_pref()->Init( 356 io_data_->session_startup_pref()->Init(
361 prefs::kRestoreOnStartup, pref_service); 357 prefs::kRestoreOnStartup, pref_service);
362 io_data_->session_startup_pref()->MoveToThread( 358 io_data_->session_startup_pref()->MoveToThread(
363 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 359 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
364 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) 360 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
365 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, 361 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
366 pref_service); 362 pref_service);
367 io_data_->safe_browsing_enabled()->MoveToThread( 363 io_data_->safe_browsing_enabled()->MoveToThread(
368 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 364 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
369 #endif 365 #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_); 366 io_data_->InitializeOnUIThread(profile_);
375 } 367 }
376 368
377 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> 369 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector>
378 ProfileImplIOData::Handle::GetAllContextGetters() { 370 ProfileImplIOData::Handle::GetAllContextGetters() {
379 ChromeURLRequestContextGetterMap::iterator iter; 371 ChromeURLRequestContextGetterMap::iterator iter;
380 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters( 372 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters(
381 new ChromeURLRequestContextGetterVector()); 373 new ChromeURLRequestContextGetterVector());
382 374
383 iter = isolated_media_request_context_getter_map_.begin(); 375 iter = isolated_media_request_context_getter_map_.begin();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 monitor->AddBakedInConfigs(); 443 monitor->AddBakedInConfigs();
452 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 444 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
453 chrome_network_delegate->set_domain_reliability_monitor(monitor); 445 chrome_network_delegate->set_domain_reliability_monitor(monitor);
454 } 446 }
455 447
456 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 448 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
457 tracked_objects::ScopedTracker tracking_profile2( 449 tracked_objects::ScopedTracker tracking_profile2(
458 FROM_HERE_WITH_EXPLICIT_FUNCTION( 450 FROM_HERE_WITH_EXPLICIT_FUNCTION(
459 "436671 ProfileImplIOData::InitializeInternal2")); 451 "436671 ProfileImplIOData::InitializeInternal2"));
460 452
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); 453 ApplyProfileParamsToContext(main_context);
508 454
509 if (http_server_properties_manager_) 455 if (http_server_properties_manager_)
510 http_server_properties_manager_->InitializeOnNetworkThread(); 456 http_server_properties_manager_->InitializeOnNetworkThread();
511 457
512 main_context->set_transport_security_state(transport_security_state()); 458 main_context->set_transport_security_state(transport_security_state());
513 459
514 main_context->set_net_log(io_thread->net_log()); 460 main_context->set_net_log(io_thread->net_log());
515 461
462 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate(
463 chrome_network_delegate.Pass(), true).Pass();
464
516 main_context->set_network_delegate(network_delegate_.get()); 465 main_context->set_network_delegate(network_delegate_.get());
517 466
518 main_context->set_http_server_properties(http_server_properties()); 467 main_context->set_http_server_properties(http_server_properties());
519 468
520 main_context->set_host_resolver( 469 main_context->set_host_resolver(
521 io_thread_globals->host_resolver.get()); 470 io_thread_globals->host_resolver.get());
522 main_context->set_cert_transparency_verifier( 471 main_context->set_cert_transparency_verifier(
523 io_thread_globals->cert_transparency_verifier.get()); 472 io_thread_globals->cert_transparency_verifier.get());
524 main_context->set_http_auth_handler_factory( 473 main_context->set_http_auth_handler_factory(
525 io_thread_globals->http_auth_handler_factory.get()); 474 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( 582 FROM_HERE_WITH_EXPLICIT_FUNCTION(
634 "436671 ProfileImplIOData::InitializeInternal8")); 583 "436671 ProfileImplIOData::InitializeInternal8"));
635 584
636 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 585 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
637 new net::URLRequestJobFactoryImpl()); 586 new net::URLRequestJobFactoryImpl());
638 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 587 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
639 // The data reduction proxy interceptor should be as close to the network 588 // The data reduction proxy interceptor should be as close to the network
640 // as possible. 589 // as possible.
641 request_interceptors.insert( 590 request_interceptors.insert(
642 request_interceptors.begin(), 591 request_interceptors.begin(),
643 new data_reduction_proxy::DataReductionProxyInterceptor( 592 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( 593 main_job_factory_ = SetUpJobFactoryDefaults(
648 main_job_factory.Pass(), 594 main_job_factory.Pass(),
649 request_interceptors.Pass(), 595 request_interceptors.Pass(),
650 profile_params->protocol_handler_interceptor.Pass(), 596 profile_params->protocol_handler_interceptor.Pass(),
651 main_context->network_delegate(), 597 main_context->network_delegate(),
652 ftp_factory_.get()); 598 ftp_factory_.get());
653 main_context->set_job_factory(main_job_factory_.get()); 599 main_context->set_job_factory(main_job_factory_.get());
654 600
655 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 601 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
656 tracked_objects::ScopedTracker tracking_profile9( 602 tracked_objects::ScopedTracker tracking_profile9(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 context->SetCookieStore(cookie_store.get()); 736 context->SetCookieStore(cookie_store.get());
791 context->SetHttpTransactionFactory(app_http_cache.Pass()); 737 context->SetHttpTransactionFactory(app_http_cache.Pass());
792 738
793 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 739 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
794 new net::URLRequestJobFactoryImpl()); 740 new net::URLRequestJobFactoryImpl());
795 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 741 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
796 // The data reduction proxy interceptor should be as close to the network 742 // The data reduction proxy interceptor should be as close to the network
797 // as possible. 743 // as possible.
798 request_interceptors.insert( 744 request_interceptors.insert(
799 request_interceptors.begin(), 745 request_interceptors.begin(),
800 new data_reduction_proxy::DataReductionProxyInterceptor( 746 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( 747 scoped_ptr<net::URLRequestJobFactory> top_job_factory(
805 SetUpJobFactoryDefaults(job_factory.Pass(), 748 SetUpJobFactoryDefaults(job_factory.Pass(),
806 request_interceptors.Pass(), 749 request_interceptors.Pass(),
807 protocol_handler_interceptor.Pass(), 750 protocol_handler_interceptor.Pass(),
808 main_context->network_delegate(), 751 main_context->network_delegate(),
809 ftp_factory_.get())); 752 ftp_factory_.get()));
810 context->SetJobFactory(top_job_factory.Pass()); 753 context->SetJobFactory(top_job_factory.Pass());
811 754
812 return context; 755 return context;
813 } 756 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 const base::Closure& completion) { 846 const base::Closure& completion) {
904 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 847 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
905 DCHECK(initialized()); 848 DCHECK(initialized());
906 849
907 DCHECK(transport_security_state()); 850 DCHECK(transport_security_state());
908 // Completes synchronously. 851 // Completes synchronously.
909 transport_security_state()->DeleteAllDynamicDataSince(time); 852 transport_security_state()->DeleteAllDynamicDataSince(time);
910 DCHECK(http_server_properties_manager_); 853 DCHECK(http_server_properties_manager_);
911 http_server_properties_manager_->Clear(completion); 854 http_server_properties_manager_->Clear(completion);
912 } 855 }
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
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698