Index: blimp/net/blimp_connection.h |
diff --git a/blimp/net/blimp_connection.h b/blimp/net/blimp_connection.h |
index 5bd115d6fe71c46c8d203bc2ad9590184c6e953c..8e3cf50bd5a7ea5c7dad8928aced6c6f981d9529 100644 |
--- a/blimp/net/blimp_connection.h |
+++ b/blimp/net/blimp_connection.h |
@@ -11,17 +11,36 @@ |
namespace blimp { |
+class BlimpMessageProcessor; |
class PacketReader; |
class PacketWriter; |
+ |
Wez
2015/11/12 03:45:56
nit: Remove spurious blank line.
Kevin M
2015/11/12 19:03:47
Done.
|
+// Encapsulates the state and logic used to exchange BlimpMessages over |
+// a network connection. |
class BLIMP_NET_EXPORT BlimpConnection { |
public: |
- virtual ~BlimpConnection(); |
+ class DisconnectObserver { |
+ // Called when the network connection for |this| is disconnected. |
+ virtual void OnDisconnected() = 0; |
+ }; |
- protected: |
BlimpConnection(scoped_ptr<PacketReader> reader, |
scoped_ptr<PacketWriter> writer); |
+ ~BlimpConnection(); |
+ |
+ // Lets |observer| know when the network connection is terminated. |
+ void AddDisconnectObserver(DisconnectObserver* observer); |
+ |
+ // Sets the processor which will take incoming messages for this connection. |
+ // Can be set multiple times, but previously set processors are discarded. |
+ void set_incoming_message_processor( |
+ scoped_ptr<BlimpMessageProcessor> processor); |
+ |
+ // Gets a processor for BrowserSession->BlimpConnection message routing. |
+ scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const; |
+ |
private: |
scoped_ptr<PacketReader> reader_; |
scoped_ptr<PacketWriter> writer_; |