| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 REMOTING_CLIENT_HOST_CONNECTION_H_ | 5 #ifndef REMOTING_CLIENT_HOST_CONNECTION_H_ |
| 6 #define REMOTING_CLIENT_HOST_CONNECTION_H_ | 6 #define REMOTING_CLIENT_HOST_CONNECTION_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "remoting/proto/internal.pb.h" | 10 #include "remoting/proto/internal.pb.h" |
| 11 #include "remoting/protocol/message_decoder.h" | 11 #include "remoting/protocol/message_decoder.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 class VideoStub; |
| 16 |
| 15 struct ClientConfig; | 17 struct ClientConfig; |
| 16 | 18 |
| 17 class HostConnection { | 19 class HostConnection { |
| 18 public: | 20 public: |
| 19 class HostEventCallback { | 21 class HostEventCallback { |
| 20 public: | 22 public: |
| 21 virtual ~HostEventCallback() {} | 23 virtual ~HostEventCallback() {} |
| 22 | 24 |
| 23 // Handles an event received by the HostConnection. Ownership of | 25 // Handles an event received by the HostConnection. Ownership of |
| 24 // the message is passed to the callee. | 26 // the message is passed to the callee. |
| 25 virtual void HandleMessage(HostConnection* conn, | 27 virtual void HandleMessage(HostConnection* conn, |
| 26 ChromotingHostMessage* message) = 0; | 28 ChromotingHostMessage* message) = 0; |
| 27 | 29 |
| 28 // Called when the network connection is opened. | 30 // Called when the network connection is opened. |
| 29 virtual void OnConnectionOpened(HostConnection* conn) = 0; | 31 virtual void OnConnectionOpened(HostConnection* conn) = 0; |
| 30 | 32 |
| 31 // Called when the network connection is closed. | 33 // Called when the network connection is closed. |
| 32 virtual void OnConnectionClosed(HostConnection* conn) = 0; | 34 virtual void OnConnectionClosed(HostConnection* conn) = 0; |
| 33 | 35 |
| 34 // Called when the network connection has failed. | 36 // Called when the network connection has failed. |
| 35 virtual void OnConnectionFailed(HostConnection* conn) = 0; | 37 virtual void OnConnectionFailed(HostConnection* conn) = 0; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 virtual ~HostConnection() {} | 40 virtual ~HostConnection() {} |
| 39 | 41 |
| 40 // TODO(ajwong): We need to generalize this API. | 42 // TODO(ajwong): We need to generalize this API. |
| 41 virtual void Connect(const ClientConfig& config, | 43 virtual void Connect(const ClientConfig& config, |
| 42 HostEventCallback* event_callback) = 0; | 44 HostEventCallback* event_callback, |
| 45 VideoStub* video_stub) = 0; |
| 43 virtual void Disconnect() = 0; | 46 virtual void Disconnect() = 0; |
| 44 | 47 |
| 45 // Send an input event to the host. | 48 // Send an input event to the host. |
| 46 virtual void SendEvent(const ChromotingClientMessage& msg) = 0; | 49 virtual void SendEvent(const ChromotingClientMessage& msg) = 0; |
| 47 | 50 |
| 48 protected: | 51 protected: |
| 49 HostConnection() {} | 52 HostConnection() {} |
| 50 | 53 |
| 51 private: | 54 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(HostConnection); | 55 DISALLOW_COPY_AND_ASSIGN(HostConnection); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 } // namespace remoting | 58 } // namespace remoting |
| 56 | 59 |
| 57 #endif // REMOTING_CLIENT_HOST_CONNECTION_H_ | 60 #endif // REMOTING_CLIENT_HOST_CONNECTION_H_ |
| OLD | NEW |