| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 #include "chromeos/tpm/tpm_token_info_getter.h" | 128 #include "chromeos/tpm/tpm_token_info_getter.h" |
| 129 #include "components/user_manager/user.h" | 129 #include "components/user_manager/user.h" |
| 130 #include "components/user_manager/user_manager.h" | 130 #include "components/user_manager/user_manager.h" |
| 131 #include "crypto/nss_util.h" | 131 #include "crypto/nss_util.h" |
| 132 #include "crypto/nss_util_internal.h" | 132 #include "crypto/nss_util_internal.h" |
| 133 #include "net/cert/cert_verifier.h" | 133 #include "net/cert/cert_verifier.h" |
| 134 #include "net/cert/multi_threaded_cert_verifier.h" | 134 #include "net/cert/multi_threaded_cert_verifier.h" |
| 135 #include "net/ssl/client_cert_store_chromeos.h" | 135 #include "net/ssl/client_cert_store_chromeos.h" |
| 136 #endif // defined(OS_CHROMEOS) | 136 #endif // defined(OS_CHROMEOS) |
| 137 | 137 |
| 138 #if defined(USE_NSS) | 138 #if defined(USE_NSS_CERTS) |
| 139 #include "chrome/browser/ui/crypto_module_delegate_nss.h" | 139 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
| 140 #include "net/ssl/client_cert_store_nss.h" | 140 #include "net/ssl/client_cert_store_nss.h" |
| 141 #endif | 141 #endif |
| 142 | 142 |
| 143 #if defined(OS_WIN) | 143 #if defined(OS_WIN) |
| 144 #include "net/ssl/client_cert_store_win.h" | 144 #include "net/ssl/client_cert_store_win.h" |
| 145 #endif | 145 #endif |
| 146 | 146 |
| 147 #if defined(OS_MACOSX) | 147 #if defined(OS_MACOSX) |
| 148 #include "net/ssl/client_cert_store_mac.h" | 148 #include "net/ssl/client_cert_store_mac.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 StartTPMSlotInitializationOnIOThread(username, username_hash); | 334 StartTPMSlotInitializationOnIOThread(username, username_hash); |
| 335 } else { | 335 } else { |
| 336 DVLOG(1) << "Waiting for tpm ready ..."; | 336 DVLOG(1) << "Waiting for tpm ready ..."; |
| 337 } | 337 } |
| 338 } else { | 338 } else { |
| 339 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); | 339 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 #endif // defined(OS_CHROMEOS) | 342 #endif // defined(OS_CHROMEOS) |
| 343 | 343 |
| 344 #if defined(USE_NSS) | 344 #if defined(USE_NSS_CERTS) |
| 345 void InitializeAndPassKeygenHandler( | 345 void InitializeAndPassKeygenHandler( |
| 346 scoped_ptr<net::KeygenHandler> keygen_handler, | 346 scoped_ptr<net::KeygenHandler> keygen_handler, |
| 347 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, | 347 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, |
| 348 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { | 348 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { |
| 349 if (delegate) | 349 if (delegate) |
| 350 keygen_handler->set_crypto_module_delegate(delegate.Pass()); | 350 keygen_handler->set_crypto_module_delegate(delegate.Pass()); |
| 351 callback.Run(keygen_handler.Pass()); | 351 callback.Run(keygen_handler.Pass()); |
| 352 } | 352 } |
| 353 #endif // defined(USE_NSS) | 353 #endif // defined(USE_NSS_CERTS) |
| 354 | 354 |
| 355 void InvalidateContextGettersOnIO( | 355 void InvalidateContextGettersOnIO( |
| 356 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { | 356 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { |
| 357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 358 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; | 358 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; |
| 359 for (iter = getters->begin(); iter != getters->end(); ++iter) | 359 for (iter = getters->begin(); iter != getters->end(); ++iter) |
| 360 (*iter)->Invalidate(); | 360 (*iter)->Invalidate(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace | 363 } // namespace |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 scoped_ptr<net::ClientCertStore> | 911 scoped_ptr<net::ClientCertStore> |
| 912 ProfileIOData::ResourceContext::CreateClientCertStore() { | 912 ProfileIOData::ResourceContext::CreateClientCertStore() { |
| 913 if (!io_data_->client_cert_store_factory_.is_null()) | 913 if (!io_data_->client_cert_store_factory_.is_null()) |
| 914 return io_data_->client_cert_store_factory_.Run(); | 914 return io_data_->client_cert_store_factory_.Run(); |
| 915 #if defined(OS_CHROMEOS) | 915 #if defined(OS_CHROMEOS) |
| 916 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( | 916 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( |
| 917 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( | 917 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( |
| 918 io_data_->use_system_key_slot(), io_data_->username_hash())), | 918 io_data_->use_system_key_slot(), io_data_->username_hash())), |
| 919 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 919 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
| 920 chrome::kCryptoModulePasswordClientAuth))); | 920 chrome::kCryptoModulePasswordClientAuth))); |
| 921 #elif defined(USE_NSS) | 921 #elif defined(USE_NSS_CERTS) |
| 922 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( | 922 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( |
| 923 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 923 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
| 924 chrome::kCryptoModulePasswordClientAuth))); | 924 chrome::kCryptoModulePasswordClientAuth))); |
| 925 #elif defined(OS_WIN) | 925 #elif defined(OS_WIN) |
| 926 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); | 926 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); |
| 927 #elif defined(OS_MACOSX) | 927 #elif defined(OS_MACOSX) |
| 928 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); | 928 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); |
| 929 #elif defined(USE_OPENSSL) | 929 #elif defined(USE_OPENSSL) |
| 930 // OpenSSL does not use the ClientCertStore infrastructure. On Android client | 930 // OpenSSL does not use the ClientCertStore infrastructure. On Android client |
| 931 // cert matching is done by the OS as part of the call to show the cert | 931 // cert matching is done by the OS as part of the call to show the cert |
| 932 // selection dialog. | 932 // selection dialog. |
| 933 return scoped_ptr<net::ClientCertStore>(); | 933 return scoped_ptr<net::ClientCertStore>(); |
| 934 #else | 934 #else |
| 935 #error Unknown platform. | 935 #error Unknown platform. |
| 936 #endif | 936 #endif |
| 937 } | 937 } |
| 938 | 938 |
| 939 void ProfileIOData::ResourceContext::CreateKeygenHandler( | 939 void ProfileIOData::ResourceContext::CreateKeygenHandler( |
| 940 uint32 key_size_in_bits, | 940 uint32 key_size_in_bits, |
| 941 const std::string& challenge_string, | 941 const std::string& challenge_string, |
| 942 const GURL& url, | 942 const GURL& url, |
| 943 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { | 943 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { |
| 944 DCHECK(!callback.is_null()); | 944 DCHECK(!callback.is_null()); |
| 945 #if defined(USE_NSS) | 945 #if defined(USE_NSS_CERTS) |
| 946 scoped_ptr<net::KeygenHandler> keygen_handler( | 946 scoped_ptr<net::KeygenHandler> keygen_handler( |
| 947 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | 947 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); |
| 948 | 948 |
| 949 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> | 949 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> |
| 950 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, | 950 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, |
| 951 base::Passed(&keygen_handler), | 951 base::Passed(&keygen_handler), |
| 952 callback); | 952 callback); |
| 953 | 953 |
| 954 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( | 954 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( |
| 955 chrome::kCryptoModulePasswordKeygen, | 955 chrome::kCryptoModulePasswordKeygen, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 void ProfileIOData::SetCookieSettingsForTesting( | 1297 void ProfileIOData::SetCookieSettingsForTesting( |
| 1298 CookieSettings* cookie_settings) { | 1298 CookieSettings* cookie_settings) { |
| 1299 DCHECK(!cookie_settings_.get()); | 1299 DCHECK(!cookie_settings_.get()); |
| 1300 cookie_settings_ = cookie_settings; | 1300 cookie_settings_ = cookie_settings; |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 void ProfileIOData::set_signin_names_for_testing( | 1303 void ProfileIOData::set_signin_names_for_testing( |
| 1304 SigninNamesOnIOThread* signin_names) { | 1304 SigninNamesOnIOThread* signin_names) { |
| 1305 signin_names_.reset(signin_names); | 1305 signin_names_.reset(signin_names); |
| 1306 } | 1306 } |
| OLD | NEW |