OLD | NEW |
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/profiles/profile_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/media/media_device_id_salt.h" | 39 #include "chrome/browser/media/media_device_id_salt.h" |
40 #include "chrome/browser/net/chrome_http_user_agent_settings.h" | 40 #include "chrome/browser/net/chrome_http_user_agent_settings.h" |
41 #include "chrome/browser/net/chrome_network_delegate.h" | 41 #include "chrome/browser/net/chrome_network_delegate.h" |
42 #include "chrome/browser/net/chrome_url_request_context_getter.h" | 42 #include "chrome/browser/net/chrome_url_request_context_getter.h" |
43 #include "chrome/browser/net/proxy_service_factory.h" | 43 #include "chrome/browser/net/proxy_service_factory.h" |
44 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 44 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
45 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" | 45 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" |
46 #include "chrome/browser/policy/policy_helpers.h" | 46 #include "chrome/browser/policy/policy_helpers.h" |
47 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 47 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
48 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 48 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 49 #include "chrome/browser/profiles/net_http_session_params_observer.h" |
49 #include "chrome/browser/profiles/profile.h" | 50 #include "chrome/browser/profiles/profile.h" |
50 #include "chrome/browser/profiles/profile_manager.h" | 51 #include "chrome/browser/profiles/profile_manager.h" |
51 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" | 52 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" |
52 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 53 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
53 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 54 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
54 #include "chrome/common/chrome_paths.h" | 55 #include "chrome/common/chrome_paths.h" |
55 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/common/features.h" | 57 #include "chrome/common/features.h" |
57 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
58 #include "chrome/common/url_constants.h" | 59 #include "chrome/common/url_constants.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 profile_params_ = std::move(params); | 464 profile_params_ = std::move(params); |
464 | 465 |
465 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 466 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
466 &enable_referrers_, | 467 &enable_referrers_, |
467 &enable_do_not_track_, | 468 &enable_do_not_track_, |
468 &force_google_safesearch_, | 469 &force_google_safesearch_, |
469 &force_youtube_restrict_, | 470 &force_youtube_restrict_, |
470 &allowed_domains_for_apps_, | 471 &allowed_domains_for_apps_, |
471 pref_service); | 472 pref_service); |
472 | 473 |
| 474 DCHECK(!net_http_session_params_observer_); |
| 475 NetHttpSessionParamsObserver::DisableQuicCallback disable_quic_callback = |
| 476 base::Bind(&ProfileIOData::DisableQuicOnIOThread, base::Unretained(this)); |
| 477 net_http_session_params_observer_ = |
| 478 base::MakeUnique<NetHttpSessionParamsObserver>(pref_service, |
| 479 disable_quic_callback); |
| 480 |
473 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 481 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
474 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 482 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
475 | 483 |
476 chrome_http_user_agent_settings_.reset( | 484 chrome_http_user_agent_settings_.reset( |
477 new ChromeHttpUserAgentSettings(pref_service)); | 485 new ChromeHttpUserAgentSettings(pref_service)); |
478 | 486 |
479 // These members are used only for sign in, which is not enabled | 487 // These members are used only for sign in, which is not enabled |
480 // in incognito mode. So no need to initialize them. | 488 // in incognito mode. So no need to initialize them. |
481 if (!IsOffTheRecord()) { | 489 if (!IsOffTheRecord()) { |
482 google_services_user_account_id_.Init( | 490 google_services_user_account_id_.Init( |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 #elif defined(OS_ANDROID) | 927 #elif defined(OS_ANDROID) |
920 // Android does not use the ClientCertStore infrastructure. On Android client | 928 // Android does not use the ClientCertStore infrastructure. On Android client |
921 // cert matching is done by the OS as part of the call to show the cert | 929 // cert matching is done by the OS as part of the call to show the cert |
922 // selection dialog. | 930 // selection dialog. |
923 return nullptr; | 931 return nullptr; |
924 #else | 932 #else |
925 #error Unknown platform. | 933 #error Unknown platform. |
926 #endif | 934 #endif |
927 } | 935 } |
928 | 936 |
| 937 void ProfileIOData::DisableQuicOnIOThread() { |
| 938 // If the URLRequestContext has not been created yet, it will not be updated |
| 939 // here. Instead, it will inherit its QUIC enablement from IOThread on |
| 940 // construction, which is fine, as NetHttpSessionParamsObserver also disables |
| 941 // QUIC there. |
| 942 if (!main_request_context_storage_ || |
| 943 !main_request_context_storage_->http_network_session()) |
| 944 return; |
| 945 |
| 946 main_request_context_storage_->http_network_session()->DisableQuic(); |
| 947 } |
| 948 |
929 void ProfileIOData::set_data_reduction_proxy_io_data( | 949 void ProfileIOData::set_data_reduction_proxy_io_data( |
930 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> | 950 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> |
931 data_reduction_proxy_io_data) const { | 951 data_reduction_proxy_io_data) const { |
932 data_reduction_proxy_io_data_ = std::move(data_reduction_proxy_io_data); | 952 data_reduction_proxy_io_data_ = std::move(data_reduction_proxy_io_data); |
933 } | 953 } |
934 | 954 |
935 ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data) | 955 ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data) |
936 : io_data_(io_data), | 956 : io_data_(io_data), |
937 host_resolver_(NULL), | 957 host_resolver_(NULL), |
938 request_context_(NULL) { | 958 request_context_(NULL) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 if (media_device_id_salt_.get()) | 1249 if (media_device_id_salt_.get()) |
1230 media_device_id_salt_->ShutdownOnUIThread(); | 1250 media_device_id_salt_->ShutdownOnUIThread(); |
1231 session_startup_pref_.Destroy(); | 1251 session_startup_pref_.Destroy(); |
1232 if (url_blacklist_manager_) | 1252 if (url_blacklist_manager_) |
1233 url_blacklist_manager_->ShutdownOnUIThread(); | 1253 url_blacklist_manager_->ShutdownOnUIThread(); |
1234 if (ct_policy_manager_) | 1254 if (ct_policy_manager_) |
1235 ct_policy_manager_->Shutdown(); | 1255 ct_policy_manager_->Shutdown(); |
1236 if (chrome_http_user_agent_settings_) | 1256 if (chrome_http_user_agent_settings_) |
1237 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 1257 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
1238 incognito_availibility_pref_.Destroy(); | 1258 incognito_availibility_pref_.Destroy(); |
| 1259 net_http_session_params_observer_.reset(); |
1239 | 1260 |
1240 if (!context_getters->empty()) { | 1261 if (!context_getters->empty()) { |
1241 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 1262 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
1242 BrowserThread::PostTask( | 1263 BrowserThread::PostTask( |
1243 BrowserThread::IO, FROM_HERE, | 1264 BrowserThread::IO, FROM_HERE, |
1244 base::Bind(&NotifyContextGettersOfShutdownOnIO, | 1265 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
1245 base::Passed(&context_getters))); | 1266 base::Passed(&context_getters))); |
1246 } | 1267 } |
1247 } | 1268 } |
1248 | 1269 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 void ProfileIOData::SetCookieSettingsForTesting( | 1329 void ProfileIOData::SetCookieSettingsForTesting( |
1309 content_settings::CookieSettings* cookie_settings) { | 1330 content_settings::CookieSettings* cookie_settings) { |
1310 DCHECK(!cookie_settings_.get()); | 1331 DCHECK(!cookie_settings_.get()); |
1311 cookie_settings_ = cookie_settings; | 1332 cookie_settings_ = cookie_settings; |
1312 } | 1333 } |
1313 | 1334 |
1314 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1335 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1315 const GURL& url) const { | 1336 const GURL& url) const { |
1316 return url_blacklist_manager_->GetURLBlacklistState(url); | 1337 return url_blacklist_manager_->GetURLBlacklistState(url); |
1317 } | 1338 } |
OLD | NEW |