Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: chromeos/dbus/cryptohome_client.cc

Issue 43503003: chromeos: Remove SystemSaltGetter::GetSystemSaltSync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/cryptohome_client.cc
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index ca2d48a217eab8583a8de21e4688cf1533ea8195..77848d3741e8e2f62009a255628cf7d802841c13 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -110,20 +110,13 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual bool GetSystemSalt(std::vector<uint8>* salt) OVERRIDE {
+ virtual void GetSystemSalt(const GetSystemSaltCallback& callback) OVERRIDE {
dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
cryptohome::kCryptohomeGetSystemSalt);
- scoped_ptr<dbus::Response> response(
- blocking_method_caller_->CallMethodAndBlock(&method_call));
- if (!response.get())
- return false;
- dbus::MessageReader reader(response.get());
- uint8* bytes = NULL;
- size_t length = 0;
- if (!reader.PopArrayOfBytes(&bytes, &length))
- return false;
- salt->assign(bytes, bytes + length);
- return true;
+ proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&CryptohomeClientImpl::OnGetSystemSalt,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
}
// CryptohomeClient override,
@@ -720,6 +713,24 @@ class CryptohomeClientImpl : public CryptohomeClient {
callback.Run(async_id);
}
+ // Handles the result of GetSystemSalt().
+ void OnGetSystemSalt(const GetSystemSaltCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::vector<uint8>());
+ return;
+ }
+ dbus::MessageReader reader(response);
+ uint8* bytes = NULL;
+ size_t length = 0;
+ if (!reader.PopArrayOfBytes(&bytes, &length)) {
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::vector<uint8>());
+ return;
+ }
+ callback.Run(DBUS_METHOD_CALL_SUCCESS,
+ std::vector<uint8>(bytes, bytes + length));
+ }
+
// Calls a method without result values.
void CallVoidMethod(dbus::MethodCall* method_call,
const VoidDBusMethodCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698