OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_NET_GRPC_CLIENT_TRANSPORT_H_ |
| 6 #define BLIMP_NET_GRPC_CLIENT_TRANSPORT_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
| 13 #include "blimp/common/public/session/assignment_options.h" |
| 14 #include "blimp/net/blimp_net_export.h" |
| 15 #include "blimp/net/blimp_transport.h" |
| 16 #include "net/base/completion_callback.h" |
| 17 |
| 18 namespace grpc { |
| 19 class Client; |
| 20 } |
| 21 |
| 22 namespace blimp { |
| 23 |
| 24 class GrpcClientStream; |
| 25 class GrpcConnection; |
| 26 |
| 27 // Class that interfaces a BlimpTransport to a GrpcClientStream through a |
| 28 // GrpcConnection. |
| 29 class BLIMP_NET_EXPORT GrpcClientTransport : public BlimpTransport { |
| 30 public: |
| 31 explicit GrpcClientTransport(const AssignmentOptions& assignment_options); |
| 32 |
| 33 // Creates and connects using the GrpcClientStream and calls |callback| on |
| 34 // the IO thread on connection success. |
| 35 void Connect(const net::CompletionCallback& callback) override; |
| 36 |
| 37 // Creates a new GrpcConnection and transfers ownership to caller. |
| 38 std::unique_ptr<BlimpConnection> MakeConnection() override; |
| 39 |
| 40 const char* GetName() const override; |
| 41 ~GrpcClientTransport() override; |
| 42 |
| 43 private: |
| 44 AssignmentOptions assignment_options_; |
| 45 std::unique_ptr<GrpcConnection> grpc_connection_; |
| 46 }; |
| 47 |
| 48 } // namespace blimp |
| 49 |
| 50 #endif // BLIMP_NET_GRPC_CLIENT_TRANSPORT_H_ |
OLD | NEW |