Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: blimp/helium/transport.h

Issue 2602103002: Delete blimp/helium and remove references to it from dependent targets (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/helium/syncable_common.cc ('k') | blimp/helium/update_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_HELIUM_TRANSPORT_H_
6 #define BLIMP_HELIUM_TRANSPORT_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/cancelable_callback.h"
12 #include "blimp/helium/result.h"
13
14 namespace blimp {
15 namespace helium {
16
17 // Pure virtual interface for a helium::Stream factory. Subclasses can use this
18 // interface to encapsulate transport-specific stream connection semantics.
19 class Transport {
20 public:
21 // Callback invoked with the stream and result code of a Connect or Accept
22 // attempt.
23 // The helium::Stream is assumed to be authenticated and ready to use.
24 // If the connection attempt failed, the value of |stream| will be null and
25 // |result| will be set to the relevant error code.
26 using StreamCreatedCallback =
27 base::CancelableCallback<void(std::unique_ptr<Stream> stream,
28 Result result)>;
29
30 // Callback to be invoked when the underlying transport transitions
31 // between an offline/unusable state and an online/usable state.
32 using AvailabilityChangedCallback = base::Callback<void(bool)>;
33
34 virtual void SetAvailabilityChangedCallback(
35 const AvailabilityChangedCallback& callback);
36
37 // Asynchronously attempts to connect a new helium::Stream.
38 // Multiple overlapping connection attempts are permitted.
39 // The caller can cancel |cb| if it no longer needs the stream.
40 virtual void Connect(const StreamCreatedCallback& cb) = 0;
41
42 // Accepts an incoming connection from the peer.
43 virtual void Accept(const StreamCreatedCallback& cb) = 0;
44
45 // Returns true if the underlying transport has the necessary resources
46 // and connectivity for Connect and Accept operations.
47 virtual bool IsAvailable() = 0;
48 };
49
50 } // namespace helium
51 } // namespace blimp
52
53 #endif // BLIMP_HELIUM_TRANSPORT_H_
OLDNEW
« no previous file with comments | « blimp/helium/syncable_common.cc ('k') | blimp/helium/update_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698