Index: blimp/net/grpc_connection.h |
diff --git a/blimp/net/grpc_connection.h b/blimp/net/grpc_connection.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d6ae51bef514f44f8bfde8961824743886036f4b |
--- /dev/null |
+++ b/blimp/net/grpc_connection.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2016 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. |
+ |
+#ifndef BLIMP_NET_GRPC_CONNECTION_H_ |
+#define BLIMP_NET_GRPC_CONNECTION_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+ |
+#include "blimp/net/blimp_connection.h" |
+#include "blimp/net/blimp_net_export.h" |
+ |
+namespace blimp { |
+ |
+class BlimpMessage; |
+class BlimpMessageProcessor; |
+class GrpcIncomingForwarder; |
+class GrpcOutgoingForwarder; |
+class GrpcStream; |
+ |
+// TODO(perumaal): Remove this class after Helium transport layer is setup. |
+// A |BlimpConnection| that wraps around a |GrpcClientStream| or a |
+// |GrpcEngineStream| converting |HeliumMessage| to/from |BlimpMessage|. This is |
+// an interim solution until we have the full Helium protocol in place. It still |
+// uses the actual |HeliumStream| interfaces to talk to the gRPC layer so the |
+// actual code in those gRPC-related classes will outlive this class. |
+class BLIMP_NET_EXPORT GrpcConnection : public BlimpConnection { |
+ public: |
+ explicit GrpcConnection(std::unique_ptr<GrpcStream> stream_delegate); |
+ BlimpMessageProcessor* GetOutgoingMessageProcessor() override; |
+ void SetIncomingMessageProcessor(BlimpMessageProcessor* processor) override; |
+ ~GrpcConnection() override; |
+ |
+ private: |
+ std::unique_ptr<GrpcStream> stream_; |
+ |
+ // Forwarders that convert from |BlimpMessage|s to |HeliumMessage|s (and vice |
+ // versa). |
+ std::unique_ptr<GrpcOutgoingForwarder> outgoing_forwarder_; |
+ std::unique_ptr<GrpcIncomingForwarder> incoming_forwarder_; |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_NET_GRPC_CONNECTION_H_ |