Chromium Code Reviews| 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_HELIUM_HELIUM_TRANSPORT_H_ | |
| 6 #define BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 | |
| 12 namespace blimp { | |
| 13 | |
| 14 // Abstract interface for a HeliumStream factory. Subclasses can use this | |
| 15 // interface to encapsulate transport-specific connection semantics. | |
| 16 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
| |
| 17 public: | |
| 18 // The HeliumStream is assumed to be authenticated and ready to use. | |
| 19 // |stream| is nullptr if the connection attempt failed. | |
| 20 using ConnectCallback = | |
| 21 base::Callback<void(std::unique_ptr<HeliumStream> stream)>; | |
| 22 | |
| 23 // Asynchronously attempts to connect a new HeliumStream. | |
| 24 virtual void Connect(const ConnectCallback& connect_cb) = 0; | |
| 25 | |
| 26 // Returns true if the underlying transport has the necessary resources (e.g. | |
| 27 // network connectivity) to Connect() new streams. | |
| 28 virtual bool IsAvailable() = 0; | |
| 29 }; | |
| 30 | |
| 31 } // namespace blimp | |
| 32 | |
| 33 #endif // BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ | |
| OLD | NEW |