Chromium Code Reviews| Index: blimp/net/helium/helium_transport.h |
| diff --git a/blimp/net/helium/helium_transport.h b/blimp/net/helium/helium_transport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..42d9029dc6fe11614a75f0166200e9b46e8cdabc |
| --- /dev/null |
| +++ b/blimp/net/helium/helium_transport.h |
| @@ -0,0 +1,33 @@ |
| +// 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_HELIUM_HELIUM_TRANSPORT_H_ |
| +#define BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/callback.h" |
| + |
| +namespace blimp { |
| + |
| +// Abstract interface for a HeliumStream factory. Subclasses can use this |
| +// interface to encapsulate transport-specific connection semantics. |
| +class HeliumTransport { |
|
Garrett Casto
2016/09/30 16:58:42
Add OnStreamAccepted()?
Kevin M
2016/09/30 22:20:56
I was thinking that |connect_cb| would suffice for
Garrett Casto
2016/10/03 22:06:00
There should be a distinction between "I want to c
Kevin M
2016/10/04 01:33:08
Agreed that we'll want a delegate because new inco
|
| + public: |
| + // The HeliumStream is assumed to be authenticated and ready to use. |
| + // |stream| is nullptr if the connection attempt failed. |
| + using ConnectCallback = |
| + base::Callback<void(std::unique_ptr<HeliumStream> stream)>; |
| + |
| + // Asynchronously attempts to connect a new HeliumStream. |
| + virtual void Connect(const ConnectCallback& connect_cb) = 0; |
| + |
| + // Returns true if the underlying transport has the necessary resources (e.g. |
| + // network connectivity) to Connect() new streams. |
| + virtual bool IsAvailable() = 0; |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ |