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

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

Issue 734263003: Move data reduction proxy logic out of chrome and android webview network delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 19 matching lines...) Expand all
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 ProfileImplIOData::LazyParams::~LazyParams() {} 404 ProfileImplIOData::LazyParams::~LazyParams() {}
404 405
405 ProfileImplIOData::ProfileImplIOData() 406 ProfileImplIOData::ProfileImplIOData()
406 : ProfileIOData(Profile::REGULAR_PROFILE), 407 : ProfileIOData(Profile::REGULAR_PROFILE),
407 http_server_properties_manager_(NULL), 408 http_server_properties_manager_(NULL),
408 app_cache_max_size_(0), 409 app_cache_max_size_(0),
409 app_media_cache_max_size_(0) { 410 app_media_cache_max_size_(0) {
410 } 411 }
411 412
412 ProfileImplIOData::~ProfileImplIOData() { 413 ProfileImplIOData::~ProfileImplIOData() {
413 if (initialized()) 414 if (initialized()) {
414 network_delegate()->set_domain_reliability_monitor(NULL); 415 chrome_network_delegate()->set_domain_reliability_monitor(NULL);
416 }
415 417
416 DestroyResourceContext(); 418 DestroyResourceContext();
417 419
418 if (media_request_context_) 420 if (media_request_context_)
419 media_request_context_->AssertNoURLRequests(); 421 media_request_context_->AssertNoURLRequests();
420 } 422 }
421 423
422 void ProfileImplIOData::InitializeInternal( 424 void ProfileImplIOData::InitializeInternal(
423 ProfileParams* profile_params, 425 ProfileParams* profile_params,
424 content::ProtocolHandlerMap* protocol_handlers, 426 content::ProtocolHandlerMap* protocol_handlers,
(...skipping 11 matching lines...) Expand all
436 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); 438 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))));
437 set_data_reduction_proxy_usage_stats( 439 set_data_reduction_proxy_usage_stats(
438 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> 440 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
439 (new data_reduction_proxy::DataReductionProxyUsageStats( 441 (new data_reduction_proxy::DataReductionProxyUsageStats(
440 data_reduction_proxy_params(), 442 data_reduction_proxy_params(),
441 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) 443 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)
442 .get()))); 444 .get())));
443 data_reduction_proxy_usage_stats()->set_unavailable_callback( 445 data_reduction_proxy_usage_stats()->set_unavailable_callback(
444 data_reduction_proxy_unavailable_callback()); 446 data_reduction_proxy_unavailable_callback());
445 447
446 network_delegate()->set_data_reduction_proxy_enabled_pref( 448 network_delegate()->
bengr 2014/11/18 19:30:55 These can be put into a single DRPNetworkDelegate:
megjablon 2014/11/19 19:23:40 Done.
447 &data_reduction_proxy_enabled_); 449 set_data_reduction_proxy_enabled_pref(&data_reduction_proxy_enabled_);
448 network_delegate()->set_data_reduction_proxy_params( 450 network_delegate()->set_data_reduction_proxy_params(
449 data_reduction_proxy_params()); 451 data_reduction_proxy_params());
450 network_delegate()->set_data_reduction_proxy_usage_stats( 452 network_delegate()->set_data_reduction_proxy_usage_stats(
451 data_reduction_proxy_usage_stats()); 453 data_reduction_proxy_usage_stats());
452 network_delegate()->set_data_reduction_proxy_auth_request_handler( 454 network_delegate()->
453 data_reduction_proxy_auth_request_handler()); 455 set_data_reduction_proxy_auth_request_handler(
454 network_delegate()->set_data_reduction_proxy_statistics_prefs( 456 data_reduction_proxy_auth_request_handler());
455 data_reduction_proxy_statistics_prefs()); 457 network_delegate()->
458 set_data_reduction_proxy_statistics_prefs(
459 data_reduction_proxy_statistics_prefs());
456 network_delegate()->set_on_resolve_proxy_handler( 460 network_delegate()->set_on_resolve_proxy_handler(
457 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 461 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
458 network_delegate()->set_proxy_config_getter( 462 network_delegate()->set_proxy_config_getter(
459 base::Bind( 463 base::Bind(
460 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO, 464 &DataReductionProxyChromeConfigurator::GetProxyConfigOnIO,
461 base::Unretained(data_reduction_proxy_chrome_configurator()))); 465 base::Unretained(data_reduction_proxy_chrome_configurator())));
462 network_delegate()->set_predictor(predictor_.get()); 466 chrome_network_delegate()->set_predictor(predictor_.get());
463 467
464 // Initialize context members. 468 // Initialize context members.
465 469
466 ApplyProfileParamsToContext(main_context); 470 ApplyProfileParamsToContext(main_context);
467 471
468 if (http_server_properties_manager_) 472 if (http_server_properties_manager_)
469 http_server_properties_manager_->InitializeOnNetworkThread(); 473 http_server_properties_manager_->InitializeOnNetworkThread();
470 474
471 main_context->set_transport_security_state(transport_security_state()); 475 main_context->set_transport_security_state(transport_security_state());
472 476
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 StoragePartitionDescriptor details(profile_path_, false); 603 StoragePartitionDescriptor details(profile_path_, false);
600 media_request_context_.reset(InitializeMediaRequestContext(main_context, 604 media_request_context_.reset(InitializeMediaRequestContext(main_context,
601 details)); 605 details));
602 606
603 if (domain_reliability_monitor_) { 607 if (domain_reliability_monitor_) {
604 domain_reliability::DomainReliabilityMonitor* monitor = 608 domain_reliability::DomainReliabilityMonitor* monitor =
605 domain_reliability_monitor_.get(); 609 domain_reliability_monitor_.get();
606 monitor->InitURLRequestContext(main_context); 610 monitor->InitURLRequestContext(main_context);
607 monitor->AddBakedInConfigs(); 611 monitor->AddBakedInConfigs();
608 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 612 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
609 network_delegate()->set_domain_reliability_monitor(monitor); 613 chrome_network_delegate()->set_domain_reliability_monitor(monitor);
610 } 614 }
611 615
612 lazy_params_.reset(); 616 lazy_params_.reset();
613 } 617 }
614 618
615 void ProfileImplIOData:: 619 void ProfileImplIOData::
616 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { 620 InitializeExtensionsRequestContext(ProfileParams* profile_params) const {
617 net::URLRequestContext* extensions_context = extensions_request_context(); 621 net::URLRequestContext* extensions_context = extensions_request_context();
618 IOThread* const io_thread = profile_params->io_thread; 622 IOThread* const io_thread = profile_params->io_thread;
619 IOThread::Globals* const io_thread_globals = io_thread->globals(); 623 IOThread::Globals* const io_thread_globals = io_thread->globals();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 transport_security_state()->DeleteAllDynamicDataSince(time); 849 transport_security_state()->DeleteAllDynamicDataSince(time);
846 DCHECK(http_server_properties_manager_); 850 DCHECK(http_server_properties_manager_);
847 http_server_properties_manager_->Clear(completion); 851 http_server_properties_manager_->Clear(completion);
848 } 852 }
849 853
850 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { 854 bool ProfileImplIOData::IsDataReductionProxyEnabled() const {
851 return data_reduction_proxy_enabled_.GetValue() || 855 return data_reduction_proxy_enabled_.GetValue() ||
852 CommandLine::ForCurrentProcess()->HasSwitch( 856 CommandLine::ForCurrentProcess()->HasSwitch(
853 data_reduction_proxy::switches::kEnableDataReductionProxy); 857 data_reduction_proxy::switches::kEnableDataReductionProxy);
854 } 858 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698