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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 2546533003: Respect QuicAllowed policy for new streams (Closed)
Patch Set: Formatting in browsertest Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index f5acaf6aa25e5c973a439269282e438a6bb3eeb9..39ca5c46dd998473316b5adcda85e16072c5d63d 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -46,6 +46,7 @@
#include "chrome/browser/policy/policy_helpers.h"
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
+#include "chrome/browser/profiles/net_http_session_params_observer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ssl/chrome_expect_ct_reporter.h"
@@ -470,6 +471,13 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
&allowed_domains_for_apps_,
pref_service);
+ DCHECK(!net_http_session_params_observer_);
+ NetHttpSessionParamsObserver::DisableQuicCallback disable_quic_callback =
+ base::Bind(&ProfileIOData::DisableQuicOnIOThread, base::Unretained(this));
+ net_http_session_params_observer_ =
+ base::MakeUnique<NetHttpSessionParamsObserver>(pref_service,
+ disable_quic_callback);
+
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
@@ -926,6 +934,18 @@ std::unique_ptr<net::ClientCertStore> ProfileIOData::CreateClientCertStore() {
#endif
}
+void ProfileIOData::DisableQuicOnIOThread() {
+ // If the URLRequestContext has not been created yet, it will not be updated
+ // here. Instead, it will inherit its QUIC enablement from IOThread on
+ // construction, which is fine, as NetHttpSessionParamsObserver also disables
+ // QUIC there.
+ if (!main_request_context_storage_ ||
+ !main_request_context_storage_->http_network_session())
+ return;
+
+ main_request_context_storage_->http_network_session()->DisableQuic();
+}
+
void ProfileIOData::set_data_reduction_proxy_io_data(
std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData>
data_reduction_proxy_io_data) const {
@@ -1236,6 +1256,7 @@ void ProfileIOData::ShutdownOnUIThread(
if (chrome_http_user_agent_settings_)
chrome_http_user_agent_settings_->CleanupOnUIThread();
incognito_availibility_pref_.Destroy();
+ net_http_session_params_observer_.reset();
if (!context_getters->empty()) {
if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {

Powered by Google App Engine
This is Rietveld 408576698