Chromium Code Reviews| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 112 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 113 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 113 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
| 114 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" | 114 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" |
| 115 #endif // defined(OS_ANDROID) | 115 #endif // defined(OS_ANDROID) |
| 116 | 116 |
| 117 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
| 118 #include "chrome/browser/chromeos/fileapi/external_file_protocol_handler.h" | 118 #include "chrome/browser/chromeos/fileapi/external_file_protocol_handler.h" |
| 119 #include "chrome/browser/chromeos/login/startup_utils.h" | 119 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 120 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 120 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
| 121 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h" | 121 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h" |
| 122 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
| 123 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 122 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 124 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" | 123 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
| 125 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 124 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
| 126 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 125 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 127 #include "chrome/browser/chromeos/settings/cros_settings.h" | 126 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 128 #include "chrome/browser/net/nss_context.h" | |
| 129 #include "chromeos/dbus/cryptohome_client.h" | |
| 130 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 131 #include "chromeos/settings/cros_settings_names.h" | 127 #include "chromeos/settings/cros_settings_names.h" |
| 132 #include "components/user_manager/user.h" | 128 #include "components/user_manager/user.h" |
| 133 #include "components/user_manager/user_manager.h" | 129 #include "components/user_manager/user_manager.h" |
| 134 #include "crypto/nss_util.h" | 130 #include "crypto/nss_util.h" |
| 135 #include "crypto/nss_util_internal.h" | 131 #include "crypto/nss_util_internal.h" |
| 136 #include "net/cert/cert_verifier.h" | 132 #include "net/cert/cert_verifier.h" |
| 137 #include "net/cert/multi_threaded_cert_verifier.h" | 133 #include "net/cert/multi_threaded_cert_verifier.h" |
| 138 #include "net/ssl/client_cert_store_chromeos.h" | 134 #include "net/ssl/client_cert_store_chromeos.h" |
| 139 #endif // defined(OS_CHROMEOS) | 135 #endif // defined(OS_CHROMEOS) |
| 140 | 136 |
| 141 #if defined(USE_NSS) | 137 #if defined(USE_NSS) |
| 138 #include "chrome/browser/net/cert_database_service_factory.h" | |
| 142 #include "chrome/browser/ui/crypto_module_delegate_nss.h" | 139 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
| 140 #include "components/cert_database/public/cert_database_service.h" | |
| 141 #include "components/cert_database/public/cert_database_service_io_part.h" | |
| 143 #include "net/ssl/client_cert_store_nss.h" | 142 #include "net/ssl/client_cert_store_nss.h" |
| 144 #endif | 143 #endif |
| 145 | 144 |
| 146 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 147 #include "net/ssl/client_cert_store_win.h" | 146 #include "net/ssl/client_cert_store_win.h" |
| 148 #endif | 147 #endif |
| 149 | 148 |
| 150 #if defined(OS_MACOSX) | 149 #if defined(OS_MACOSX) |
| 151 #include "net/ssl/client_cert_store_mac.h" | 150 #include "net/ssl/client_cert_store_mac.h" |
| 152 #endif | 151 #endif |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 request, network_delegate, path, | 220 request, network_delegate, path, |
| 222 content::BrowserThread::GetBlockingPool()-> | 221 content::BrowserThread::GetBlockingPool()-> |
| 223 GetTaskRunnerWithShutdownBehavior( | 222 GetTaskRunnerWithShutdownBehavior( |
| 224 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 223 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 225 | 224 |
| 226 return NULL; | 225 return NULL; |
| 227 } | 226 } |
| 228 }; | 227 }; |
| 229 #endif // defined(DEBUG_DEVTOOLS) | 228 #endif // defined(DEBUG_DEVTOOLS) |
| 230 | 229 |
| 231 #if defined(OS_CHROMEOS) | |
| 232 // The following four functions are responsible for initializing NSS for each | |
| 233 // profile on ChromeOS, which has a separate NSS database and TPM slot | |
| 234 // per-profile. | |
| 235 // | |
| 236 // Initialization basically follows these steps: | |
| 237 // 1) Get some info from user_manager::UserManager about the User for this | |
| 238 // profile. | |
| 239 // 2) Tell nss_util to initialize the software slot for this profile. | |
| 240 // 3) Wait for the TPM module to be loaded by nss_util if it isn't already. | |
| 241 // 4) Ask CryptohomeClient which TPM slot id corresponds to this profile. | |
| 242 // 5) Tell nss_util to use that slot id on the TPM module. | |
| 243 // | |
| 244 // Some of these steps must happen on the UI thread, others must happen on the | |
| 245 // IO thread: | |
| 246 // UI thread IO Thread | |
| 247 // | |
| 248 // ProfileIOData::InitializeOnUIThread | |
| 249 // | | |
| 250 // ProfileHelper::Get()->GetUserByProfile() | |
| 251 // \---------------------------------------v | |
| 252 // StartNSSInitOnIOThread | |
| 253 // | | |
| 254 // crypto::InitializeNSSForChromeOSUser | |
| 255 // | | |
| 256 // crypto::IsTPMTokenReady | |
| 257 // | | |
| 258 // StartTPMSlotInitializationOnIOThread | |
| 259 // v---------------------------------------/ | |
| 260 // GetTPMInfoForUserOnUIThread | |
| 261 // | | |
| 262 // CryptohomeClient::Pkcs11GetTpmTokenInfoForUser | |
| 263 // | | |
| 264 // DidGetTPMInfoForUserOnUIThread | |
| 265 // \---------------------------------------v | |
| 266 // crypto::InitializeTPMForChromeOSUser | |
| 267 | |
| 268 void DidGetTPMInfoForUserOnUIThread(const std::string& username_hash, | |
| 269 chromeos::DBusMethodCallStatus call_status, | |
| 270 const std::string& label, | |
| 271 const std::string& user_pin, | |
| 272 int slot_id) { | |
| 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 274 if (call_status == chromeos::DBUS_METHOD_CALL_FAILURE) { | |
| 275 NOTREACHED() << "dbus error getting TPM info for " << username_hash; | |
| 276 return; | |
| 277 } | |
| 278 DVLOG(1) << "Got TPM slot for " << username_hash << ": " << slot_id; | |
| 279 BrowserThread::PostTask( | |
| 280 BrowserThread::IO, | |
| 281 FROM_HERE, | |
| 282 base::Bind( | |
| 283 &crypto::InitializeTPMForChromeOSUser, username_hash, slot_id)); | |
| 284 } | |
| 285 | |
| 286 void GetTPMInfoForUserOnUIThread(const std::string& username, | |
| 287 const std::string& username_hash) { | |
| 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 289 DVLOG(1) << "Getting TPM info from cryptohome for " | |
| 290 << " " << username << " " << username_hash; | |
| 291 chromeos::DBusThreadManager::Get() | |
| 292 ->GetCryptohomeClient() | |
| 293 ->Pkcs11GetTpmTokenInfoForUser( | |
| 294 username, | |
| 295 base::Bind(&DidGetTPMInfoForUserOnUIThread, username_hash)); | |
| 296 } | |
| 297 | |
| 298 void StartTPMSlotInitializationOnIOThread(const std::string& username, | |
| 299 const std::string& username_hash) { | |
| 300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 301 | |
| 302 BrowserThread::PostTask( | |
| 303 BrowserThread::UI, | |
| 304 FROM_HERE, | |
| 305 base::Bind(&GetTPMInfoForUserOnUIThread, username, username_hash)); | |
| 306 } | |
| 307 | |
| 308 void StartNSSInitOnIOThread(const std::string& username, | |
| 309 const std::string& username_hash, | |
| 310 const base::FilePath& path) { | |
| 311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 312 DVLOG(1) << "Starting NSS init for " << username | |
| 313 << " hash:" << username_hash; | |
| 314 | |
| 315 // Make sure NSS is initialized for the user. | |
| 316 crypto::InitializeNSSForChromeOSUser(username_hash, path); | |
| 317 | |
| 318 // Check if it's OK to initialize TPM for the user before continuing. This | |
| 319 // may not be the case if the TPM slot initialization was previously | |
| 320 // requested for the same user. | |
| 321 if (!crypto::ShouldInitializeTPMForChromeOSUser(username_hash)) | |
| 322 return; | |
| 323 | |
| 324 crypto::WillInitializeTPMForChromeOSUser(username_hash); | |
| 325 | |
| 326 if (crypto::IsTPMTokenEnabledForNSS()) { | |
| 327 if (crypto::IsTPMTokenReady(base::Bind( | |
| 328 &StartTPMSlotInitializationOnIOThread, username, username_hash))) { | |
| 329 StartTPMSlotInitializationOnIOThread(username, username_hash); | |
| 330 } else { | |
| 331 DVLOG(1) << "Waiting for tpm ready ..."; | |
| 332 } | |
| 333 } else { | |
| 334 crypto::InitializePrivateSoftwareSlotForChromeOSUser(username_hash); | |
| 335 } | |
| 336 } | |
| 337 #endif // defined(OS_CHROMEOS) | |
| 338 | |
| 339 #if defined(USE_NSS) | 230 #if defined(USE_NSS) |
| 340 void InitializeAndPassKeygenHandler( | 231 void InitializeAndPassKeygenHandler( |
| 341 scoped_ptr<net::KeygenHandler> keygen_handler, | 232 scoped_ptr<net::KeygenHandler> keygen_handler, |
| 342 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, | 233 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, |
| 343 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { | 234 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { |
| 344 if (delegate) | 235 if (delegate) |
| 345 keygen_handler->set_crypto_module_delegate(delegate.Pass()); | 236 keygen_handler->set_crypto_module_delegate(delegate.Pass()); |
| 346 callback.Run(keygen_handler.Pass()); | 237 callback.Run(keygen_handler.Pass()); |
| 347 } | 238 } |
| 348 #endif // defined(USE_NSS) | 239 #endif // defined(USE_NSS) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 SupervisedUserService* supervised_user_service = | 292 SupervisedUserService* supervised_user_service = |
| 402 SupervisedUserServiceFactory::GetForProfile(profile); | 293 SupervisedUserServiceFactory::GetForProfile(profile); |
| 403 params->supervised_user_url_filter = | 294 params->supervised_user_url_filter = |
| 404 supervised_user_service->GetURLFilterForIOThread(); | 295 supervised_user_service->GetURLFilterForIOThread(); |
| 405 #endif | 296 #endif |
| 406 #if defined(OS_CHROMEOS) | 297 #if defined(OS_CHROMEOS) |
| 407 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 298 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 408 if (user_manager) { | 299 if (user_manager) { |
| 409 user_manager::User* user = | 300 user_manager::User* user = |
| 410 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 301 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 411 // No need to initialize NSS for users with empty username hash: | |
| 412 // Getters for a user's NSS slots always return NULL slot if the user's | |
| 413 // username hash is empty, even when the NSS is not initialized for the | |
| 414 // user. | |
| 415 if (user && !user->username_hash().empty()) { | 302 if (user && !user->username_hash().empty()) { |
| 416 params->username_hash = user->username_hash(); | 303 params->username_hash = user->username_hash(); |
| 417 DCHECK(!params->username_hash.empty()); | 304 DCHECK(!params->username_hash.empty()); |
| 418 BrowserThread::PostTask(BrowserThread::IO, | |
| 419 FROM_HERE, | |
| 420 base::Bind(&StartNSSInitOnIOThread, | |
| 421 user->email(), | |
| 422 user->username_hash(), | |
| 423 profile->GetPath())); | |
| 424 | |
| 425 // Use the device-wide system key slot only if the user is of the same | |
| 426 // domain as the device is registered to. | |
| 427 policy::BrowserPolicyConnectorChromeOS* connector = | |
| 428 g_browser_process->platform_part() | |
| 429 ->browser_policy_connector_chromeos(); | |
| 430 params->use_system_key_slot = | |
| 431 connector->GetUserAffiliation(user->email()) == | |
| 432 policy::USER_AFFILIATION_MANAGED; | |
| 433 } | 305 } |
| 434 } | 306 } |
| 435 #endif | 307 #endif |
| 436 | 308 |
| 437 params->profile = profile; | 309 params->profile = profile; |
| 438 params->prerender_tracker = g_browser_process->prerender_tracker(); | 310 params->prerender_tracker = g_browser_process->prerender_tracker(); |
| 439 profile_params_.reset(params.release()); | 311 profile_params_.reset(params.release()); |
| 440 | 312 |
| 441 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 313 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 442 &enable_referrers_, | 314 &enable_referrers_, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 local_state_pref_service); | 362 local_state_pref_service); |
| 491 quick_check_enabled_.MoveToThread(io_message_loop_proxy); | 363 quick_check_enabled_.MoveToThread(io_message_loop_proxy); |
| 492 | 364 |
| 493 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); | 365 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); |
| 494 | 366 |
| 495 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 367 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
| 496 pref_service); | 368 pref_service); |
| 497 | 369 |
| 498 network_prediction_options_.MoveToThread(io_message_loop_proxy); | 370 network_prediction_options_.MoveToThread(io_message_loop_proxy); |
| 499 | 371 |
| 372 #if defined(USE_NSS) | |
| 373 cert_database::CertDatabaseService* service = | |
| 374 cert_database::CertDatabaseServiceFactory::GetForBrowserContext(profile); | |
| 375 if (service) | |
| 376 cert_db_io_ = service->GetIOPart(); | |
| 377 #endif | |
| 378 | |
| 500 #if defined(OS_CHROMEOS) | 379 #if defined(OS_CHROMEOS) |
| 501 scoped_ptr<policy::PolicyCertVerifier> verifier = | 380 scoped_ptr<policy::PolicyCertVerifier> verifier = |
| 502 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 381 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
| 503 policy_cert_verifier_ = verifier.get(); | 382 policy_cert_verifier_ = verifier.get(); |
| 504 cert_verifier_ = verifier.Pass(); | 383 cert_verifier_ = verifier.Pass(); |
| 505 #endif | 384 #endif |
| 506 // The URLBlacklistManager has to be created on the UI thread to register | 385 // The URLBlacklistManager has to be created on the UI thread to register |
| 507 // observers of |pref_service|, and it also has to clean up on | 386 // observers of |pref_service|, and it also has to clean up on |
| 508 // ShutdownOnUIThread to release these observers on the right thread. | 387 // ShutdownOnUIThread to release these observers on the right thread. |
| 509 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 388 // 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... | |
| 579 job_factory_ = job_factory.Pass(); | 458 job_factory_ = job_factory.Pass(); |
| 580 set_job_factory(job_factory_.get()); | 459 set_job_factory(job_factory_.get()); |
| 581 } | 460 } |
| 582 | 461 |
| 583 ProfileIOData::AppRequestContext::~AppRequestContext() { | 462 ProfileIOData::AppRequestContext::~AppRequestContext() { |
| 584 AssertNoURLRequests(); | 463 AssertNoURLRequests(); |
| 585 } | 464 } |
| 586 | 465 |
| 587 ProfileIOData::ProfileParams::ProfileParams() | 466 ProfileIOData::ProfileParams::ProfileParams() |
| 588 : io_thread(NULL), | 467 : io_thread(NULL), |
| 589 #if defined(OS_CHROMEOS) | |
| 590 use_system_key_slot(false), | |
| 591 #endif | |
| 592 profile(NULL) { | 468 profile(NULL) { |
| 593 } | 469 } |
| 594 | 470 |
| 595 ProfileIOData::ProfileParams::~ProfileParams() {} | 471 ProfileIOData::ProfileParams::~ProfileParams() {} |
| 596 | 472 |
| 597 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) | 473 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) |
| 598 : initialized_(false), | 474 : initialized_(false), |
| 599 #if defined(OS_CHROMEOS) | 475 #if defined(OS_CHROMEOS) |
| 600 policy_cert_verifier_(NULL), | 476 policy_cert_verifier_(NULL), |
| 601 use_system_key_slot_(false), | |
| 602 #endif | 477 #endif |
| 603 resource_context_(new ResourceContext(this)), | 478 resource_context_(new ResourceContext(this)), |
| 604 initialized_on_UI_thread_(false), | 479 initialized_on_UI_thread_(false), |
| 605 profile_type_(profile_type) { | 480 profile_type_(profile_type) { |
| 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 481 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 607 } | 482 } |
| 608 | 483 |
| 609 ProfileIOData::~ProfileIOData() { | 484 ProfileIOData::~ProfileIOData() { |
| 610 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) | 485 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) |
| 611 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 486 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 909 DCHECK(io_data_->initialized_); | 784 DCHECK(io_data_->initialized_); |
| 910 return request_context_; | 785 return request_context_; |
| 911 } | 786 } |
| 912 | 787 |
| 913 scoped_ptr<net::ClientCertStore> | 788 scoped_ptr<net::ClientCertStore> |
| 914 ProfileIOData::ResourceContext::CreateClientCertStore() { | 789 ProfileIOData::ResourceContext::CreateClientCertStore() { |
| 915 if (!io_data_->client_cert_store_factory_.is_null()) | 790 if (!io_data_->client_cert_store_factory_.is_null()) |
| 916 return io_data_->client_cert_store_factory_.Run(); | 791 return io_data_->client_cert_store_factory_.Run(); |
| 917 #if defined(OS_CHROMEOS) | 792 #if defined(OS_CHROMEOS) |
| 918 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( | 793 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreChromeOS( |
| 919 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( | 794 make_scoped_ptr( |
| 920 io_data_->use_system_key_slot(), io_data_->username_hash())), | 795 new chromeos::ClientCertFilterChromeOS(io_data_->cert_db_io_)), |
| 921 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 796 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
| 922 chrome::kCryptoModulePasswordClientAuth))); | 797 chrome::kCryptoModulePasswordClientAuth))); |
| 923 #elif defined(USE_NSS) | 798 #elif defined(USE_NSS) |
| 924 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( | 799 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( |
| 925 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, | 800 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
| 926 chrome::kCryptoModulePasswordClientAuth))); | 801 chrome::kCryptoModulePasswordClientAuth))); |
| 927 #elif defined(OS_WIN) | 802 #elif defined(OS_WIN) |
| 928 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); | 803 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); |
| 929 #elif defined(OS_MACOSX) | 804 #elif defined(OS_MACOSX) |
| 930 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); | 805 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 946 DCHECK(!callback.is_null()); | 821 DCHECK(!callback.is_null()); |
| 947 #if defined(USE_NSS) | 822 #if defined(USE_NSS) |
| 948 scoped_ptr<net::KeygenHandler> keygen_handler( | 823 scoped_ptr<net::KeygenHandler> keygen_handler( |
| 949 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | 824 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); |
| 950 | 825 |
| 951 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> | 826 base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)> |
| 952 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, | 827 got_delegate_callback = base::Bind(&InitializeAndPassKeygenHandler, |
| 953 base::Passed(&keygen_handler), | 828 base::Passed(&keygen_handler), |
| 954 callback); | 829 callback); |
| 955 | 830 |
| 956 ChromeNSSCryptoModuleDelegate::CreateForResourceContext( | 831 // If |cert_db_io_| is not available, we're shutting down already. Return the |
|
mmenke
2014/11/04 20:02:18
nit: Don't use "we" in comments.
pneubeck (no reviews)
2014/11/05 14:53:38
Done.
| |
| 832 // KeygenHandler without ChromeNSSCryptoModuleDelegate. | |
| 833 if (!io_data_->cert_db_io_) { | |
| 834 got_delegate_callback.Run(scoped_ptr<ChromeNSSCryptoModuleDelegate>()); | |
| 835 return; | |
| 836 } | |
| 837 | |
| 838 ChromeNSSCryptoModuleDelegate::CreateForCertDatabase( | |
| 957 chrome::kCryptoModulePasswordKeygen, | 839 chrome::kCryptoModulePasswordKeygen, |
| 958 net::HostPortPair::FromURL(url), | 840 net::HostPortPair::FromURL(url), |
| 959 this, | 841 io_data_->cert_db_io_.get(), |
| 960 got_delegate_callback); | 842 got_delegate_callback); |
| 961 #else | 843 #else |
| 962 callback.Run(make_scoped_ptr( | 844 callback.Run(make_scoped_ptr( |
| 963 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); | 845 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); |
| 964 #endif | 846 #endif |
| 965 } | 847 } |
| 966 | 848 |
| 967 ResourceContext::SaltCallback | 849 ResourceContext::SaltCallback |
| 968 ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { | 850 ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { |
| 969 return io_data_->GetMediaDeviceIDSalt(); | 851 return io_data_->GetMediaDeviceIDSalt(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1066 if (profile_params_->resource_prefetch_predictor_observer_) { | 948 if (profile_params_->resource_prefetch_predictor_observer_) { |
| 1067 resource_prefetch_predictor_observer_.reset( | 949 resource_prefetch_predictor_observer_.reset( |
| 1068 profile_params_->resource_prefetch_predictor_observer_.release()); | 950 profile_params_->resource_prefetch_predictor_observer_.release()); |
| 1069 } | 951 } |
| 1070 | 952 |
| 1071 #if defined(ENABLE_MANAGED_USERS) | 953 #if defined(ENABLE_MANAGED_USERS) |
| 1072 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter; | 954 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter; |
| 1073 #endif | 955 #endif |
| 1074 | 956 |
| 1075 #if defined(OS_CHROMEOS) | 957 #if defined(OS_CHROMEOS) |
| 1076 username_hash_ = profile_params_->username_hash; | |
| 1077 use_system_key_slot_ = profile_params_->use_system_key_slot; | |
| 1078 if (use_system_key_slot_) | |
| 1079 EnableNSSSystemKeySlotForResourceContext(resource_context_.get()); | |
| 1080 | |
| 1081 crypto::ScopedPK11Slot public_slot = | 958 crypto::ScopedPK11Slot public_slot = |
| 1082 crypto::GetPublicSlotForChromeOSUser(username_hash_); | 959 crypto::GetPublicSlotForChromeOSUser(profile_params_->username_hash); |
| 1083 // The private slot won't be ready by this point. It shouldn't be necessary | 960 // The private slot won't be ready by this point. It shouldn't be necessary |
| 1084 // for cert trust purposes anyway. | 961 // for cert trust purposes anyway. |
| 1085 scoped_refptr<net::CertVerifyProc> verify_proc( | 962 scoped_refptr<net::CertVerifyProc> verify_proc( |
| 1086 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); | 963 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); |
| 1087 if (policy_cert_verifier_) { | 964 if (policy_cert_verifier_) { |
| 1088 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); | 965 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); |
| 1089 policy_cert_verifier_->InitializeOnIOThread(verify_proc); | 966 policy_cert_verifier_->InitializeOnIOThread(verify_proc); |
| 1090 } else { | 967 } else { |
| 1091 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); | 968 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); |
| 1092 } | 969 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1288 void ProfileIOData::SetCookieSettingsForTesting( | 1165 void ProfileIOData::SetCookieSettingsForTesting( |
| 1289 CookieSettings* cookie_settings) { | 1166 CookieSettings* cookie_settings) { |
| 1290 DCHECK(!cookie_settings_.get()); | 1167 DCHECK(!cookie_settings_.get()); |
| 1291 cookie_settings_ = cookie_settings; | 1168 cookie_settings_ = cookie_settings; |
| 1292 } | 1169 } |
| 1293 | 1170 |
| 1294 void ProfileIOData::set_signin_names_for_testing( | 1171 void ProfileIOData::set_signin_names_for_testing( |
| 1295 SigninNamesOnIOThread* signin_names) { | 1172 SigninNamesOnIOThread* signin_names) { |
| 1296 signin_names_.reset(signin_names); | 1173 signin_names_.reset(signin_names); |
| 1297 } | 1174 } |
| OLD | NEW |