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