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

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: Addressed comments from willchan and 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 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 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
102 #endif
103 103
104 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
105 #include "chrome/browser/chromeos/login/users/user_manager.h" 105 #include "chrome/browser/chromeos/login/users/user_manager.h"
106 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 106 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
107 #include "chromeos/network/host_resolver_impl_chromeos.h" 107 #include "chromeos/network/host_resolver_impl_chromeos.h"
108 #endif 108 #endif
109 109
110 using content::BrowserThread; 110 using content::BrowserThread;
111 111
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; 112 class SafeBrowsingURLRequestContext;
120 113
121 // The IOThread object must outlive any tasks posted to the IO thread before the 114 // The IOThread object must outlive any tasks posted to the IO thread before the
122 // Quit task, so base::Bind() calls are not refcounted. 115 // Quit task, so base::Bind() calls are not refcounted.
123 116
124 namespace { 117 namespace {
125 118
126 const char kQuicFieldTrialName[] = "QUIC"; 119 const char kQuicFieldTrialName[] = "QUIC";
127 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 120 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
128 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 121 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 ct_verifier->AddLog(external_log_verifier.Pass()); 625 ct_verifier->AddLog(external_log_verifier.Pass());
633 } 626 }
634 } 627 }
635 #else 628 #else
636 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 629 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
637 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 630 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
638 "builds using OpenSSL."; 631 "builds using OpenSSL.";
639 } 632 }
640 #endif 633 #endif
641 globals_->ssl_config_service = GetSSLConfigService(); 634 globals_->ssl_config_service = GetSSLConfigService();
642 #if defined(OS_ANDROID) || defined(OS_IOS) 635
643 #if defined(SPDY_PROXY_AUTH_ORIGIN) 636 #if defined(SPDY_PROXY_AUTH_ORIGIN)
644 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 637 int drp_flags = 0;
645 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 638 if (data_reduction_proxy::DataReductionProxyParams::
646 drp_flags |= DataReductionProxyParams::kAllowed; 639 IsIncludedInFieldTrial()) {
647 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 640 drp_flags |=
648 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 641 (data_reduction_proxy::DataReductionProxyParams::kAllowed |
649 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 642 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed);
willchan no longer on Chromium 2014/08/04 23:13:46 Is this an intentional behavior change? Specifical
bengr 2014/08/05 02:35:07 This is intentional. I believe this change is firs
willchan no longer on Chromium 2014/08/05 03:03:52 Oh, if it's from a rebase, that's fine. If not, I
650 drp_flags |= DataReductionProxyParams::kPromoAllowed; 643 }
651 DataReductionProxyParams* proxy_params = 644 if (data_reduction_proxy::DataReductionProxyParams::
652 new DataReductionProxyParams(drp_flags); 645 IsIncludedInAlternativeFieldTrial())
willchan no longer on Chromium 2014/08/04 23:13:46 Nit: Now that this is multi-line, please add brace
bengr 2014/08/05 02:35:07 Done.
653 globals_->data_reduction_proxy_params.reset(proxy_params); 646 drp_flags |=
647 data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
648 if (data_reduction_proxy::DataReductionProxyParams::
649 IsIncludedInPromoFieldTrial())
650 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
651 if (data_reduction_proxy::DataReductionProxyParams::
652 IsIncludedInHoldbackFieldTrial())
653 drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
654 globals_->data_reduction_proxy_params.reset(
655 new data_reduction_proxy::DataReductionProxyParams(drp_flags));
654 globals_->data_reduction_proxy_auth_request_handler.reset( 656 globals_->data_reduction_proxy_auth_request_handler.reset(
655 new DataReductionProxyAuthRequestHandler(proxy_params)); 657 new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
656 globals_->on_resolve_proxy_handler = 658 globals_->data_reduction_proxy_params.get(),
657 ChromeNetworkDelegate::OnResolveProxyHandler( 659 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
658 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 660 // This is the same as in ProfileImplIOData except that we do not collect
659 DataReductionProxyUsageStats* proxy_usage_stats = 661 // usage stats.
660 new DataReductionProxyUsageStats(proxy_params, 662 network_delegate->set_data_reduction_proxy_params(
661 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 663 globals_->data_reduction_proxy_params.get());
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( 664 network_delegate->set_data_reduction_proxy_auth_request_handler(
667 globals_->data_reduction_proxy_auth_request_handler.get()); 665 globals_->data_reduction_proxy_auth_request_handler.get());
668 network_delegate->set_on_resolve_proxy_handler( 666 network_delegate->set_on_resolve_proxy_handler(
669 globals_->on_resolve_proxy_handler); 667 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
670 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 668 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
671 #endif // defined(OS_ANDROID) || defined(OS_IOS) 669
672 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 670 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
673 globals_->host_resolver.get())); 671 globals_->host_resolver.get()));
674 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 672 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
675 // For the ProxyScriptFetcher, we use a direct ProxyService. 673 // For the ProxyScriptFetcher, we use a direct ProxyService.
676 globals_->proxy_script_fetcher_proxy_service.reset( 674 globals_->proxy_script_fetcher_proxy_service.reset(
677 net::ProxyService::CreateDirectWithNetLog(net_log_)); 675 net::ProxyService::CreateDirectWithNetLog(net_log_));
678 // In-memory cookie store. 676 // In-memory cookie store.
679 globals_->system_cookie_store = 677 globals_->system_cookie_store =
680 content::CreateCookieStore(content::CookieStoreConfig()); 678 content::CreateCookieStore(content::CookieStoreConfig());
681 // In-memory channel ID store. 679 // In-memory channel ID store.
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1379 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1382 for (size_t i = 0; i < supported_versions.size(); ++i) { 1380 for (size_t i = 0; i < supported_versions.size(); ++i) {
1383 net::QuicVersion version = supported_versions[i]; 1381 net::QuicVersion version = supported_versions[i];
1384 if (net::QuicVersionToString(version) == quic_version) { 1382 if (net::QuicVersionToString(version) == quic_version) {
1385 return version; 1383 return version;
1386 } 1384 }
1387 } 1385 }
1388 1386
1389 return net::QUIC_VERSION_UNSUPPORTED; 1387 return net::QUIC_VERSION_UNSUPPORTED;
1390 } 1388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698