| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/ownership/owner_settings_service.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 void OwnerSettingsService::OwnerKeySet(bool success) { | 371 void OwnerSettingsService::OwnerKeySet(bool success) { |
| 372 DCHECK(thread_checker_.CalledOnValidThread()); | 372 DCHECK(thread_checker_.CalledOnValidThread()); |
| 373 if (success) | 373 if (success) |
| 374 ReloadPrivateKey(); | 374 ReloadPrivateKey(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 // static | 377 // static |
| 378 void OwnerSettingsService::IsOwnerForSafeModeAsync( | 378 void OwnerSettingsService::IsOwnerForSafeModeAsync( |
| 379 const std::string& user_id, | |
| 380 const std::string& user_hash, | 379 const std::string& user_hash, |
| 381 const scoped_refptr<OwnerKeyUtil>& owner_key_util, | 380 const scoped_refptr<OwnerKeyUtil>& owner_key_util, |
| 382 const IsOwnerCallback& callback) { | 381 const IsOwnerCallback& callback) { |
| 383 CHECK(chromeos::LoginState::Get()->IsInSafeMode()); | 382 CHECK(chromeos::LoginState::Get()->IsInSafeMode()); |
| 384 | 383 |
| 385 // Make sure NSS is initialized and NSS DB is loaded for the user before | 384 // Make sure NSS is initialized and NSS DB is loaded for the user before |
| 386 // searching for the owner key. | 385 // searching for the owner key. |
| 387 BrowserThread::PostTaskAndReply( | 386 BrowserThread::PostTaskAndReply( |
| 388 BrowserThread::IO, | 387 BrowserThread::IO, |
| 389 FROM_HERE, | 388 FROM_HERE, |
| 390 base::Bind(base::IgnoreResult(&crypto::InitializeNSSForChromeOSUser), | 389 base::Bind(base::IgnoreResult(&crypto::InitializeNSSForChromeOSUser), |
| 391 user_id, | |
| 392 user_hash, | 390 user_hash, |
| 393 ProfileHelper::GetProfilePathByUserIdHash(user_hash)), | 391 ProfileHelper::GetProfilePathByUserIdHash(user_hash)), |
| 394 base::Bind(&DoesPrivateKeyExistAsync, owner_key_util, callback)); | 392 base::Bind(&DoesPrivateKeyExistAsync, owner_key_util, callback)); |
| 395 } | 393 } |
| 396 | 394 |
| 397 // static | 395 // static |
| 398 void OwnerSettingsService::SetDeviceSettingsServiceForTesting( | 396 void OwnerSettingsService::SetDeviceSettingsServiceForTesting( |
| 399 DeviceSettingsService* device_settings_service) { | 397 DeviceSettingsService* device_settings_service) { |
| 400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 401 g_device_settings_service_for_testing = device_settings_service; | 399 g_device_settings_service_for_testing = device_settings_service; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 DeviceSettingsService* OwnerSettingsService::GetDeviceSettingsService() { | 507 DeviceSettingsService* OwnerSettingsService::GetDeviceSettingsService() { |
| 510 DCHECK(thread_checker_.CalledOnValidThread()); | 508 DCHECK(thread_checker_.CalledOnValidThread()); |
| 511 if (g_device_settings_service_for_testing) | 509 if (g_device_settings_service_for_testing) |
| 512 return g_device_settings_service_for_testing; | 510 return g_device_settings_service_for_testing; |
| 513 if (DeviceSettingsService::IsInitialized()) | 511 if (DeviceSettingsService::IsInitialized()) |
| 514 return DeviceSettingsService::Get(); | 512 return DeviceSettingsService::Get(); |
| 515 return NULL; | 513 return NULL; |
| 516 } | 514 } |
| 517 | 515 |
| 518 } // namespace chromeos | 516 } // namespace chromeos |
| OLD | NEW |