| OLD | NEW |
| 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 "blimp/net/blimp_net_export.h" | 10 #include "blimp/net/blimp_net_export.h" |
| 10 | 11 |
| 11 namespace blimp { | 12 namespace blimp { |
| 12 | 13 |
| 14 class BlimpMessageProcessor; |
| 15 |
| 16 // Encapsulates the state and logic used to exchange BlimpMessages over |
| 17 // a network connection. |
| 13 class BLIMP_NET_EXPORT BlimpConnection { | 18 class BLIMP_NET_EXPORT BlimpConnection { |
| 14 public: | 19 public: |
| 20 class DisconnectObserver { |
| 21 // Called when the network connection for |this| is disconnected. |
| 22 virtual void OnDisconnected() = 0; |
| 23 }; |
| 24 |
| 15 BlimpConnection(); | 25 BlimpConnection(); |
| 26 |
| 16 ~BlimpConnection(); | 27 ~BlimpConnection(); |
| 17 | 28 |
| 29 // Lets |observer| know when the network connection is terminated. |
| 30 void AddDisconnectObserver(const DisconnectObserver& observer); |
| 31 |
| 32 // Sets the processor for BlimpConnection->BrowserSession message routing. |
| 33 // Will discontinue use of any previously set message processors. |
| 34 void set_incoming_message_processor( |
| 35 scoped_ptr<BlimpMessageProcessor> processor); |
| 36 |
| 37 // Gets a processor for BrowserSession->BlimpConnection message routing. |
| 38 scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const; |
| 39 |
| 18 private: | 40 private: |
| 19 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); | 41 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); |
| 20 }; | 42 }; |
| 21 | 43 |
| 22 } // namespace blimp | 44 } // namespace blimp |
| 23 | 45 |
| 24 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ | 46 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ |
| OLD | NEW |