From 49835bb9e7819568a37a07e27f3cee7e1778ec34 Mon Sep 17 00:00:00 2001 From: "satorux@chromium.org" Date: Fri, 25 Oct 2013 05:16:24 +0000 Subject: settings: Add async system salt retrieval logic in DeviceOAuth2TokenServiceFactory Along the way, remove GetCachedSystemSalt() from SystemSaltGetter. BUG=309959, 306547 TEST=none R=hashimoto@chromium.org, pastarmovj@chromium.org Review URL: https://codereview.chromium.org/39443002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230957 0039d316-1c4b-4281-b951-d872f2087c98 --- chromeos/cryptohome/system_salt_getter.cc | 4 ---- chromeos/cryptohome/system_salt_getter.h | 5 ----- chromeos/dbus/fake_cryptohome_client.cc | 3 ++- chromeos/dbus/fake_cryptohome_client.h | 8 ++++++++ 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'chromeos') diff --git a/chromeos/cryptohome/system_salt_getter.cc b/chromeos/cryptohome/system_salt_getter.cc index f299f0f..1fa25a3 100644 --- a/chromeos/cryptohome/system_salt_getter.cc +++ b/chromeos/cryptohome/system_salt_getter.cc @@ -38,10 +38,6 @@ std::string SystemSaltGetter::GetSystemSaltSync() { return system_salt_; } -std::string SystemSaltGetter::GetCachedSystemSalt() { - return system_salt_; -} - void SystemSaltGetter::GetSystemSaltInternal( const GetSystemSaltCallback& callback, bool service_is_available) { diff --git a/chromeos/cryptohome/system_salt_getter.h b/chromeos/cryptohome/system_salt_getter.h index a47b617..1e4cf81 100644 --- a/chromeos/cryptohome/system_salt_getter.h +++ b/chromeos/cryptohome/system_salt_getter.h @@ -40,11 +40,6 @@ class CHROMEOS_EXPORT SystemSaltGetter { // DEPRECATED: DO NOT USE. std::string GetSystemSaltSync(); - // Returns system hash in hex encoded ascii format, cached by a prior call - // to GetSystemSalt(). Note: this may return an empty string (e.g. if - // GetSystemSalt() is not yet called). - std::string GetCachedSystemSalt(); - protected: SystemSaltGetter(); ~SystemSaltGetter(); diff --git a/chromeos/dbus/fake_cryptohome_client.cc b/chromeos/dbus/fake_cryptohome_client.cc index d23be71..861a1c5 100644 --- a/chromeos/dbus/fake_cryptohome_client.cc +++ b/chromeos/dbus/fake_cryptohome_client.cc @@ -17,6 +17,7 @@ FakeCryptohomeClient::FakeCryptohomeClient() async_call_id_(1), tpm_is_ready_counter_(0), unmount_result_(true), + system_salt_(GetStubSystemSalt()), locked_(false), weak_ptr_factory_(this) {} @@ -80,7 +81,7 @@ void FakeCryptohomeClient::AsyncRemove( } bool FakeCryptohomeClient::GetSystemSalt(std::vector* salt) { - *salt = GetStubSystemSalt(); + *salt = system_salt_; return true; } diff --git a/chromeos/dbus/fake_cryptohome_client.h b/chromeos/dbus/fake_cryptohome_client.h index 3c960e8..450678b 100644 --- a/chromeos/dbus/fake_cryptohome_client.h +++ b/chromeos/dbus/fake_cryptohome_client.h @@ -162,6 +162,13 @@ class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { unmount_result_= result; } + // Sets the system salt which will be returned from GetSystemSalt(). By + // default, GetSystemSalt() returns the value generated by + // GetStubSystemSalt(). + void set_system_salt(const std::vector& system_salt) { + system_salt_ = system_salt; + } + // Returns the stub system salt as raw bytes. (not as a string encoded in the // format used by SystemSaltGetter::ConvertRawSaltToHexString()). static std::vector GetStubSystemSalt(); @@ -181,6 +188,7 @@ class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { AsyncCallStatusWithDataHandler async_call_status_data_handler_; int tpm_is_ready_counter_; bool unmount_result_; + std::vector system_salt_; std::vector pending_wait_for_service_to_be_available_callbacks_; -- cgit v1.1