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

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: nit Created 6 years, 4 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 #if !defined(USE_OPENSSL) 90 #if !defined(USE_OPENSSL)
91 #include "net/cert/ct_log_verifier.h" 91 #include "net/cert/ct_log_verifier.h"
92 #include "net/cert/multi_log_ct_verifier.h" 92 #include "net/cert/multi_log_ct_verifier.h"
93 #endif 93 #endif
94 94
95 #if defined(USE_NSS) || defined(OS_IOS) 95 #if defined(USE_NSS) || defined(OS_IOS)
96 #include "net/ocsp/nss_ocsp.h" 96 #include "net/ocsp/nss_ocsp.h"
97 #endif 97 #endif
98 98
99 #if defined(OS_ANDROID) || defined(OS_IOS) 99 #if defined(SPDY_PROXY_AUTH_ORIGIN)
100 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
101 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
100 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 102 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
102 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 103 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
103 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 104 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
104 #endif
105 105
106 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
107 #include "chrome/browser/chromeos/login/users/user_manager.h" 107 #include "chrome/browser/chromeos/login/users/user_manager.h"
108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
109 #include "chromeos/network/host_resolver_impl_chromeos.h" 109 #include "chromeos/network/host_resolver_impl_chromeos.h"
110 #endif 110 #endif
111 111
112 using content::BrowserThread; 112 using content::BrowserThread;
113 113
114 #if defined(OS_ANDROID) || defined(OS_IOS)
115 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
116 using data_reduction_proxy::DataReductionProxyParams;
117 using data_reduction_proxy::DataReductionProxyUsageStats;
118 using data_reduction_proxy::DataReductionProxySettings;
119 #endif
120
121 class SafeBrowsingURLRequestContext; 114 class SafeBrowsingURLRequestContext;
122 115
123 // 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
124 // Quit task, so base::Bind() calls are not refcounted. 117 // Quit task, so base::Bind() calls are not refcounted.
125 118
126 namespace { 119 namespace {
127 120
128 const char kQuicFieldTrialName[] = "QUIC"; 121 const char kQuicFieldTrialName[] = "QUIC";
129 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 122 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
130 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 123 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 ct_verifier->AddLog(external_log_verifier.Pass()); 628 ct_verifier->AddLog(external_log_verifier.Pass());
636 } 629 }
637 } 630 }
638 #else 631 #else
639 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 632 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
640 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 633 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
641 "builds using OpenSSL."; 634 "builds using OpenSSL.";
642 } 635 }
643 #endif 636 #endif
644 globals_->ssl_config_service = GetSSLConfigService(); 637 globals_->ssl_config_service = GetSSLConfigService();
645 #if defined(OS_ANDROID) || defined(OS_IOS) 638
646 #if defined(SPDY_PROXY_AUTH_ORIGIN) 639 #if defined(SPDY_PROXY_AUTH_ORIGIN)
647 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 640 int drp_flags = 0;
648 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 641 if (data_reduction_proxy::DataReductionProxyParams::
649 drp_flags |= DataReductionProxyParams::kAllowed; 642 IsIncludedInFieldTrial()) {
650 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 643 drp_flags |=
651 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 644 (data_reduction_proxy::DataReductionProxyParams::kAllowed |
652 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 645 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed);
653 drp_flags |= DataReductionProxyParams::kPromoAllowed; 646 }
654 DataReductionProxyParams* proxy_params = 647 if (data_reduction_proxy::DataReductionProxyParams::
655 new DataReductionProxyParams(drp_flags); 648 IsIncludedInAlternativeFieldTrial()) {
656 globals_->data_reduction_proxy_params.reset(proxy_params); 649 drp_flags |=
650 data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
651 }
652 if (data_reduction_proxy::DataReductionProxyParams::
653 IsIncludedInPromoFieldTrial())
654 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
655 if (data_reduction_proxy::DataReductionProxyParams::
656 IsIncludedInHoldbackFieldTrial())
657 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
658 globals_->data_reduction_proxy_params.reset(
659 new data_reduction_proxy::DataReductionProxyParams(drp_flags));
657 globals_->data_reduction_proxy_auth_request_handler.reset( 660 globals_->data_reduction_proxy_auth_request_handler.reset(
658 new DataReductionProxyAuthRequestHandler( 661 new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
659 DataReductionProxyChromeSettings::GetClient(), 662 DataReductionProxyChromeSettings::GetClient(),
660 DataReductionProxyChromeSettings::GetBuildAndPatchNumber(), 663 DataReductionProxyChromeSettings::GetBuildAndPatchNumber(),
661 proxy_params)); 664 globals_->data_reduction_proxy_params.get(),
662 globals_->on_resolve_proxy_handler = 665 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
663 ChromeNetworkDelegate::OnResolveProxyHandler( 666 // This is the same as in ProfileImplIOData except that we do not collect
664 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 667 // usage stats.
665 DataReductionProxyUsageStats* proxy_usage_stats = 668 network_delegate->set_data_reduction_proxy_params(
666 new DataReductionProxyUsageStats(proxy_params, 669 globals_->data_reduction_proxy_params.get());
667 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
668 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
669 network_delegate->set_data_reduction_proxy_params(proxy_params);
670 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
671 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
672 network_delegate->set_data_reduction_proxy_auth_request_handler( 670 network_delegate->set_data_reduction_proxy_auth_request_handler(
673 globals_->data_reduction_proxy_auth_request_handler.get()); 671 globals_->data_reduction_proxy_auth_request_handler.get());
674 network_delegate->set_on_resolve_proxy_handler( 672 network_delegate->set_on_resolve_proxy_handler(
675 globals_->on_resolve_proxy_handler); 673 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
676 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 674 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
677 #endif // defined(OS_ANDROID) || defined(OS_IOS) 675
678 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 676 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
679 globals_->host_resolver.get())); 677 globals_->host_resolver.get()));
680 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 678 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
681 // For the ProxyScriptFetcher, we use a direct ProxyService. 679 // For the ProxyScriptFetcher, we use a direct ProxyService.
682 globals_->proxy_script_fetcher_proxy_service.reset( 680 globals_->proxy_script_fetcher_proxy_service.reset(
683 net::ProxyService::CreateDirectWithNetLog(net_log_)); 681 net::ProxyService::CreateDirectWithNetLog(net_log_));
684 // In-memory cookie store. 682 // In-memory cookie store.
685 globals_->system_cookie_store = 683 globals_->system_cookie_store =
686 content::CreateCookieStore(content::CookieStoreConfig()); 684 content::CreateCookieStore(content::CookieStoreConfig());
687 // In-memory channel ID store. 685 // In-memory channel ID store.
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1389 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1392 for (size_t i = 0; i < supported_versions.size(); ++i) { 1390 for (size_t i = 0; i < supported_versions.size(); ++i) {
1393 net::QuicVersion version = supported_versions[i]; 1391 net::QuicVersion version = supported_versions[i];
1394 if (net::QuicVersionToString(version) == quic_version) { 1392 if (net::QuicVersionToString(version) == quic_version) {
1395 return version; 1393 return version;
1396 } 1394 }
1397 } 1395 }
1398 1396
1399 return net::QUIC_VERSION_UNSUPPORTED; 1397 return net::QUIC_VERSION_UNSUPPORTED;
1400 } 1398 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698