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

Side by Side Diff: blimp/net/blimp_connection.h

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move virtual dtor to BlimpConnection Created 5 years, 1 month 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 | « no previous file | blimp/net/stream_socket_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_ 5 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_
6 #define BLIMP_NET_BLIMP_CONNECTION_H_ 6 #define BLIMP_NET_BLIMP_CONNECTION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "blimp/net/blimp_net_export.h" 10 #include "blimp/net/blimp_net_export.h"
11 11
12 namespace blimp { 12 namespace blimp {
13 13
14 class BlimpMessageProcessor; 14 class BlimpMessageProcessor;
15 class PacketReader; 15 class PacketReader;
16 class PacketWriter; 16 class PacketWriter;
17 17
18 // Encapsulates the state and logic used to exchange BlimpMessages over 18 // Encapsulates the state and logic used to exchange BlimpMessages over
19 // a network connection. 19 // a network connection.
20 class BLIMP_NET_EXPORT BlimpConnection { 20 class BLIMP_NET_EXPORT BlimpConnection {
21 public: 21 public:
22 class DisconnectObserver { 22 class DisconnectObserver {
23 // Called when the network connection for |this| is disconnected. 23 // Called when the network connection for |this| is disconnected.
24 virtual void OnDisconnected() = 0; 24 virtual void OnDisconnected() = 0;
25 }; 25 };
26 26
27 BlimpConnection(scoped_ptr<PacketReader> reader, 27 BlimpConnection(scoped_ptr<PacketReader> reader,
28 scoped_ptr<PacketWriter> writer); 28 scoped_ptr<PacketWriter> writer);
29 29
30 ~BlimpConnection(); 30 virtual ~BlimpConnection();
31 31
32 // Lets |observer| know when the network connection is terminated. 32 // Lets |observer| know when the network connection is terminated.
33 void AddDisconnectObserver(DisconnectObserver* observer); 33 void AddDisconnectObserver(DisconnectObserver* observer);
34 34
35 // Sets the processor which will take incoming messages for this connection. 35 // Sets the processor which will take incoming messages for this connection.
36 // Can be set multiple times, but previously set processors are discarded. 36 // Can be set multiple times, but previously set processors are discarded.
37 void set_incoming_message_processor( 37 void set_incoming_message_processor(
38 scoped_ptr<BlimpMessageProcessor> processor); 38 scoped_ptr<BlimpMessageProcessor> processor);
39 39
40 // Gets a processor for BrowserSession->BlimpConnection message routing. 40 // Gets a processor for BrowserSession->BlimpConnection message routing.
41 scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const; 41 scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const;
42 42
43 private: 43 private:
44 scoped_ptr<PacketReader> reader_; 44 scoped_ptr<PacketReader> reader_;
45 scoped_ptr<PacketWriter> writer_; 45 scoped_ptr<PacketWriter> writer_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); 47 DISALLOW_COPY_AND_ASSIGN(BlimpConnection);
48 }; 48 };
49 49
50 } // namespace blimp 50 } // namespace blimp
51 51
52 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ 52 #endif // BLIMP_NET_BLIMP_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | blimp/net/stream_socket_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698