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 19 matching lines...) Expand all Loading... | |
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_configurator. h" | 31 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" |
32 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 32 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.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_auth _request_handler.h" |
39 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte rceptor.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" | |
40 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.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_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/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_param s.h" |
44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" | 45 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" |
45 #include "components/domain_reliability/monitor.h" | 46 #include "components/domain_reliability/monitor.h" |
46 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/cookie_store_factory.h" | 48 #include "content/public/browser/cookie_store_factory.h" |
48 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
49 #include "content/public/browser/resource_context.h" | 50 #include "content/public/browser/resource_context.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 ProfileImplIOData::LazyParams::~LazyParams() {} | 408 ProfileImplIOData::LazyParams::~LazyParams() {} |
408 | 409 |
409 ProfileImplIOData::ProfileImplIOData() | 410 ProfileImplIOData::ProfileImplIOData() |
410 : ProfileIOData(Profile::REGULAR_PROFILE), | 411 : ProfileIOData(Profile::REGULAR_PROFILE), |
411 http_server_properties_manager_(NULL), | 412 http_server_properties_manager_(NULL), |
412 app_cache_max_size_(0), | 413 app_cache_max_size_(0), |
413 app_media_cache_max_size_(0) { | 414 app_media_cache_max_size_(0) { |
414 } | 415 } |
415 | 416 |
416 ProfileImplIOData::~ProfileImplIOData() { | 417 ProfileImplIOData::~ProfileImplIOData() { |
417 if (initialized()) | 418 if (initialized()) { |
418 network_delegate()->set_domain_reliability_monitor(NULL); | 419 chrome_network_delegate()->set_domain_reliability_monitor(NULL); |
420 } | |
bengr
2014/12/02 17:20:00
Remove curly braces.
megjablon
2014/12/02 22:33:21
Done.
| |
419 | 421 |
420 DestroyResourceContext(); | 422 DestroyResourceContext(); |
421 | 423 |
422 if (media_request_context_) | 424 if (media_request_context_) |
423 media_request_context_->AssertNoURLRequests(); | 425 media_request_context_->AssertNoURLRequests(); |
424 } | 426 } |
425 | 427 |
426 void ProfileImplIOData::InitializeInternal( | 428 void ProfileImplIOData::InitializeInternal( |
427 ProfileParams* profile_params, | 429 ProfileParams* profile_params, |
428 content::ProtocolHandlerMap* protocol_handlers, | 430 content::ProtocolHandlerMap* protocol_handlers, |
(...skipping 11 matching lines...) Expand all Loading... | |
440 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); | 442 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); |
441 set_data_reduction_proxy_usage_stats( | 443 set_data_reduction_proxy_usage_stats( |
442 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | 444 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
443 (new data_reduction_proxy::DataReductionProxyUsageStats( | 445 (new data_reduction_proxy::DataReductionProxyUsageStats( |
444 data_reduction_proxy_params(), | 446 data_reduction_proxy_params(), |
445 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) | 447 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) |
446 .get()))); | 448 .get()))); |
447 data_reduction_proxy_usage_stats()->set_unavailable_callback( | 449 data_reduction_proxy_usage_stats()->set_unavailable_callback( |
448 data_reduction_proxy_unavailable_callback()); | 450 data_reduction_proxy_unavailable_callback()); |
449 | 451 |
450 network_delegate()->set_data_reduction_proxy_enabled_pref( | 452 network_delegate()->Init( |
bengr
2014/12/02 17:20:00
Try to tighten this up. I think these parameters s
megjablon
2014/12/02 22:33:21
I have moved everything to the constructor and got
| |
451 &data_reduction_proxy_enabled_); | 453 NULL, NULL, |
452 network_delegate()->set_data_reduction_proxy_params( | 454 &data_reduction_proxy_enabled_, |
453 data_reduction_proxy_params()); | 455 data_reduction_proxy_params(), |
454 network_delegate()->set_data_reduction_proxy_usage_stats( | 456 data_reduction_proxy_usage_stats(), |
455 data_reduction_proxy_usage_stats()); | 457 data_reduction_proxy_auth_request_handler(), |
456 network_delegate()->set_data_reduction_proxy_auth_request_handler( | 458 data_reduction_proxy_statistics_prefs(), |
457 data_reduction_proxy_auth_request_handler()); | 459 base::Bind(data_reduction_proxy::OnResolveProxyHandler), |
458 network_delegate()->set_data_reduction_proxy_statistics_prefs( | |
459 data_reduction_proxy_statistics_prefs()); | |
460 network_delegate()->set_on_resolve_proxy_handler( | |
461 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); | |
462 network_delegate()->set_proxy_config_getter( | |
463 base::Bind( | 460 base::Bind( |
464 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread, | 461 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread, |
465 base::Unretained(data_reduction_proxy_chrome_configurator()))); | 462 base::Unretained(data_reduction_proxy_chrome_configurator()))); |
466 network_delegate()->set_predictor(predictor_.get()); | 463 chrome_network_delegate()->set_predictor(predictor_.get()); |
467 | 464 |
468 // Initialize context members. | 465 // Initialize context members. |
469 | 466 |
470 ApplyProfileParamsToContext(main_context); | 467 ApplyProfileParamsToContext(main_context); |
471 | 468 |
472 if (http_server_properties_manager_) | 469 if (http_server_properties_manager_) |
473 http_server_properties_manager_->InitializeOnNetworkThread(); | 470 http_server_properties_manager_->InitializeOnNetworkThread(); |
474 | 471 |
475 main_context->set_transport_security_state(transport_security_state()); | 472 main_context->set_transport_security_state(transport_security_state()); |
476 | 473 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
604 StoragePartitionDescriptor details(profile_path_, false); | 601 StoragePartitionDescriptor details(profile_path_, false); |
605 media_request_context_.reset(InitializeMediaRequestContext(main_context, | 602 media_request_context_.reset(InitializeMediaRequestContext(main_context, |
606 details)); | 603 details)); |
607 | 604 |
608 if (domain_reliability_monitor_) { | 605 if (domain_reliability_monitor_) { |
609 domain_reliability::DomainReliabilityMonitor* monitor = | 606 domain_reliability::DomainReliabilityMonitor* monitor = |
610 domain_reliability_monitor_.get(); | 607 domain_reliability_monitor_.get(); |
611 monitor->InitURLRequestContext(main_context); | 608 monitor->InitURLRequestContext(main_context); |
612 monitor->AddBakedInConfigs(); | 609 monitor->AddBakedInConfigs(); |
613 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); | 610 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); |
614 network_delegate()->set_domain_reliability_monitor(monitor); | 611 chrome_network_delegate()->set_domain_reliability_monitor(monitor); |
615 } | 612 } |
616 | 613 |
617 lazy_params_.reset(); | 614 lazy_params_.reset(); |
618 } | 615 } |
619 | 616 |
620 void ProfileImplIOData:: | 617 void ProfileImplIOData:: |
621 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { | 618 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { |
622 net::URLRequestContext* extensions_context = extensions_request_context(); | 619 net::URLRequestContext* extensions_context = extensions_request_context(); |
623 IOThread* const io_thread = profile_params->io_thread; | 620 IOThread* const io_thread = profile_params->io_thread; |
624 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 621 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
851 transport_security_state()->DeleteAllDynamicDataSince(time); | 848 transport_security_state()->DeleteAllDynamicDataSince(time); |
852 DCHECK(http_server_properties_manager_); | 849 DCHECK(http_server_properties_manager_); |
853 http_server_properties_manager_->Clear(completion); | 850 http_server_properties_manager_->Clear(completion); |
854 } | 851 } |
855 | 852 |
856 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { | 853 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { |
857 return data_reduction_proxy_enabled_.GetValue() || | 854 return data_reduction_proxy_enabled_.GetValue() || |
858 CommandLine::ForCurrentProcess()->HasSwitch( | 855 CommandLine::ForCurrentProcess()->HasSwitch( |
859 data_reduction_proxy::switches::kEnableDataReductionProxy); | 856 data_reduction_proxy::switches::kEnableDataReductionProxy); |
860 } | 857 } |
OLD | NEW |