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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 scoped_ptr<net::ClientCertStore> | 912 scoped_ptr<net::ClientCertStore> |
913 ProfileIOData::ResourceContext::CreateClientCertStore() { | 913 ProfileIOData::ResourceContext::CreateClientCertStore() { |
914 if (!io_data_->client_cert_store_factory_.is_null()) | 914 if (!io_data_->client_cert_store_factory_.is_null()) |
915 return io_data_->client_cert_store_factory_.Run(); | 915 return io_data_->client_cert_store_factory_.Run(); |
916 #if defined(OS_CHROMEOS) | 916 #if defined(OS_CHROMEOS) |
917 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( | 917 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( |
918 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( | 918 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( |
919 io_data_->use_system_key_slot(), io_data_->username_hash())), | 919 io_data_->use_system_key_slot(), io_data_->username_hash())), |
920 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 920 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
921 chrome::kCryptoModulePasswordClientAuth))); | 921 chrome::kCryptoModulePasswordClientAuth))); |
922 #elif defined(USE_NSS) | 922 #elif defined(USE_NSS_CERTS) |
923 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( | 923 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( |
924 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 924 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
925 chrome::kCryptoModulePasswordClientAuth))); | 925 chrome::kCryptoModulePasswordClientAuth))); |
926 #elif defined(OS_WIN) | 926 #elif defined(OS_WIN) |
927 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); | 927 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); |
928 #elif defined(OS_MACOSX) | 928 #elif defined(OS_MACOSX) |
929 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); | 929 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); |
930 #elif defined(USE_OPENSSL) | 930 #elif defined(USE_OPENSSL) |
931 // OpenSSL does not use the ClientCertStore infrastructure. On Android client | 931 // OpenSSL does not use the ClientCertStore infrastructure. On Android client |
932 // cert matching is done by the OS as part of the call to show the cert | 932 // cert matching is done by the OS as part of the call to show the cert |
933 // selection dialog. | 933 // selection dialog. |
934 return scoped_ptr<net::ClientCertStore>(); | 934 return scoped_ptr<net::ClientCertStore>(); |
935 #else | 935 #else |
936 #error Unknown platform. | 936 #error Unknown platform. |
937 #endif | 937 #endif |
938 } | 938 } |
939 | 939 |
940 void ProfileIOData::ResourceContext::CreateKeygenHandler( | 940 void ProfileIOData::ResourceContext::CreateKeygenHandler( |
941 uint32 key_size_in_bits, | 941 uint32 key_size_in_bits, |
942 const std::string& challenge_string, | 942 const std::string& challenge_string, |
943 const GURL& url, | 943 const GURL& url, |
944 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { | 944 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { |
945 DCHECK(!callback.is_null()); | 945 DCHECK(!callback.is_null()); |
946 #if defined(USE_NSS) | 946 #if defined(USE_NSS_CERTS) |
947 scoped_ptr<net::KeygenHandler> keygen_handler( | 947 scoped_ptr<net::KeygenHandler> keygen_handler( |
948 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | 948 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); |
949 | 949 |
950 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> | 950 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> |
951 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, | 951 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, |
952 base::Passed(&keygen_handler), | 952 base::Passed(&keygen_handler), |
953 callback); | 953 callback); |
954 | 954 |
955 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( | 955 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( |
956 chrome::kCryptoModulePasswordKeygen, | 956 chrome::kCryptoModulePasswordKeygen, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 void ProfileIOData::SetCookieSettingsForTesting( | 1300 void ProfileIOData::SetCookieSettingsForTesting( |
1301 CookieSettings* cookie_settings) { | 1301 CookieSettings* cookie_settings) { |
1302 DCHECK(!cookie_settings_.get()); | 1302 DCHECK(!cookie_settings_.get()); |
1303 cookie_settings_ = cookie_settings; | 1303 cookie_settings_ = cookie_settings; |
1304 } | 1304 } |
1305 | 1305 |
1306 void ProfileIOData::set_signin_names_for_testing( | 1306 void ProfileIOData::set_signin_names_for_testing( |
1307 SigninNamesOnIOThread* signin_names) { | 1307 SigninNamesOnIOThread* signin_names) { |
1308 signin_names_.reset(signin_names); | 1308 signin_names_.reset(signin_names); |
1309 } | 1309 } |
OLD | NEW |