| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "components/prefs/pref_service.h" | 75 #include "components/prefs/pref_service.h" |
| 76 #include "components/signin/core/common/signin_pref_names.h" | 76 #include "components/signin/core/common/signin_pref_names.h" |
| 77 #include "components/sync/base/pref_names.h" | 77 #include "components/sync/base/pref_names.h" |
| 78 #include "components/url_formatter/url_fixer.h" | 78 #include "components/url_formatter/url_fixer.h" |
| 79 #include "content/public/browser/browser_thread.h" | 79 #include "content/public/browser/browser_thread.h" |
| 80 #include "content/public/browser/host_zoom_map.h" | 80 #include "content/public/browser/host_zoom_map.h" |
| 81 #include "content/public/browser/notification_service.h" | 81 #include "content/public/browser/notification_service.h" |
| 82 #include "content/public/browser/resource_context.h" | 82 #include "content/public/browser/resource_context.h" |
| 83 #include "content/public/common/content_switches.h" | 83 #include "content/public/common/content_switches.h" |
| 84 #include "extensions/features/features.h" | 84 #include "extensions/features/features.h" |
| 85 #include "net/base/keygen_handler.h" | |
| 86 #include "net/cert/cert_verifier.h" | 85 #include "net/cert/cert_verifier.h" |
| 87 #include "net/cert/ct_log_verifier.h" | 86 #include "net/cert/ct_log_verifier.h" |
| 88 #include "net/cert/multi_log_ct_verifier.h" | 87 #include "net/cert/multi_log_ct_verifier.h" |
| 89 #include "net/cookies/canonical_cookie.h" | 88 #include "net/cookies/canonical_cookie.h" |
| 90 #include "net/http/http_network_session.h" | 89 #include "net/http/http_network_session.h" |
| 91 #include "net/http/http_transaction_factory.h" | 90 #include "net/http/http_transaction_factory.h" |
| 92 #include "net/http/http_util.h" | 91 #include "net/http/http_util.h" |
| 93 #include "net/http/transport_security_persister.h" | 92 #include "net/http/transport_security_persister.h" |
| 94 #include "net/net_features.h" | 93 #include "net/net_features.h" |
| 95 #include "net/nqe/network_quality_estimator.h" | 94 #include "net/nqe/network_quality_estimator.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 StartTPMSlotInitializationOnIOThread(account_id, username_hash); | 357 StartTPMSlotInitializationOnIOThread(account_id, username_hash); |
| 359 } else { | 358 } else { |
| 360 DVLOG(1) << "Waiting for tpm ready ..."; | 359 DVLOG(1) << "Waiting for tpm ready ..."; |
| 361 } | 360 } |
| 362 } else { | 361 } else { |
| 363 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); | 362 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); |
| 364 } | 363 } |
| 365 } | 364 } |
| 366 #endif // defined(OS_CHROMEOS) | 365 #endif // defined(OS_CHROMEOS) |
| 367 | 366 |
| 368 #if defined(USE_NSS_CERTS) | |
| 369 void InitializeAndPassKeygenHandler( | |
| 370 std::unique_ptr<net::KeygenHandler> keygen_handler, | |
| 371 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback, | |
| 372 std::unique_ptr<ChromeNSSCryptoModuleDelegate> delegate) { | |
| 373 if (delegate) | |
| 374 keygen_handler->set_crypto_module_delegate(std::move(delegate)); | |
| 375 callback.Run(std::move(keygen_handler)); | |
| 376 } | |
| 377 #endif // defined(USE_NSS_CERTS) | |
| 378 | |
| 379 // For safe shutdown, must be called before the ProfileIOData is destroyed. | 367 // For safe shutdown, must be called before the ProfileIOData is destroyed. |
| 380 void NotifyContextGettersOfShutdownOnIO( | 368 void NotifyContextGettersOfShutdownOnIO( |
| 381 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> | 369 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> |
| 382 getters) { | 370 getters) { |
| 383 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 371 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 384 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; | 372 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; |
| 385 for (auto& chrome_context_getter : *getters) | 373 for (auto& chrome_context_getter : *getters) |
| 386 chrome_context_getter->NotifyContextShuttingDown(); | 374 chrome_context_getter->NotifyContextShuttingDown(); |
| 387 } | 375 } |
| 388 | 376 |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 DCHECK(io_data_->initialized_); | 948 DCHECK(io_data_->initialized_); |
| 961 return host_resolver_; | 949 return host_resolver_; |
| 962 } | 950 } |
| 963 | 951 |
| 964 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { | 952 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { |
| 965 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 953 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 966 DCHECK(io_data_->initialized_); | 954 DCHECK(io_data_->initialized_); |
| 967 return request_context_; | 955 return request_context_; |
| 968 } | 956 } |
| 969 | 957 |
| 970 void ProfileIOData::ResourceContext::CreateKeygenHandler( | |
| 971 uint32_t key_size_in_bits, | |
| 972 const std::string& challenge_string, | |
| 973 const GURL& url, | |
| 974 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback) { | |
| 975 DCHECK(!callback.is_null()); | |
| 976 #if defined(USE_NSS_CERTS) | |
| 977 std::unique_ptr<net::KeygenHandler> keygen_handler( | |
| 978 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | |
| 979 | |
| 980 base::Callback<void(std::unique_ptr<ChromeNSSCryptoModuleDelegate>)> | |
| 981 got_delegate_callback = | |
| 982 base::Bind(&InitializeAndPassKeygenHandler, | |
| 983 base::Passed(&keygen_handler), callback); | |
| 984 | |
| 985 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( | |
| 986 chrome::kCryptoModulePasswordKeygen, | |
| 987 net::HostPortPair::FromURL(url), | |
| 988 this, | |
| 989 got_delegate_callback); | |
| 990 #else | |
| 991 callback.Run(base::MakeUnique<net::KeygenHandler>(key_size_in_bits, | |
| 992 challenge_string, url)); | |
| 993 #endif | |
| 994 } | |
| 995 | |
| 996 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { | 958 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { |
| 997 if (io_data_->HasMediaDeviceIDSalt()) | 959 if (io_data_->HasMediaDeviceIDSalt()) |
| 998 return io_data_->GetMediaDeviceIDSalt(); | 960 return io_data_->GetMediaDeviceIDSalt(); |
| 999 | 961 |
| 1000 return content::ResourceContext::GetMediaDeviceIDSalt(); | 962 return content::ResourceContext::GetMediaDeviceIDSalt(); |
| 1001 } | 963 } |
| 1002 | 964 |
| 1003 void ProfileIOData::Init( | 965 void ProfileIOData::Init( |
| 1004 content::ProtocolHandlerMap* protocol_handlers, | 966 content::ProtocolHandlerMap* protocol_handlers, |
| 1005 content::URLRequestInterceptorScopedVector request_interceptors) const { | 967 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 void ProfileIOData::SetCookieSettingsForTesting( | 1316 void ProfileIOData::SetCookieSettingsForTesting( |
| 1355 content_settings::CookieSettings* cookie_settings) { | 1317 content_settings::CookieSettings* cookie_settings) { |
| 1356 DCHECK(!cookie_settings_.get()); | 1318 DCHECK(!cookie_settings_.get()); |
| 1357 cookie_settings_ = cookie_settings; | 1319 cookie_settings_ = cookie_settings; |
| 1358 } | 1320 } |
| 1359 | 1321 |
| 1360 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1322 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
| 1361 const GURL& url) const { | 1323 const GURL& url) const { |
| 1362 return url_blacklist_manager_->GetURLBlacklistState(url); | 1324 return url_blacklist_manager_->GetURLBlacklistState(url); |
| 1363 } | 1325 } |
| OLD | NEW |