Merge "trunks: Move BackgroundCommandTransceiver into libtrunks"
diff --git a/trunks/background_command_transceiver.h b/trunks/background_command_transceiver.h
index 048ff36..99fb76e 100644
--- a/trunks/background_command_transceiver.h
+++ b/trunks/background_command_transceiver.h
@@ -25,6 +25,8 @@
#include <base/memory/weak_ptr.h>
#include <base/sequenced_task_runner.h>
+#include "trunks/trunks_export.h"
+
namespace trunks {
// Sends commands to another CommandTransceiver on a background thread. Response
@@ -37,7 +39,7 @@
// background_thread.message_loop_proxy());
// ...
// background_transceiver.SendCommand(my_command, MyCallback);
-class BackgroundCommandTransceiver: public CommandTransceiver {
+class TRUNKS_EXPORT BackgroundCommandTransceiver: public CommandTransceiver {
public:
// All commands will be forwarded to |next_transceiver| on |task_runner|,
// regardless of whether the synchronous or asynchronous method is used. This
diff --git a/trunks/trunks.gyp b/trunks/trunks.gyp
index 63c9907..08204b9 100644
--- a/trunks/trunks.gyp
+++ b/trunks/trunks.gyp
@@ -48,6 +48,7 @@
'target_name': 'trunks',
'type': 'shared_library',
'sources': [
+ 'background_command_transceiver.cc',
'blob_parser.cc',
'error_codes.cc',
'hmac_authorization_delegate.cc',
@@ -114,7 +115,6 @@
'target_name': 'trunksd_lib',
'type': 'static_library',
'sources': [
- 'background_command_transceiver.cc',
'resource_manager.cc',
'tpm_handle.cc',
'tpm_simulator_handle.cc',
diff --git a/trunks/trunks_proxy.cc b/trunks/trunks_proxy.cc
index 2ab4774..ddef65b 100644
--- a/trunks/trunks_proxy.cc
+++ b/trunks/trunks_proxy.cc
@@ -63,6 +63,9 @@
}
SendCommandRequest tpm_command_proto;
tpm_command_proto.set_command(command);
+ auto on_success = [callback](const SendCommandResponse& response) {
+ callback.Run(response.response());
+ };
auto on_error = [callback](brillo::Error* error) {
SendCommandResponse response;
response.set_response(CreateErrorResponse(SAPI_RC_NO_RESPONSE_RECEIVED));
@@ -73,7 +76,7 @@
object_proxy_,
trunks::kTrunksInterface,
trunks::kSendCommand,
- callback,
+ base::Bind(on_success),
base::Bind(on_error),
tpm_command_proto);
}