| Index: chromeos/dbus/fake_cryptohome_client.cc
|
| diff --git a/chromeos/dbus/fake_cryptohome_client.cc b/chromeos/dbus/fake_cryptohome_client.cc
|
| index 1d224d95bcb941afa561e43b2173e93b1979a538..67883c52f1b4f498dcac46f32d1ec4dbe7c4cb3e 100644
|
| --- a/chromeos/dbus/fake_cryptohome_client.cc
|
| +++ b/chromeos/dbus/fake_cryptohome_client.cc
|
| @@ -1,33 +1,45 @@
|
| -// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| #include "chromeos/dbus/fake_cryptohome_client.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/location.h"
|
| #include "base/message_loop/message_loop.h"
|
| +#include "crypto/nss_util.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| namespace chromeos {
|
|
|
| -namespace {
|
| +FakeCryptohomeClient::FakeCryptohomeClient()
|
| + : async_call_id_(1),
|
| + tpm_is_ready_counter_(0),
|
| + unmount_result_(true),
|
| + locked_(false),
|
| + weak_ptr_factory_(this) {}
|
|
|
| -// A fake system salt. GetSystemSalt copies it to the given buffer.
|
| -const char kStubSystemSalt[] = "stub_system_salt";
|
| +FakeCryptohomeClient::~FakeCryptohomeClient() {}
|
|
|
| -} // namespace
|
| -
|
| -FakeCryptohomeClient::FakeCryptohomeClient() : unmount_result_(false) {
|
| +void FakeCryptohomeClient::Init(dbus::Bus* bus) {
|
| }
|
|
|
| -FakeCryptohomeClient::~FakeCryptohomeClient() {
|
| +void FakeCryptohomeClient::SetAsyncCallStatusHandlers(
|
| + const AsyncCallStatusHandler& handler,
|
| + const AsyncCallStatusWithDataHandler& data_handler) {
|
| + async_call_status_handler_ = handler;
|
| + async_call_status_data_handler_ = data_handler;
|
| }
|
|
|
| -void FakeCryptohomeClient::Init(dbus::Bus* bus) {
|
| +void FakeCryptohomeClient::ResetAsyncCallStatusHandlers() {
|
| + async_call_status_handler_.Reset();
|
| + async_call_status_data_handler_.Reset();
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmIsBeingOwned(
|
| +void FakeCryptohomeClient::IsMounted(
|
| const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| bool FakeCryptohomeClient::Unmount(bool* success) {
|
| @@ -35,242 +47,273 @@ bool FakeCryptohomeClient::Unmount(bool* success) {
|
| return true;
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncCheckKey(const std::string& username,
|
| - const std::string& key,
|
| - const AsyncMethodCallback& callback) {
|
| -}
|
| -
|
| -bool FakeCryptohomeClient::InstallAttributesIsInvalid(bool* is_invalid) {
|
| - return false;
|
| -}
|
| -
|
| -void FakeCryptohomeClient::TpmAttestationGetKeyPayload(
|
| - attestation::AttestationKeyType key_type,
|
| - const std::string& key_name,
|
| - const DataMethodCallback& callback) {
|
| +void FakeCryptohomeClient::AsyncCheckKey(
|
| + const std::string& username,
|
| + const std::string& key,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncTpmAttestationFinishCertRequest(
|
| - const std::string& pca_response,
|
| - attestation::AttestationKeyType key_type,
|
| - const std::string& key_name,
|
| +void FakeCryptohomeClient::AsyncMigrateKey(
|
| + const std::string& username,
|
| + const std::string& from_key,
|
| + const std::string& to_key,
|
| const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmIsEnabled(
|
| - const BoolDBusMethodCallback& callback) {
|
| +void FakeCryptohomeClient::AsyncRemove(
|
| + const std::string& username,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncTpmAttestationEnroll(
|
| - const std::string& pca_response,
|
| - const AsyncMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::GetSystemSalt(std::vector<uint8>* salt) {
|
| + const char kStubSystemSalt[] = "stub_system_salt";
|
| + salt->assign(kStubSystemSalt,
|
| + kStubSystemSalt + arraysize(kStubSystemSalt) - 1);
|
| + return true;
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncMigrateKey(
|
| +void FakeCryptohomeClient::GetSanitizedUsername(
|
| const std::string& username,
|
| - const std::string& from_key,
|
| - const std::string& to_key,
|
| - const AsyncMethodCallback& callback) {
|
| + const StringDBusMethodCallback& callback) {
|
| + // Even for stub implementation we have to return different values so that
|
| + // multi-profiles would work.
|
| + std::string sanitized_username = GetStubSanitizedUsername(username);
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, sanitized_username));
|
| }
|
|
|
| -void FakeCryptohomeClient::IsMounted(const BoolDBusMethodCallback& callback) {
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(callback,
|
| - DBUS_METHOD_CALL_SUCCESS, true));
|
| +std::string FakeCryptohomeClient::BlockingGetSanitizedUsername(
|
| + const std::string& username) {
|
| + return GetStubSanitizedUsername(username);
|
| }
|
|
|
| -bool FakeCryptohomeClient::InstallAttributesGet(const std::string& name,
|
| - std::vector<uint8>* value,
|
| - bool* successful) {
|
| - return false;
|
| +void FakeCryptohomeClient::AsyncMount(const std::string& username,
|
| + const std::string& key,
|
| + int flags,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncMount(const std::string& username,
|
| - const std::string& key, int flags,
|
| - const AsyncMethodCallback& callback) {
|
| - DCHECK(!callback.is_null());
|
| -
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(callback, 1 /* async_id */));
|
| - if (!handler_.is_null())
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(handler_,
|
| - 1, // async_id
|
| - true, // return_status
|
| - cryptohome::MOUNT_ERROR_NONE));
|
| -}
|
| -
|
| -void FakeCryptohomeClient::AsyncAddKey(const std::string& username,
|
| - const std::string& key,
|
| - const std::string& new_key,
|
| - const AsyncMethodCallback& callback) {
|
| - DCHECK(!callback.is_null());
|
| -
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(callback, 1 /* async_id */));
|
| - if (!handler_.is_null())
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(handler_,
|
| - 1, // async_id
|
| - true, // return_status
|
| - cryptohome::MOUNT_ERROR_NONE));
|
| +void FakeCryptohomeClient::AsyncAddKey(
|
| + const std::string& username,
|
| + const std::string& key,
|
| + const std::string& new_key,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| void FakeCryptohomeClient::AsyncMountGuest(
|
| const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| void FakeCryptohomeClient::AsyncMountPublic(
|
| const std::string& public_mount_id,
|
| int flags,
|
| const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -bool FakeCryptohomeClient::CallTpmIsBeingOwnedAndBlock(bool* owning) {
|
| - return false;
|
| +void FakeCryptohomeClient::TpmIsReady(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::Pkcs11IsTpmTokenReady(
|
| +void FakeCryptohomeClient::TpmIsEnabled(
|
| const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmClearStoredPassword(
|
| - const VoidDBusMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::CallTpmIsEnabledAndBlock(bool* enabled) {
|
| + *enabled = true;
|
| + return true;
|
| +}
|
| +
|
| +void FakeCryptohomeClient::TpmGetPassword(
|
| + const StringDBusMethodCallback& callback) {
|
| + const char kStubTpmPassword[] = "Stub-TPM-password";
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback, DBUS_METHOD_CALL_SUCCESS,
|
| + std::string(kStubTpmPassword)));
|
| +}
|
| +
|
| +void FakeCryptohomeClient::TpmIsOwned(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| +}
|
| +
|
| +bool FakeCryptohomeClient::CallTpmIsOwnedAndBlock(bool* owned) {
|
| + *owned = true;
|
| + return true;
|
| +}
|
| +
|
| +void FakeCryptohomeClient::TpmIsBeingOwned(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| +}
|
| +
|
| +bool FakeCryptohomeClient::CallTpmIsBeingOwnedAndBlock(bool* owning) {
|
| + *owning = true;
|
| + return true;
|
| }
|
|
|
| void FakeCryptohomeClient::TpmCanAttemptOwnership(
|
| const VoidDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
|
| }
|
|
|
| -bool FakeCryptohomeClient::GetSystemSalt(std::vector<uint8>* salt) {
|
| - salt->assign(kStubSystemSalt,
|
| - kStubSystemSalt + arraysize(kStubSystemSalt) - 1);
|
| - return true;
|
| +void FakeCryptohomeClient::TpmClearStoredPassword(
|
| + const VoidDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmGetPassword(
|
| - const StringDBusMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::CallTpmClearStoredPasswordAndBlock() {
|
| + return true;
|
| }
|
|
|
| -bool FakeCryptohomeClient::InstallAttributesFinalize(bool* successful) {
|
| - return false;
|
| +void FakeCryptohomeClient::Pkcs11IsTpmTokenReady(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::SetAsyncCallStatusHandlers(
|
| - const AsyncCallStatusHandler& handler,
|
| - const AsyncCallStatusWithDataHandler& data_handler) {
|
| - handler_ = handler;
|
| - data_handler_ = data_handler;
|
| +void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo(
|
| + const Pkcs11GetTpmTokenInfoCallback& callback) {
|
| + const char kStubUserPin[] = "012345";
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback,
|
| + DBUS_METHOD_CALL_SUCCESS,
|
| + std::string(crypto::kTestTPMTokenName),
|
| + std::string(kStubUserPin)));
|
| }
|
|
|
| -bool FakeCryptohomeClient::CallTpmIsEnabledAndBlock(bool* enabled) {
|
| - return false;
|
| +bool FakeCryptohomeClient::InstallAttributesGet(const std::string& name,
|
| + std::vector<uint8>* value,
|
| + bool* successful) {
|
| + if (install_attrs_.find(name) != install_attrs_.end()) {
|
| + *value = install_attrs_[name];
|
| + *successful = true;
|
| + } else {
|
| + value->clear();
|
| + *successful = false;
|
| + }
|
| + return true;
|
| }
|
|
|
| bool FakeCryptohomeClient::InstallAttributesSet(
|
| const std::string& name,
|
| const std::vector<uint8>& value,
|
| bool* successful) {
|
| - return false;
|
| -}
|
| -
|
| -bool FakeCryptohomeClient::InstallAttributesIsFirstInstall(
|
| - bool* is_first_install) {
|
| - return false;
|
| + install_attrs_[name] = value;
|
| + *successful = true;
|
| + return true;
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationGetCertificate(
|
| - attestation::AttestationKeyType key_type,
|
| - const std::string& key_name,
|
| - const DataMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::InstallAttributesFinalize(bool* successful) {
|
| + locked_ = true;
|
| + *successful = true;
|
| + return true;
|
| }
|
|
|
| void FakeCryptohomeClient::InstallAttributesIsReady(
|
| const BoolDBusMethodCallback& callback) {
|
| - base::MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(callback,
|
| - DBUS_METHOD_CALL_SUCCESS, true));
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationGetPublicKey(
|
| - attestation::AttestationKeyType key_type,
|
| - const std::string& key_name,
|
| - const DataMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::InstallAttributesIsInvalid(bool* is_invalid) {
|
| + *is_invalid = false;
|
| + return true;
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationSignSimpleChallenge(
|
| - attestation::AttestationKeyType key_type,
|
| - const std::string& key_name,
|
| - const std::string& challenge,
|
| - const AsyncMethodCallback& callback) {
|
| +bool FakeCryptohomeClient::InstallAttributesIsFirstInstall(
|
| + bool* is_first_install) {
|
| + *is_first_install = !locked_;
|
| + return true;
|
| }
|
|
|
| -void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo(
|
| - const Pkcs11GetTpmTokenInfoCallback& callback) {
|
| +void FakeCryptohomeClient::TpmAttestationIsPrepared(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmIsOwned(const BoolDBusMethodCallback& callback) {
|
| +void FakeCryptohomeClient::TpmAttestationIsEnrolled(
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationIsPrepared(
|
| - const BoolDBusMethodCallback& callback) {
|
| +void FakeCryptohomeClient::AsyncTpmAttestationCreateEnrollRequest(
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmIsReady(const BoolDBusMethodCallback& callback) {
|
| +void FakeCryptohomeClient::AsyncTpmAttestationEnroll(
|
| + const std::string& pca_response,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, false);
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncTpmAttestationCreateEnrollRequest(
|
| +void FakeCryptohomeClient::AsyncTpmAttestationCreateCertRequest(
|
| + attestation::AttestationCertificateProfile certificate_profile,
|
| + const std::string& user_email,
|
| + const std::string& request_origin,
|
| const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| -void FakeCryptohomeClient::ResetAsyncCallStatusHandlers() {
|
| - handler_.Reset();
|
| - data_handler_.Reset();
|
| +void FakeCryptohomeClient::AsyncTpmAttestationFinishCertRequest(
|
| + const std::string& pca_response,
|
| + attestation::AttestationKeyType key_type,
|
| + const std::string& key_name,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| void FakeCryptohomeClient::TpmAttestationDoesKeyExist(
|
| attestation::AttestationKeyType key_type,
|
| const std::string& key_name,
|
| const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, false));
|
| }
|
|
|
| -bool FakeCryptohomeClient::CallTpmIsOwnedAndBlock(bool* owned) {
|
| - return false;
|
| -}
|
| -
|
| -void FakeCryptohomeClient::AsyncRemove(const std::string& username,
|
| - const AsyncMethodCallback& callback) {
|
| -}
|
| -
|
| -void FakeCryptohomeClient::TpmAttestationSetKeyPayload(
|
| +void FakeCryptohomeClient::TpmAttestationGetCertificate(
|
| attestation::AttestationKeyType key_type,
|
| const std::string& key_name,
|
| - const std::string& payload,
|
| - const BoolDBusMethodCallback& callback) {
|
| + const DataMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, false, std::string()));
|
| }
|
|
|
| -void FakeCryptohomeClient::GetSanitizedUsername(
|
| - const std::string& username,
|
| - const StringDBusMethodCallback& callback) {
|
| - DCHECK(!callback.is_null());
|
| -
|
| +void FakeCryptohomeClient::TpmAttestationGetPublicKey(
|
| + attestation::AttestationKeyType key_type,
|
| + const std::string& key_name,
|
| + const DataMethodCallback& callback) {
|
| base::MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(callback,
|
| - chromeos::DBUS_METHOD_CALL_SUCCESS,
|
| - username));
|
| - if (!data_handler_.is_null())
|
| - base::MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(data_handler_,
|
| - 1, // async_id
|
| - true, // return_status
|
| - username));
|
| + base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, false, std::string()));
|
| }
|
|
|
| -std::string FakeCryptohomeClient::BlockingGetSanitizedUsername(
|
| - const std::string& username) {
|
| - return username;
|
| +void FakeCryptohomeClient::TpmAttestationRegisterKey(
|
| + attestation::AttestationKeyType key_type,
|
| + const std::string& key_name,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| void FakeCryptohomeClient::TpmAttestationSignEnterpriseChallenge(
|
| @@ -281,27 +324,66 @@ void FakeCryptohomeClient::TpmAttestationSignEnterpriseChallenge(
|
| attestation::AttestationChallengeOptions options,
|
| const std::string& challenge,
|
| const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationIsEnrolled(
|
| - const BoolDBusMethodCallback& callback) {
|
| +void FakeCryptohomeClient::TpmAttestationSignSimpleChallenge(
|
| + attestation::AttestationKeyType key_type,
|
| + const std::string& key_name,
|
| + const std::string& challenge,
|
| + const AsyncMethodCallback& callback) {
|
| + ReturnAsyncMethodResult(callback, true);
|
| }
|
|
|
| -void FakeCryptohomeClient::TpmAttestationRegisterKey(
|
| +void FakeCryptohomeClient::TpmAttestationGetKeyPayload(
|
| attestation::AttestationKeyType key_type,
|
| const std::string& key_name,
|
| - const AsyncMethodCallback& callback) {
|
| + const DataMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, false, std::string()));
|
| }
|
|
|
| -bool FakeCryptohomeClient::CallTpmClearStoredPasswordAndBlock() {
|
| - return false;
|
| +void FakeCryptohomeClient::TpmAttestationSetKeyPayload(
|
| + attestation::AttestationKeyType key_type,
|
| + const std::string& key_name,
|
| + const std::string& payload,
|
| + const BoolDBusMethodCallback& callback) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, false));
|
| }
|
|
|
| -void FakeCryptohomeClient::AsyncTpmAttestationCreateCertRequest(
|
| - attestation::AttestationCertificateProfile certificate_profile,
|
| - const std::string& user_email,
|
| - const std::string& request_origin,
|
| - const AsyncMethodCallback& callback) {
|
| +void FakeCryptohomeClient::ReturnAsyncMethodResult(
|
| + const AsyncMethodCallback& callback,
|
| + bool returns_data) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&FakeCryptohomeClient::ReturnAsyncMethodResultInternal,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + callback,
|
| + returns_data));
|
| +}
|
| +
|
| +void FakeCryptohomeClient::ReturnAsyncMethodResultInternal(
|
| + const AsyncMethodCallback& callback,
|
| + bool returns_data) {
|
| + callback.Run(async_call_id_);
|
| + if (!returns_data && !async_call_status_handler_.is_null()) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(async_call_status_handler_,
|
| + async_call_id_,
|
| + true,
|
| + cryptohome::MOUNT_ERROR_NONE));
|
| + } else if (returns_data && !async_call_status_data_handler_.is_null()) {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(async_call_status_data_handler_,
|
| + async_call_id_,
|
| + true,
|
| + std::string()));
|
| + }
|
| + ++async_call_id_;
|
| }
|
|
|
| -} // namespace chromeos
|
| +} // namespace chromeos
|
|
|