| 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_HOST_CLIENT_CONNECTION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_CONNECTION_H_ |
| 6 #define REMOTING_HOST_CLIENT_CONNECTION_H_ | 6 #define REMOTING_HOST_CLIENT_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "remoting/proto/internal.pb.h" | 14 #include "remoting/proto/internal.pb.h" |
| 15 #include "remoting/protocol/chromotocol_connection.h" | 15 #include "remoting/protocol/chromotocol_connection.h" |
| 16 #include "remoting/protocol/stream_reader.h" | 16 #include "remoting/protocol/message_reader.h" |
| 17 #include "remoting/protocol/stream_writer.h" | 17 #include "remoting/protocol/stream_writer.h" |
| 18 | 18 |
| 19 namespace remoting { | 19 namespace remoting { |
| 20 | 20 |
| 21 // This class represents a remote viewer connected to the chromoting host | 21 // This class represents a remote viewer connected to the chromoting host |
| 22 // through a libjingle connection. A viewer object is responsible for sending | 22 // through a libjingle connection. A viewer object is responsible for sending |
| 23 // screen updates and other messages to the remote viewer. It is also | 23 // screen updates and other messages to the remote viewer. It is also |
| 24 // responsible for receiving and parsing data from the remote viewer and | 24 // responsible for receiving and parsing data from the remote viewer and |
| 25 // delegating events to the event handler. | 25 // delegating events to the event handler. |
| 26 class ClientConnection : public base::RefCountedThreadSafe<ClientConnection> { | 26 class ClientConnection : public base::RefCountedThreadSafe<ClientConnection> { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 virtual void Disconnect(); | 80 virtual void Disconnect(); |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 // Protected constructor used by unit test. | 83 // Protected constructor used by unit test. |
| 84 ClientConnection(); | 84 ClientConnection(); |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // Callback for ChromotocolConnection. | 87 // Callback for ChromotocolConnection. |
| 88 void OnConnectionStateChange(ChromotocolConnection::State state); | 88 void OnConnectionStateChange(ChromotocolConnection::State state); |
| 89 | 89 |
| 90 // Callback for EventsStreamReader. | 90 // Callback for MessageReader. |
| 91 void OnMessageReceived(ChromotingClientMessage* message); | 91 void OnMessageReceived(ChromotingClientMessage* message); |
| 92 | 92 |
| 93 // Process a libjingle state change event on the |loop_|. | 93 // Process a libjingle state change event on the |loop_|. |
| 94 void StateChangeTask(ChromotocolConnection::State state); | 94 void StateChangeTask(ChromotocolConnection::State state); |
| 95 | 95 |
| 96 // Process a data buffer received from libjingle. | 96 // Process a data buffer received from libjingle. |
| 97 void MessageReceivedTask(ChromotingClientMessage* message); | 97 void MessageReceivedTask(ChromotingClientMessage* message); |
| 98 | 98 |
| 99 void OnClosed(); | 99 void OnClosed(); |
| 100 | 100 |
| 101 // The libjingle channel used to send and receive data from the remote client. | 101 // The libjingle channel used to send and receive data from the remote client. |
| 102 scoped_refptr<ChromotocolConnection> connection_; | 102 scoped_refptr<ChromotocolConnection> connection_; |
| 103 | 103 |
| 104 EventStreamReader event_reader_; | 104 MessageReader event_reader_; |
| 105 VideoStreamWriter video_writer_; | 105 VideoStreamWriter video_writer_; |
| 106 | 106 |
| 107 // The message loop that this object runs on. | 107 // The message loop that this object runs on. |
| 108 MessageLoop* loop_; | 108 MessageLoop* loop_; |
| 109 | 109 |
| 110 // Event handler for handling events sent from this object. | 110 // Event handler for handling events sent from this object. |
| 111 EventHandler* handler_; | 111 EventHandler* handler_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(ClientConnection); | 113 DISALLOW_COPY_AND_ASSIGN(ClientConnection); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace remoting | 116 } // namespace remoting |
| 117 | 117 |
| 118 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ | 118 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ |
| OLD | NEW |