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::UpdateNetParamsCallback | |
476 update_net_params_callback = base::Bind( | |
477 &ProfileIOData::UpdateNetParamsOnIOThread, base::Unretained(this)); | |
478 net_http_session_params_observer_ = | |
479 base::MakeUnique<NetHttpSessionParamsObserver>( | |
480 pref_service, update_net_params_callback); | |
mmenke
2017/01/09 16:46:04
I believe this is a bug. We haven't even created
pmarko
2017/01/09 19:53:12
This was very misleading, sorry about that. I've t
| |
481 | |
473 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 482 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
474 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 483 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
475 | 484 |
476 chrome_http_user_agent_settings_.reset( | 485 chrome_http_user_agent_settings_.reset( |
477 new ChromeHttpUserAgentSettings(pref_service)); | 486 new ChromeHttpUserAgentSettings(pref_service)); |
478 | 487 |
479 // These members are used only for sign in, which is not enabled | 488 // These members are used only for sign in, which is not enabled |
480 // in incognito mode. So no need to initialize them. | 489 // in incognito mode. So no need to initialize them. |
481 if (!IsOffTheRecord()) { | 490 if (!IsOffTheRecord()) { |
482 google_services_user_account_id_.Init( | 491 google_services_user_account_id_.Init( |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 #elif defined(OS_ANDROID) | 928 #elif defined(OS_ANDROID) |
920 // Android does not use the ClientCertStore infrastructure. On Android client | 929 // 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 | 930 // cert matching is done by the OS as part of the call to show the cert |
922 // selection dialog. | 931 // selection dialog. |
923 return nullptr; | 932 return nullptr; |
924 #else | 933 #else |
925 #error Unknown platform. | 934 #error Unknown platform. |
926 #endif | 935 #endif |
927 } | 936 } |
928 | 937 |
938 void ProfileIOData::UpdateNetParamsOnIOThread( | |
939 net::HttpNetworkSession::ParamsUpdate params_update) { | |
940 if (!main_request_context_storage_ || | |
941 !main_request_context_storage_->http_network_session()) | |
942 return; | |
943 | |
944 main_request_context_storage_->http_network_session()->UpdateParams( | |
945 params_update); | |
946 } | |
947 | |
929 void ProfileIOData::set_data_reduction_proxy_io_data( | 948 void ProfileIOData::set_data_reduction_proxy_io_data( |
930 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> | 949 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> |
931 data_reduction_proxy_io_data) const { | 950 data_reduction_proxy_io_data) const { |
932 data_reduction_proxy_io_data_ = std::move(data_reduction_proxy_io_data); | 951 data_reduction_proxy_io_data_ = std::move(data_reduction_proxy_io_data); |
933 } | 952 } |
934 | 953 |
935 ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data) | 954 ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data) |
936 : io_data_(io_data), | 955 : io_data_(io_data), |
937 host_resolver_(NULL), | 956 host_resolver_(NULL), |
938 request_context_(NULL) { | 957 request_context_(NULL) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1229 if (media_device_id_salt_.get()) | 1248 if (media_device_id_salt_.get()) |
1230 media_device_id_salt_->ShutdownOnUIThread(); | 1249 media_device_id_salt_->ShutdownOnUIThread(); |
1231 session_startup_pref_.Destroy(); | 1250 session_startup_pref_.Destroy(); |
1232 if (url_blacklist_manager_) | 1251 if (url_blacklist_manager_) |
1233 url_blacklist_manager_->ShutdownOnUIThread(); | 1252 url_blacklist_manager_->ShutdownOnUIThread(); |
1234 if (ct_policy_manager_) | 1253 if (ct_policy_manager_) |
1235 ct_policy_manager_->Shutdown(); | 1254 ct_policy_manager_->Shutdown(); |
1236 if (chrome_http_user_agent_settings_) | 1255 if (chrome_http_user_agent_settings_) |
1237 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 1256 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
1238 incognito_availibility_pref_.Destroy(); | 1257 incognito_availibility_pref_.Destroy(); |
1258 net_http_session_params_observer_.reset(); | |
1239 | 1259 |
1240 if (!context_getters->empty()) { | 1260 if (!context_getters->empty()) { |
1241 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 1261 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
1242 BrowserThread::PostTask( | 1262 BrowserThread::PostTask( |
1243 BrowserThread::IO, FROM_HERE, | 1263 BrowserThread::IO, FROM_HERE, |
1244 base::Bind(&NotifyContextGettersOfShutdownOnIO, | 1264 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
1245 base::Passed(&context_getters))); | 1265 base::Passed(&context_getters))); |
1246 } | 1266 } |
1247 } | 1267 } |
1248 | 1268 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1308 void ProfileIOData::SetCookieSettingsForTesting( | 1328 void ProfileIOData::SetCookieSettingsForTesting( |
1309 content_settings::CookieSettings* cookie_settings) { | 1329 content_settings::CookieSettings* cookie_settings) { |
1310 DCHECK(!cookie_settings_.get()); | 1330 DCHECK(!cookie_settings_.get()); |
1311 cookie_settings_ = cookie_settings; | 1331 cookie_settings_ = cookie_settings; |
1312 } | 1332 } |
1313 | 1333 |
1314 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1334 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1315 const GURL& url) const { | 1335 const GURL& url) const { |
1316 return url_blacklist_manager_->GetURLBlacklistState(url); | 1336 return url_blacklist_manager_->GetURLBlacklistState(url); |
1317 } | 1337 } |
OLD | NEW |