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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 StartTPMSlotInitializationOnIOThread(account_id, username_hash); | 356 StartTPMSlotInitializationOnIOThread(account_id, username_hash); |
358 } else { | 357 } else { |
359 DVLOG(1) << "Waiting for tpm ready ..."; | 358 DVLOG(1) << "Waiting for tpm ready ..."; |
360 } | 359 } |
361 } else { | 360 } else { |
362 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); | 361 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); |
363 } | 362 } |
364 } | 363 } |
365 #endif // defined(OS_CHROMEOS) | 364 #endif // defined(OS_CHROMEOS) |
366 | 365 |
367 #if defined(USE_NSS_CERTS) | |
368 void InitializeAndPassKeygenHandler( | |
369 std::unique_ptr<net::KeygenHandler> keygen_handler, | |
370 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback, | |
371 std::unique_ptr<ChromeNSSCryptoModuleDelegate> delegate) { | |
372 if (delegate) | |
373 keygen_handler->set_crypto_module_delegate(std::move(delegate)); | |
374 callback.Run(std::move(keygen_handler)); | |
375 } | |
376 #endif // defined(USE_NSS_CERTS) | |
377 | |
378 // For safe shutdown, must be called before the ProfileIOData is destroyed. | 366 // For safe shutdown, must be called before the ProfileIOData is destroyed. |
379 void NotifyContextGettersOfShutdownOnIO( | 367 void NotifyContextGettersOfShutdownOnIO( |
380 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> | 368 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> |
381 getters) { | 369 getters) { |
382 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 370 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
383 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; | 371 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; |
384 for (auto& chrome_context_getter : *getters) | 372 for (auto& chrome_context_getter : *getters) |
385 chrome_context_getter->NotifyContextShuttingDown(); | 373 chrome_context_getter->NotifyContextShuttingDown(); |
386 } | 374 } |
387 | 375 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 DCHECK(io_data_->initialized_); | 946 DCHECK(io_data_->initialized_); |
959 return host_resolver_; | 947 return host_resolver_; |
960 } | 948 } |
961 | 949 |
962 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { | 950 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { |
963 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 951 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
964 DCHECK(io_data_->initialized_); | 952 DCHECK(io_data_->initialized_); |
965 return request_context_; | 953 return request_context_; |
966 } | 954 } |
967 | 955 |
968 void ProfileIOData::ResourceContext::CreateKeygenHandler( | |
969 uint32_t key_size_in_bits, | |
970 const std::string& challenge_string, | |
971 const GURL& url, | |
972 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback) { | |
973 DCHECK(!callback.is_null()); | |
974 #if defined(USE_NSS_CERTS) | |
975 std::unique_ptr<net::KeygenHandler> keygen_handler( | |
976 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | |
977 | |
978 base::Callback<void(std::unique_ptr<ChromeNSSCryptoModuleDelegate>)> | |
979 got_delegate_callback = | |
980 base::Bind(&InitializeAndPassKeygenHandler, | |
981 base::Passed(&keygen_handler), callback); | |
982 | |
983 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( | |
984 chrome::kCryptoModulePasswordKeygen, | |
985 net::HostPortPair::FromURL(url), | |
986 this, | |
987 got_delegate_callback); | |
988 #else | |
989 callback.Run(base::MakeUnique<net::KeygenHandler>(key_size_in_bits, | |
990 challenge_string, url)); | |
991 #endif | |
992 } | |
993 | |
994 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { | 956 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { |
995 if (io_data_->HasMediaDeviceIDSalt()) | 957 if (io_data_->HasMediaDeviceIDSalt()) |
996 return io_data_->GetMediaDeviceIDSalt(); | 958 return io_data_->GetMediaDeviceIDSalt(); |
997 | 959 |
998 return content::ResourceContext::GetMediaDeviceIDSalt(); | 960 return content::ResourceContext::GetMediaDeviceIDSalt(); |
999 } | 961 } |
1000 | 962 |
1001 void ProfileIOData::Init( | 963 void ProfileIOData::Init( |
1002 content::ProtocolHandlerMap* protocol_handlers, | 964 content::ProtocolHandlerMap* protocol_handlers, |
1003 content::URLRequestInterceptorScopedVector request_interceptors) const { | 965 content::URLRequestInterceptorScopedVector request_interceptors) const { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 void ProfileIOData::SetCookieSettingsForTesting( | 1310 void ProfileIOData::SetCookieSettingsForTesting( |
1349 content_settings::CookieSettings* cookie_settings) { | 1311 content_settings::CookieSettings* cookie_settings) { |
1350 DCHECK(!cookie_settings_.get()); | 1312 DCHECK(!cookie_settings_.get()); |
1351 cookie_settings_ = cookie_settings; | 1313 cookie_settings_ = cookie_settings; |
1352 } | 1314 } |
1353 | 1315 |
1354 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1316 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1355 const GURL& url) const { | 1317 const GURL& url) const { |
1356 return url_blacklist_manager_->GetURLBlacklistState(url); | 1318 return url_blacklist_manager_->GetURLBlacklistState(url); |
1357 } | 1319 } |
OLD | NEW |