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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 #if !defined(USE_OPENSSL) 88 #if !defined(USE_OPENSSL)
89 #include "net/cert/ct_log_verifier.h" 89 #include "net/cert/ct_log_verifier.h"
90 #include "net/cert/multi_log_ct_verifier.h" 90 #include "net/cert/multi_log_ct_verifier.h"
91 #endif 91 #endif
92 92
93 #if defined(USE_NSS) || defined(OS_IOS) 93 #if defined(USE_NSS) || defined(OS_IOS)
94 #include "net/ocsp/nss_ocsp.h" 94 #include "net/ocsp/nss_ocsp.h"
95 #endif 95 #endif
96 96
97 #if defined(OS_ANDROID) || defined(OS_IOS) 97 #if defined(SPDY_PROXY_AUTH_ORIGIN)
98 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
99 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
98 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 100 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
99 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
100 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 102
102 #endif 103 using data_reduction_proxy::DataReductionProxyParams;
104 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
103 105
104 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
105 #include "chrome/browser/chromeos/login/users/user_manager.h" 107 #include "chrome/browser/chromeos/login/users/user_manager.h"
106 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
107 #include "chromeos/network/host_resolver_impl_chromeos.h" 109 #include "chromeos/network/host_resolver_impl_chromeos.h"
108 #endif 110 #endif
109 111
110 using content::BrowserThread; 112 using content::BrowserThread;
111 113
112 #if defined(OS_ANDROID) || defined(OS_IOS)
113 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
114 using data_reduction_proxy::DataReductionProxyParams;
115 using data_reduction_proxy::DataReductionProxyUsageStats;
116 using data_reduction_proxy::DataReductionProxySettings;
117 #endif
118
119 class SafeBrowsingURLRequestContext; 114 class SafeBrowsingURLRequestContext;
120 115
121 // The IOThread object must outlive any tasks posted to the IO thread before the 116 // The IOThread object must outlive any tasks posted to the IO thread before the
122 // Quit task, so base::Bind() calls are not refcounted. 117 // Quit task, so base::Bind() calls are not refcounted.
123 118
124 namespace { 119 namespace {
125 120
126 const char kQuicFieldTrialName[] = "QUIC"; 121 const char kQuicFieldTrialName[] = "QUIC";
127 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 122 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
128 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 123 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 565
571 #if defined(ENABLE_EXTENSIONS) 566 #if defined(ENABLE_EXTENSIONS)
572 globals_->extension_event_router_forwarder = 567 globals_->extension_event_router_forwarder =
573 extension_event_router_forwarder_; 568 extension_event_router_forwarder_;
574 #endif 569 #endif
575 570
576 ChromeNetworkDelegate* network_delegate = 571 ChromeNetworkDelegate* network_delegate =
577 new ChromeNetworkDelegate(extension_event_router_forwarder(), 572 new ChromeNetworkDelegate(extension_event_router_forwarder(),
578 &system_enable_referrers_); 573 &system_enable_referrers_);
579 574
575 #if defined(SPDY_PROXY_AUTH_ORIGIN)
576 int drp_flags = DataReductionProxyParams::kFallbackAllowed;
577 if (DataReductionProxyParams::IsIncludedInFieldTrial())
578 drp_flags |= DataReductionProxyParams::kAllowed;
579 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
580 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
581 data_reduction_proxy_params_.reset(
582 new DataReductionProxyParams(drp_flags));
583 data_reduction_proxy_auth_request_handler_.reset(
584 new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
585 data_reduction_proxy_params_.get()));
586
587 // This is the same as in ProfileImplIOData except that we do not collect
588 // usage stats.
589 network_delegate->set_data_reduction_proxy_params(
590 data_reduction_proxy_params_.get());
591 network_delegate->set_data_reduction_proxy_auth_request_handler(
592 data_reduction_proxy_auth_request_handler_.get());
593 network_delegate->set_on_resolve_proxy_handler(
594 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
595 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
596
580 if (command_line.HasSwitch(switches::kEnableClientHints)) 597 if (command_line.HasSwitch(switches::kEnableClientHints))
581 network_delegate->SetEnableClientHints(); 598 network_delegate->SetEnableClientHints();
582 599
583 #if defined(ENABLE_EXTENSIONS) 600 #if defined(ENABLE_EXTENSIONS)
584 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) 601 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
585 network_delegate->NeverThrottleRequests(); 602 network_delegate->NeverThrottleRequests();
586 #endif 603 #endif
587 604
588 globals_->system_network_delegate.reset(network_delegate); 605 globals_->system_network_delegate.reset(network_delegate);
589 globals_->host_resolver = CreateGlobalHostResolver(net_log_); 606 globals_->host_resolver = CreateGlobalHostResolver(net_log_);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 ct_verifier->AddLog(external_log_verifier.Pass()); 649 ct_verifier->AddLog(external_log_verifier.Pass());
633 } 650 }
634 } 651 }
635 #else 652 #else
636 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 653 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
637 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 654 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
638 "builds using OpenSSL."; 655 "builds using OpenSSL.";
639 } 656 }
640 #endif 657 #endif
641 globals_->ssl_config_service = GetSSLConfigService(); 658 globals_->ssl_config_service = GetSSLConfigService();
642 #if defined(OS_ANDROID) || defined(OS_IOS)
643 #if defined(SPDY_PROXY_AUTH_ORIGIN)
644 int drp_flags = DataReductionProxyParams::kFallbackAllowed;
645 if (DataReductionProxyParams::IsIncludedInFieldTrial())
646 drp_flags |= DataReductionProxyParams::kAllowed;
647 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
648 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
649 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
650 drp_flags |= DataReductionProxyParams::kPromoAllowed;
651 DataReductionProxyParams* proxy_params =
652 new DataReductionProxyParams(drp_flags);
653 globals_->data_reduction_proxy_params.reset(proxy_params);
654 globals_->data_reduction_proxy_auth_request_handler.reset(
655 new DataReductionProxyAuthRequestHandler(proxy_params));
656 globals_->on_resolve_proxy_handler =
657 ChromeNetworkDelegate::OnResolveProxyHandler(
658 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
659 DataReductionProxyUsageStats* proxy_usage_stats =
660 new DataReductionProxyUsageStats(proxy_params,
661 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
662 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
663 network_delegate->set_data_reduction_proxy_params(proxy_params);
664 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
665 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
666 network_delegate->set_data_reduction_proxy_auth_request_handler(
667 globals_->data_reduction_proxy_auth_request_handler.get());
668 network_delegate->set_on_resolve_proxy_handler(
669 globals_->on_resolve_proxy_handler);
670 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
671 #endif // defined(OS_ANDROID) || defined(OS_IOS)
672 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 659 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
673 globals_->host_resolver.get())); 660 globals_->host_resolver.get()));
674 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 661 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
675 // For the ProxyScriptFetcher, we use a direct ProxyService. 662 // For the ProxyScriptFetcher, we use a direct ProxyService.
676 globals_->proxy_script_fetcher_proxy_service.reset( 663 globals_->proxy_script_fetcher_proxy_service.reset(
677 net::ProxyService::CreateDirectWithNetLog(net_log_)); 664 net::ProxyService::CreateDirectWithNetLog(net_log_));
678 // In-memory cookie store. 665 // In-memory cookie store.
679 globals_->system_cookie_store = 666 globals_->system_cookie_store =
680 content::CreateCookieStore(content::CookieStoreConfig()); 667 content::CreateCookieStore(content::CookieStoreConfig());
681 // In-memory server bound cert store. 668 // In-memory server bound cert store.
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1368 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1382 for (size_t i = 0; i < supported_versions.size(); ++i) { 1369 for (size_t i = 0; i < supported_versions.size(); ++i) {
1383 net::QuicVersion version = supported_versions[i]; 1370 net::QuicVersion version = supported_versions[i];
1384 if (net::QuicVersionToString(version) == quic_version) { 1371 if (net::QuicVersionToString(version) == quic_version) {
1385 return version; 1372 return version;
1386 } 1373 }
1387 } 1374 }
1388 1375
1389 return net::QUIC_VERSION_UNSUPPORTED; 1376 return net::QUIC_VERSION_UNSUPPORTED;
1390 } 1377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698