| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "remoting/protocol/session.h" | 15 #include "remoting/protocol/session.h" |
| 16 #include "remoting/protocol/video_writer.h" | 16 #include "remoting/protocol/video_writer.h" |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 namespace protocol { | 19 namespace protocol { |
| 20 | 20 |
| 21 class ClientControlSender; |
| 21 class ClientStub; | 22 class ClientStub; |
| 22 class HostStub; | 23 class HostStub; |
| 23 class InputStub; | 24 class InputStub; |
| 24 class HostMessageDispatcher; | 25 class HostMessageDispatcher; |
| 25 | 26 |
| 26 // This class represents a remote viewer connected to the chromoting host | 27 // This class represents a remote viewer connected to the chromoting host |
| 27 // through a libjingle connection. A viewer object is responsible for sending | 28 // through a libjingle connection. A viewer object is responsible for sending |
| 28 // screen updates and other messages to the remote viewer. It is also | 29 // screen updates and other messages to the remote viewer. It is also |
| 29 // responsible for receiving and parsing data from the remote viewer and | 30 // responsible for receiving and parsing data from the remote viewer and |
| 30 // delegating events to the event handler. | 31 // delegating events to the event handler. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void set_input_stub(InputStub* input_stub); | 83 virtual void set_input_stub(InputStub* input_stub); |
| 83 | 84 |
| 84 protected: | 85 protected: |
| 85 friend class base::RefCountedThreadSafe<ConnectionToClient>; | 86 friend class base::RefCountedThreadSafe<ConnectionToClient>; |
| 86 virtual ~ConnectionToClient(); | 87 virtual ~ConnectionToClient(); |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 // Callback for protocol Session. | 90 // Callback for protocol Session. |
| 90 void OnSessionStateChange(Session::State state); | 91 void OnSessionStateChange(Session::State state); |
| 91 | 92 |
| 92 // Process a libjingle state change event on the |loop_|. | 93 // Stops writing in the channels. |
| 93 void StateChangeTask(Session::State state); | 94 void CloseChannels(); |
| 94 | 95 |
| 95 void OnClosed(); | 96 void OnClosed(); |
| 96 | 97 |
| 97 // The libjingle channel used to send and receive data from the remote client. | 98 // The libjingle channel used to send and receive data from the remote client. |
| 98 scoped_refptr<Session> session_; | 99 scoped_refptr<Session> session_; |
| 99 | 100 |
| 100 scoped_ptr<VideoWriter> video_writer_; | 101 scoped_ptr<VideoWriter> video_writer_; |
| 101 | 102 |
| 102 // ClientStub for sending messages to the client. | 103 // ClientStub for sending messages to the client. |
| 103 scoped_ptr<ClientStub> client_stub_; | 104 scoped_ptr<ClientControlSender> client_control_sender_; |
| 104 | 105 |
| 105 // The message loop that this object runs on. | 106 // The message loop that this object runs on. |
| 106 MessageLoop* loop_; | 107 MessageLoop* loop_; |
| 107 | 108 |
| 108 // Event handler for handling events sent from this object. | 109 // Event handler for handling events sent from this object. |
| 109 EventHandler* handler_; | 110 EventHandler* handler_; |
| 110 | 111 |
| 111 // HostStub for receiving control events from the client. | 112 // HostStub for receiving control events from the client. |
| 112 HostStub* host_stub_; | 113 HostStub* host_stub_; |
| 113 | 114 |
| 114 // InputStub for receiving input events from the client. | 115 // InputStub for receiving input events from the client. |
| 115 InputStub* input_stub_; | 116 InputStub* input_stub_; |
| 116 | 117 |
| 117 // Dispatcher for submitting messages to stubs. | 118 // Dispatcher for submitting messages to stubs. |
| 118 scoped_ptr<HostMessageDispatcher> dispatcher_; | 119 scoped_ptr<HostMessageDispatcher> dispatcher_; |
| 119 | 120 |
| 120 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 121 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 } // namespace protocol | 124 } // namespace protocol |
| 124 } // namespace remoting | 125 } // namespace remoting |
| 125 | 126 |
| 126 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 127 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| OLD | NEW |