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

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: Added suggestion from sgurun 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 #if !defined(USE_OPENSSL) 89 #if !defined(USE_OPENSSL)
90 #include "net/cert/ct_log_verifier.h" 90 #include "net/cert/ct_log_verifier.h"
91 #include "net/cert/multi_log_ct_verifier.h" 91 #include "net/cert/multi_log_ct_verifier.h"
92 #endif 92 #endif
93 93
94 #if defined(USE_NSS) || defined(OS_IOS) 94 #if defined(USE_NSS) || defined(OS_IOS)
95 #include "net/ocsp/nss_ocsp.h" 95 #include "net/ocsp/nss_ocsp.h"
96 #endif 96 #endif
97 97
98 #if defined(OS_ANDROID) || defined(OS_IOS) 98 #if defined(SPDY_PROXY_AUTH_ORIGIN)
99 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
100 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
99 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
100 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 102 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
102 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 103 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
103 #endif
104 104
105 #if defined(OS_CHROMEOS) 105 #if defined(OS_CHROMEOS)
106 #include "chrome/browser/chromeos/login/users/user_manager.h" 106 #include "chrome/browser/chromeos/login/users/user_manager.h"
107 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 107 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
108 #include "chromeos/network/host_resolver_impl_chromeos.h" 108 #include "chromeos/network/host_resolver_impl_chromeos.h"
109 #endif 109 #endif
110 110
111 using content::BrowserThread; 111 using content::BrowserThread;
112 112
113 #if defined(OS_ANDROID) || defined(OS_IOS)
114 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
115 using data_reduction_proxy::DataReductionProxyParams;
116 using data_reduction_proxy::DataReductionProxyUsageStats;
117 using data_reduction_proxy::DataReductionProxySettings;
118 #endif
119
120 class SafeBrowsingURLRequestContext; 113 class SafeBrowsingURLRequestContext;
121 114
122 // The IOThread object must outlive any tasks posted to the IO thread before the 115 // The IOThread object must outlive any tasks posted to the IO thread before the
123 // Quit task, so base::Bind() calls are not refcounted. 116 // Quit task, so base::Bind() calls are not refcounted.
124 117
125 namespace { 118 namespace {
126 119
127 const char kQuicFieldTrialName[] = "QUIC"; 120 const char kQuicFieldTrialName[] = "QUIC";
128 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 121 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
129 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 122 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 ct_verifier->AddLog(external_log_verifier.Pass()); 626 ct_verifier->AddLog(external_log_verifier.Pass());
634 } 627 }
635 } 628 }
636 #else 629 #else
637 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 630 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
638 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 631 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
639 "builds using OpenSSL."; 632 "builds using OpenSSL.";
640 } 633 }
641 #endif 634 #endif
642 globals_->ssl_config_service = GetSSLConfigService(); 635 globals_->ssl_config_service = GetSSLConfigService();
643 #if defined(OS_ANDROID) || defined(OS_IOS) 636
644 #if defined(SPDY_PROXY_AUTH_ORIGIN) 637 #if defined(SPDY_PROXY_AUTH_ORIGIN)
645 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 638 int drp_flags = 0;
646 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 639 if (data_reduction_proxy::DataReductionProxyParams::
647 drp_flags |= DataReductionProxyParams::kAllowed; 640 IsIncludedInFieldTrial()) {
648 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 641 drp_flags |=
649 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 642 (data_reduction_proxy::DataReductionProxyParams::kAllowed |
650 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 643 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed);
651 drp_flags |= DataReductionProxyParams::kPromoAllowed; 644 }
652 DataReductionProxyParams* proxy_params = 645 if (data_reduction_proxy::DataReductionProxyParams::
653 new DataReductionProxyParams(drp_flags); 646 IsIncludedInAlternativeFieldTrial()) {
654 globals_->data_reduction_proxy_params.reset(proxy_params); 647 drp_flags |=
648 data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
649 }
650 if (data_reduction_proxy::DataReductionProxyParams::
651 IsIncludedInPromoFieldTrial())
652 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
653 if (data_reduction_proxy::DataReductionProxyParams::
654 IsIncludedInHoldbackFieldTrial())
655 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
656 globals_->data_reduction_proxy_params.reset(
657 new data_reduction_proxy::DataReductionProxyParams(drp_flags));
655 globals_->data_reduction_proxy_auth_request_handler.reset( 658 globals_->data_reduction_proxy_auth_request_handler.reset(
656 new DataReductionProxyAuthRequestHandler(proxy_params)); 659 new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
657 globals_->on_resolve_proxy_handler = 660 globals_->data_reduction_proxy_params.get(),
658 ChromeNetworkDelegate::OnResolveProxyHandler( 661 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
659 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 662 // This is the same as in ProfileImplIOData except that we do not collect
660 DataReductionProxyUsageStats* proxy_usage_stats = 663 // usage stats.
661 new DataReductionProxyUsageStats(proxy_params, 664 network_delegate->set_data_reduction_proxy_params(
662 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 665 globals_->data_reduction_proxy_params.get());
663 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
664 network_delegate->set_data_reduction_proxy_params(proxy_params);
665 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
666 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
667 network_delegate->set_data_reduction_proxy_auth_request_handler( 666 network_delegate->set_data_reduction_proxy_auth_request_handler(
668 globals_->data_reduction_proxy_auth_request_handler.get()); 667 globals_->data_reduction_proxy_auth_request_handler.get());
669 network_delegate->set_on_resolve_proxy_handler( 668 network_delegate->set_on_resolve_proxy_handler(
670 globals_->on_resolve_proxy_handler); 669 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
671 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 670 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
672 #endif // defined(OS_ANDROID) || defined(OS_IOS) 671
673 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 672 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
674 globals_->host_resolver.get())); 673 globals_->host_resolver.get()));
675 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 674 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
676 // For the ProxyScriptFetcher, we use a direct ProxyService. 675 // For the ProxyScriptFetcher, we use a direct ProxyService.
677 globals_->proxy_script_fetcher_proxy_service.reset( 676 globals_->proxy_script_fetcher_proxy_service.reset(
678 net::ProxyService::CreateDirectWithNetLog(net_log_)); 677 net::ProxyService::CreateDirectWithNetLog(net_log_));
679 // In-memory cookie store. 678 // In-memory cookie store.
680 globals_->system_cookie_store = 679 globals_->system_cookie_store =
681 content::CreateCookieStore(content::CookieStoreConfig()); 680 content::CreateCookieStore(content::CookieStoreConfig());
682 // In-memory channel ID store. 681 // In-memory channel ID store.
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1381 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1383 for (size_t i = 0; i < supported_versions.size(); ++i) { 1382 for (size_t i = 0; i < supported_versions.size(); ++i) {
1384 net::QuicVersion version = supported_versions[i]; 1383 net::QuicVersion version = supported_versions[i];
1385 if (net::QuicVersionToString(version) == quic_version) { 1384 if (net::QuicVersionToString(version) == quic_version) {
1386 return version; 1385 return version;
1387 } 1386 }
1388 } 1387 }
1389 1388
1390 return net::QUIC_VERSION_UNSUPPORTED; 1389 return net::QUIC_VERSION_UNSUPPORTED;
1391 } 1390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698