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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
104 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 104 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
105 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 105 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
106 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" | 106 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" |
107 #endif // defined(OS_ANDROID) | 107 #endif // defined(OS_ANDROID) |
108 | 108 |
109 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
110 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 110 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
111 #include "chrome/browser/chromeos/login/startup_utils.h" | 111 #include "chrome/browser/chromeos/login/startup_utils.h" |
112 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 112 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
113 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
114 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 113 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
115 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" | 114 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
116 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 115 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
117 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 116 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
118 #include "chrome/browser/chromeos/settings/cros_settings.h" | 117 #include "chrome/browser/chromeos/settings/cros_settings.h" |
119 #include "chrome/browser/net/nss_context.h" | 118 #include "chromeos/network/client_cert_store_chromeos.h" |
120 #include "chromeos/dbus/cryptohome_client.h" | |
121 #include "chromeos/dbus/dbus_thread_manager.h" | |
122 #include "chromeos/settings/cros_settings_names.h" | 119 #include "chromeos/settings/cros_settings_names.h" |
123 #include "components/user_manager/user.h" | 120 #include "components/user_manager/user.h" |
124 #include "components/user_manager/user_manager.h" | 121 #include "components/user_manager/user_manager.h" |
125 #include "crypto/nss_util.h" | 122 #include "crypto/nss_util.h" |
126 #include "crypto/nss_util_internal.h" | 123 #include "crypto/nss_util_internal.h" |
127 #include "net/cert/cert_verifier.h" | 124 #include "net/cert/cert_verifier.h" |
128 #include "net/cert/multi_threaded_cert_verifier.h" | 125 #include "net/cert/multi_threaded_cert_verifier.h" |
129 #include "net/ssl/client_cert_store_chromeos.h" | |
130 #endif // defined(OS_CHROMEOS) | 126 #endif // defined(OS_CHROMEOS) |
131 | 127 |
132 #if defined(USE_NSS) | 128 #if defined(USE_NSS) |
| 129 #include "chrome/browser/net/cert_database_service_factory.h" |
133 #include "chrome/browser/ui/crypto_module_delegate_nss.h" | 130 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
| 131 #include "components/cert_database/public/cert_database_service.h" |
| 132 #include "components/cert_database/public/cert_database_service_io_part.h" |
134 #include "net/ssl/client_cert_store_nss.h" | 133 #include "net/ssl/client_cert_store_nss.h" |
135 #endif | 134 #endif |
136 | 135 |
137 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
138 #include "net/ssl/client_cert_store_win.h" | 137 #include "net/ssl/client_cert_store_win.h" |
139 #endif | 138 #endif |
140 | 139 |
141 #if defined(OS_MACOSX) | 140 #if defined(OS_MACOSX) |
142 #include "net/ssl/client_cert_store_mac.h" | 141 #include "net/ssl/client_cert_store_mac.h" |
143 #endif | 142 #endif |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 request, network_delegate, path, | 211 request, network_delegate, path, |
213 content::BrowserThread::GetBlockingPool()-> | 212 content::BrowserThread::GetBlockingPool()-> |
214 GetTaskRunnerWithShutdownBehavior( | 213 GetTaskRunnerWithShutdownBehavior( |
215 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 214 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
216 | 215 |
217 return NULL; | 216 return NULL; |
218 } | 217 } |
219 }; | 218 }; |
220 #endif // defined(DEBUG_DEVTOOLS) | 219 #endif // defined(DEBUG_DEVTOOLS) |
221 | 220 |
222 #if defined(OS_CHROMEOS) | |
223 // The following four functions are responsible for initializing NSS for each | |
224 // profile on ChromeOS, which has a separate NSS database and TPM slot | |
225 // per-profile. | |
226 // | |
227 // Initialization basically follows these steps: | |
228 // 1) Get some info from user_manager::UserManager about the User for this | |
229 // profile. | |
230 // 2) Tell nss_util to initialize the software slot for this profile. | |
231 // 3) Wait for the TPM module to be loaded by nss_util if it isn't already. | |
232 // 4) Ask CryptohomeClient which TPM slot id corresponds to this profile. | |
233 // 5) Tell nss_util to use that slot id on the TPM module. | |
234 // | |
235 // Some of these steps must happen on the UI thread, others must happen on the | |
236 // IO thread: | |
237 // UI thread IO Thread | |
238 // | |
239 // ProfileIOData::InitializeOnUIThread | |
240 // | | |
241 // ProfileHelper::Get()->GetUserByProfile() | |
242 // \---------------------------------------v | |
243 // StartNSSInitOnIOThread | |
244 // | | |
245 // crypto::InitializeNSSForChromeOSUser | |
246 // | | |
247 // crypto::IsTPMTokenReady | |
248 // | | |
249 // StartTPMSlotInitializationOnIOThread | |
250 // v---------------------------------------/ | |
251 // GetTPMInfoForUserOnUIThread | |
252 // | | |
253 // CryptohomeClient::Pkcs11GetTpmTokenInfoForUser | |
254 // | | |
255 // DidGetTPMInfoForUserOnUIThread | |
256 // \---------------------------------------v | |
257 // crypto::InitializeTPMForChromeOSUser | |
258 | |
259 void DidGetTPMInfoForUserOnUIThread(const std::string& username_hash, | |
260 chromeos::DBusMethodCallStatus call_status, | |
261 const std::string& label, | |
262 const std::string& user_pin, | |
263 int slot_id) { | |
264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
265 if (call_status == chromeos::DBUS_METHOD_CALL_FAILURE) { | |
266 NOTREACHED() << "dbus error getting TPM info for " << username_hash; | |
267 return; | |
268 } | |
269 DVLOG(1) << "Got TPM slot for " << username_hash << ": " << slot_id; | |
270 BrowserThread::PostTask( | |
271 BrowserThread::IO, | |
272 FROM_HERE, | |
273 base::Bind( | |
274 &crypto::InitializeTPMForChromeOSUser, username_hash, slot_id)); | |
275 } | |
276 | |
277 void GetTPMInfoForUserOnUIThread(const std::string& username, | |
278 const std::string& username_hash) { | |
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
280 DVLOG(1) << "Getting TPM info from cryptohome for " | |
281 << " " << username << " " << username_hash; | |
282 chromeos::DBusThreadManager::Get() | |
283 ->GetCryptohomeClient() | |
284 ->Pkcs11GetTpmTokenInfoForUser( | |
285 username, | |
286 base::Bind(&DidGetTPMInfoForUserOnUIThread, username_hash)); | |
287 } | |
288 | |
289 void StartTPMSlotInitializationOnIOThread(const std::string& username, | |
290 const std::string& username_hash) { | |
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
292 | |
293 BrowserThread::PostTask( | |
294 BrowserThread::UI, | |
295 FROM_HERE, | |
296 base::Bind(&GetTPMInfoForUserOnUIThread, username, username_hash)); | |
297 } | |
298 | |
299 void StartNSSInitOnIOThread(const std::string& username, | |
300 const std::string& username_hash, | |
301 const base::FilePath& path) { | |
302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
303 DVLOG(1) << "Starting NSS init for username hash:" << username_hash; | |
304 | |
305 // Make sure NSS is initialized for the user. | |
306 crypto::InitializeNSSForChromeOSUser(username_hash, path); | |
307 | |
308 // Check if it's OK to initialize TPM for the user before continuing. This | |
309 // may not be the case if the TPM slot initialization was previously | |
310 // requested for the same user. | |
311 if (!crypto::ShouldInitializeTPMForChromeOSUser(username_hash)) | |
312 return; | |
313 | |
314 crypto::WillInitializeTPMForChromeOSUser(username_hash); | |
315 | |
316 if (crypto::IsTPMTokenEnabledForNSS()) { | |
317 if (crypto::IsTPMTokenReady(base::Bind( | |
318 &StartTPMSlotInitializationOnIOThread, username, username_hash))) { | |
319 StartTPMSlotInitializationOnIOThread(username, username_hash); | |
320 } else { | |
321 DVLOG(1) << "Waiting for tpm ready ..."; | |
322 } | |
323 } else { | |
324 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); | |
325 } | |
326 } | |
327 #endif // defined(OS_CHROMEOS) | |
328 | |
329 void InvalidateContextGettersOnIO( | 221 void InvalidateContextGettersOnIO( |
330 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { | 222 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { |
331 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
332 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; | 224 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; |
333 for (iter = getters->begin(); iter != getters->end(); ++iter) | 225 for (iter = getters->begin(); iter != getters->end(); ++iter) |
334 (*iter)->Invalidate(); | 226 (*iter)->Invalidate(); |
335 } | 227 } |
336 | 228 |
337 } // namespace | 229 } // namespace |
338 | 230 |
(...skipping 29 matching lines...) Expand all Loading... |
368 | 260 |
369 params->proxy_config_service | 261 params->proxy_config_service |
370 .reset(ProxyServiceFactory::CreateProxyConfigService( | 262 .reset(ProxyServiceFactory::CreateProxyConfigService( |
371 profile->GetProxyConfigTracker())); | 263 profile->GetProxyConfigTracker())); |
372 #if defined(ENABLE_MANAGED_USERS) | 264 #if defined(ENABLE_MANAGED_USERS) |
373 SupervisedUserService* supervised_user_service = | 265 SupervisedUserService* supervised_user_service = |
374 SupervisedUserServiceFactory::GetForProfile(profile); | 266 SupervisedUserServiceFactory::GetForProfile(profile); |
375 params->supervised_user_url_filter = | 267 params->supervised_user_url_filter = |
376 supervised_user_service->GetURLFilterForIOThread(); | 268 supervised_user_service->GetURLFilterForIOThread(); |
377 #endif | 269 #endif |
| 270 |
378 #if defined(OS_CHROMEOS) | 271 #if defined(OS_CHROMEOS) |
379 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 272 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
380 if (user_manager) { | 273 if (user_manager) { |
381 user_manager::User* user = | 274 user_manager::User* user = |
382 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 275 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
383 // No need to initialize NSS for users with empty username hash: | |
384 // Getters for a user's NSS slots always return NULL slot if the user's | |
385 // username hash is empty, even when the NSS is not initialized for the | |
386 // user. | |
387 if (user) { | 276 if (user) { |
388 DCHECK(!user->username_hash().empty()); | 277 DCHECK(!user->username_hash().empty()); |
389 params->username_hash = user->username_hash(); | 278 params->username_hash = user->username_hash(); |
390 BrowserThread::PostTask(BrowserThread::IO, | |
391 FROM_HERE, | |
392 base::Bind(&StartNSSInitOnIOThread, | |
393 user->email(), | |
394 user->username_hash(), | |
395 profile->GetPath())); | |
396 | |
397 // Use the device-wide system key slot only if the user is of the same | |
398 // domain as the device is registered to. | |
399 policy::BrowserPolicyConnectorChromeOS* connector = | |
400 g_browser_process->platform_part() | |
401 ->browser_policy_connector_chromeos(); | |
402 params->use_system_key_slot = | |
403 connector->GetUserAffiliation(user->email()) == | |
404 policy::USER_AFFILIATION_MANAGED; | |
405 } | 279 } |
406 } | 280 } |
407 #endif | 281 #endif |
408 | 282 |
409 params->profile = profile; | 283 params->profile = profile; |
410 params->prerender_tracker = g_browser_process->prerender_tracker(); | 284 params->prerender_tracker = g_browser_process->prerender_tracker(); |
411 profile_params_.reset(params.release()); | 285 profile_params_.reset(params.release()); |
412 | 286 |
413 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 287 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
414 &enable_referrers_, | 288 &enable_referrers_, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // TODO(bnc): remove per https://crbug.com/334602. | 341 // TODO(bnc): remove per https://crbug.com/334602. |
468 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, | 342 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, |
469 pref_service); | 343 pref_service); |
470 network_prediction_enabled_.MoveToThread(io_message_loop_proxy); | 344 network_prediction_enabled_.MoveToThread(io_message_loop_proxy); |
471 | 345 |
472 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 346 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
473 pref_service); | 347 pref_service); |
474 | 348 |
475 network_prediction_options_.MoveToThread(io_message_loop_proxy); | 349 network_prediction_options_.MoveToThread(io_message_loop_proxy); |
476 | 350 |
| 351 #if defined(USE_NSS) |
| 352 CertDatabaseService* service = |
| 353 CertDatabaseServiceFactory::GetForBrowserContext(profile); |
| 354 if (service) |
| 355 cert_db_io_ = service->GetIOPart(); |
| 356 #endif |
| 357 |
477 #if defined(OS_CHROMEOS) | 358 #if defined(OS_CHROMEOS) |
478 scoped_ptr<policy::PolicyCertVerifier> verifier = | 359 scoped_ptr<policy::PolicyCertVerifier> verifier = |
479 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 360 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
480 policy_cert_verifier_ = verifier.get(); | 361 policy_cert_verifier_ = verifier.get(); |
481 cert_verifier_ = verifier.Pass(); | 362 cert_verifier_ = verifier.Pass(); |
482 #endif | 363 #endif |
483 // The URLBlacklistManager has to be created on the UI thread to register | 364 // The URLBlacklistManager has to be created on the UI thread to register |
484 // observers of |pref_service|, and it also has to clean up on | 365 // observers of |pref_service|, and it also has to clean up on |
485 // ShutdownOnUIThread to release these observers on the right thread. | 366 // ShutdownOnUIThread to release these observers on the right thread. |
486 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 367 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 job_factory_ = job_factory.Pass(); | 437 job_factory_ = job_factory.Pass(); |
557 set_job_factory(job_factory_.get()); | 438 set_job_factory(job_factory_.get()); |
558 } | 439 } |
559 | 440 |
560 ProfileIOData::AppRequestContext::~AppRequestContext() { | 441 ProfileIOData::AppRequestContext::~AppRequestContext() { |
561 AssertNoURLRequests(); | 442 AssertNoURLRequests(); |
562 } | 443 } |
563 | 444 |
564 ProfileIOData::ProfileParams::ProfileParams() | 445 ProfileIOData::ProfileParams::ProfileParams() |
565 : io_thread(NULL), | 446 : io_thread(NULL), |
566 #if defined(OS_CHROMEOS) | |
567 use_system_key_slot(false), | |
568 #endif | |
569 profile(NULL) { | 447 profile(NULL) { |
570 } | 448 } |
571 | 449 |
572 ProfileIOData::ProfileParams::~ProfileParams() {} | 450 ProfileIOData::ProfileParams::~ProfileParams() {} |
573 | 451 |
574 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) | 452 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) |
575 : initialized_(false), | 453 : initialized_(false), |
576 #if defined(OS_CHROMEOS) | 454 #if defined(OS_CHROMEOS) |
577 policy_cert_verifier_(NULL), | 455 policy_cert_verifier_(NULL), |
578 use_system_key_slot_(false), | |
579 #endif | 456 #endif |
580 resource_context_(new ResourceContext(this)), | 457 resource_context_(new ResourceContext(this)), |
581 initialized_on_UI_thread_(false), | 458 initialized_on_UI_thread_(false), |
582 profile_type_(profile_type) { | 459 profile_type_(profile_type) { |
583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
584 } | 461 } |
585 | 462 |
586 ProfileIOData::~ProfileIOData() { | 463 ProfileIOData::~ProfileIOData() { |
587 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) | 464 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) |
588 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 465 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 770 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
894 DCHECK(io_data_->initialized_); | 771 DCHECK(io_data_->initialized_); |
895 return request_context_; | 772 return request_context_; |
896 } | 773 } |
897 | 774 |
898 scoped_ptr<net::ClientCertStore> | 775 scoped_ptr<net::ClientCertStore> |
899 ProfileIOData::ResourceContext::CreateClientCertStore() { | 776 ProfileIOData::ResourceContext::CreateClientCertStore() { |
900 if (!io_data_->client_cert_store_factory_.is_null()) | 777 if (!io_data_->client_cert_store_factory_.is_null()) |
901 return io_data_->client_cert_store_factory_.Run(); | 778 return io_data_->client_cert_store_factory_.Run(); |
902 #if defined(OS_CHROMEOS) | 779 #if defined(OS_CHROMEOS) |
903 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( | 780 return scoped_ptr<net::ClientCertStore>(new chromeos::ClientCertStoreChromeOS( |
904 io_data_->use_system_key_slot(), | 781 io_data_->cert_db_io_, |
905 io_data_->username_hash(), | |
906 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 782 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
907 chrome::kCryptoModulePasswordClientAuth))); | 783 chrome::kCryptoModulePasswordClientAuth))); |
908 #elif defined(USE_NSS) | 784 #elif defined(USE_NSS) |
909 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( | 785 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( |
910 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 786 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
911 chrome::kCryptoModulePasswordClientAuth))); | 787 chrome::kCryptoModulePasswordClientAuth))); |
912 #elif defined(OS_WIN) | 788 #elif defined(OS_WIN) |
913 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); | 789 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); |
914 #elif defined(OS_MACOSX) | 790 #elif defined(OS_MACOSX) |
915 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); | 791 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); |
(...skipping 19 matching lines...) Expand all Loading... |
935 | 811 |
936 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate( | 812 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate( |
937 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen, | 813 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen, |
938 net::HostPortPair::FromURL(url))); | 814 net::HostPortPair::FromURL(url))); |
939 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get(); | 815 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get(); |
940 keygen_handler->set_crypto_module_delegate( | 816 keygen_handler->set_crypto_module_delegate( |
941 delegate.PassAs<crypto::NSSCryptoModuleDelegate>()); | 817 delegate.PassAs<crypto::NSSCryptoModuleDelegate>()); |
942 | 818 |
943 base::Closure bound_callback = | 819 base::Closure bound_callback = |
944 base::Bind(callback, base::Passed(&keygen_handler)); | 820 base::Bind(callback, base::Passed(&keygen_handler)); |
945 if (delegate_ptr->InitializeSlot(this, bound_callback)) { | 821 if (io_data_->cert_db_io_ && |
| 822 delegate_ptr->InitializeSlot(bound_callback, |
| 823 io_data_->cert_db_io_.get())) { |
946 // Initialization complete, run the callback synchronously. | 824 // Initialization complete, run the callback synchronously. |
947 bound_callback.Run(); | 825 bound_callback.Run(); |
948 return; | 826 return; |
949 } | 827 } |
950 // Otherwise, the InitializeSlot will run the callback asynchronously. | 828 // Otherwise, the InitializeSlot will run the callback asynchronously. |
951 #else | 829 #else |
952 callback.Run(make_scoped_ptr( | 830 callback.Run(make_scoped_ptr( |
953 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); | 831 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); |
954 #endif | 832 #endif |
955 } | 833 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 | 952 |
1075 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); | 953 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); |
1076 resource_context_->request_context_ = main_request_context_.get(); | 954 resource_context_->request_context_ = main_request_context_.get(); |
1077 | 955 |
1078 #if defined(ENABLE_MANAGED_USERS) | 956 #if defined(ENABLE_MANAGED_USERS) |
1079 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter; | 957 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter; |
1080 #endif | 958 #endif |
1081 | 959 |
1082 #if defined(OS_CHROMEOS) | 960 #if defined(OS_CHROMEOS) |
1083 username_hash_ = profile_params_->username_hash; | 961 username_hash_ = profile_params_->username_hash; |
1084 use_system_key_slot_ = profile_params_->use_system_key_slot; | |
1085 if (use_system_key_slot_) | |
1086 EnableNSSSystemKeySlotForResourceContext(resource_context_.get()); | |
1087 | |
1088 crypto::ScopedPK11Slot public_slot = | 962 crypto::ScopedPK11Slot public_slot = |
1089 crypto::GetPublicSlotForChromeOSUser(username_hash_); | 963 crypto::GetPublicSlotForChromeOSUser(username_hash_); |
1090 // The private slot won't be ready by this point. It shouldn't be necessary | 964 // The private slot won't be ready by this point. It shouldn't be necessary |
1091 // for cert trust purposes anyway. | 965 // for cert trust purposes anyway. |
1092 scoped_refptr<net::CertVerifyProc> verify_proc( | 966 scoped_refptr<net::CertVerifyProc> verify_proc( |
1093 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); | 967 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); |
1094 if (policy_cert_verifier_) { | 968 if (policy_cert_verifier_) { |
1095 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); | 969 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); |
1096 policy_cert_verifier_->InitializeOnIOThread(verify_proc); | 970 policy_cert_verifier_->InitializeOnIOThread(verify_proc); |
1097 } else { | 971 } else { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 void ProfileIOData::SetCookieSettingsForTesting( | 1173 void ProfileIOData::SetCookieSettingsForTesting( |
1300 CookieSettings* cookie_settings) { | 1174 CookieSettings* cookie_settings) { |
1301 DCHECK(!cookie_settings_.get()); | 1175 DCHECK(!cookie_settings_.get()); |
1302 cookie_settings_ = cookie_settings; | 1176 cookie_settings_ = cookie_settings; |
1303 } | 1177 } |
1304 | 1178 |
1305 void ProfileIOData::set_signin_names_for_testing( | 1179 void ProfileIOData::set_signin_names_for_testing( |
1306 SigninNamesOnIOThread* signin_names) { | 1180 SigninNamesOnIOThread* signin_names) { |
1307 signin_names_.reset(signin_names); | 1181 signin_names_.reset(signin_names); |
1308 } | 1182 } |
OLD | NEW |