| 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_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // that this object runs on. A viewer object receives events and messages from | 48 // that this object runs on. A viewer object receives events and messages from |
| 49 // a libjingle channel, these events are delegated to |handler|. | 49 // a libjingle channel, these events are delegated to |handler|. |
| 50 // It is guranteed that |handler| is called only on the |message_loop|. | 50 // It is guranteed that |handler| is called only on the |message_loop|. |
| 51 ConnectionToClient(MessageLoop* message_loop, | 51 ConnectionToClient(MessageLoop* message_loop, |
| 52 EventHandler* handler, | 52 EventHandler* handler, |
| 53 HostStub* host_stub, | 53 HostStub* host_stub, |
| 54 InputStub* input_stub); | 54 InputStub* input_stub); |
| 55 | 55 |
| 56 virtual ~ConnectionToClient(); | 56 virtual ~ConnectionToClient(); |
| 57 | 57 |
| 58 virtual void Init(protocol::Session* session); | 58 virtual void Init(Session* session); |
| 59 | 59 |
| 60 // Returns the connection in use. | 60 // Returns the connection in use. |
| 61 virtual protocol::Session* session(); | 61 virtual Session* session(); |
| 62 | 62 |
| 63 // Disconnect the client connection. This method is allowed to be called | 63 // Disconnect the client connection. This method is allowed to be called |
| 64 // more than once and calls after the first one will be ignored. | 64 // more than once and calls after the first one will be ignored. |
| 65 // | 65 // |
| 66 // After this method is called all the send method calls will be ignored. | 66 // After this method is called all the send method calls will be ignored. |
| 67 virtual void Disconnect(); | 67 virtual void Disconnect(); |
| 68 | 68 |
| 69 // Send encoded update stream data to the viewer. | 69 // Send encoded update stream data to the viewer. |
| 70 virtual VideoStub* video_stub(); | 70 virtual VideoStub* video_stub(); |
| 71 | 71 |
| 72 // Return pointer to ClientStub. | 72 // Return pointer to ClientStub. |
| 73 virtual ClientStub* client_stub(); | 73 virtual ClientStub* client_stub(); |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 // Protected constructor used by unit test. | 76 // Protected constructor used by unit test. |
| 77 ConnectionToClient(); | 77 ConnectionToClient(); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // Callback for protocol Session. | 80 // Callback for protocol Session. |
| 81 void OnSessionStateChange(protocol::Session::State state); | 81 void OnSessionStateChange(Session::State state); |
| 82 | 82 |
| 83 // Process a libjingle state change event on the |loop_|. | 83 // Process a libjingle state change event on the |loop_|. |
| 84 void StateChangeTask(protocol::Session::State state); | 84 void StateChangeTask(Session::State state); |
| 85 | 85 |
| 86 void OnClosed(); | 86 void OnClosed(); |
| 87 | 87 |
| 88 // The libjingle channel used to send and receive data from the remote client. | 88 // The libjingle channel used to send and receive data from the remote client. |
| 89 scoped_refptr<protocol::Session> session_; | 89 scoped_refptr<Session> session_; |
| 90 | 90 |
| 91 scoped_ptr<VideoWriter> video_writer_; | 91 scoped_ptr<VideoWriter> video_writer_; |
| 92 | 92 |
| 93 // ClientStub for sending messages to the client. | 93 // ClientStub for sending messages to the client. |
| 94 scoped_ptr<ClientStub> client_stub_; | 94 scoped_ptr<ClientStub> client_stub_; |
| 95 | 95 |
| 96 // The message loop that this object runs on. | 96 // The message loop that this object runs on. |
| 97 MessageLoop* loop_; | 97 MessageLoop* loop_; |
| 98 | 98 |
| 99 // Event handler for handling events sent from this object. | 99 // Event handler for handling events sent from this object. |
| 100 EventHandler* handler_; | 100 EventHandler* handler_; |
| 101 | 101 |
| 102 // HostStub for receiving control events from the client. | 102 // HostStub for receiving control events from the client. |
| 103 HostStub* host_stub_; | 103 HostStub* host_stub_; |
| 104 | 104 |
| 105 // InputStub for receiving input events from the client. | 105 // InputStub for receiving input events from the client. |
| 106 InputStub* input_stub_; | 106 InputStub* input_stub_; |
| 107 | 107 |
| 108 // Dispatcher for submitting messages to stubs. | 108 // Dispatcher for submitting messages to stubs. |
| 109 scoped_ptr<HostMessageDispatcher> dispatcher_; | 109 scoped_ptr<HostMessageDispatcher> dispatcher_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 111 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace protocol | 114 } // namespace protocol |
| 115 } // namespace remoting | 115 } // namespace remoting |
| 116 | 116 |
| 117 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 117 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| OLD | NEW |