OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.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 net { | 18 namespace net { |
19 class IPEndPoint; | 19 class IPEndPoint; |
20 } // namespace net | 20 } // namespace net |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
25 class ClientStub; | 25 class ClientStub; |
| 26 class ClipboardStub; |
26 class HostStub; | 27 class HostStub; |
27 class InputStub; | 28 class InputStub; |
28 class HostControlDispatcher; | 29 class HostControlDispatcher; |
29 class HostEventDispatcher; | 30 class HostEventDispatcher; |
30 | 31 |
31 // This class represents a remote viewer connection to the chromoting | 32 // This class represents a remote viewer connection to the chromoting |
32 // host. It sets up all protocol channels and connects them to the | 33 // host. It sets up all protocol channels and connects them to the |
33 // stubs. | 34 // stubs. |
34 class ConnectionToClient : public base::NonThreadSafe { | 35 class ConnectionToClient : public base::NonThreadSafe { |
35 public: | 36 public: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Update the sequence number when received from the client. EventHandler | 78 // Update the sequence number when received from the client. EventHandler |
78 // will be called. | 79 // will be called. |
79 virtual void UpdateSequenceNumber(int64 sequence_number); | 80 virtual void UpdateSequenceNumber(int64 sequence_number); |
80 | 81 |
81 // Send encoded update stream data to the viewer. | 82 // Send encoded update stream data to the viewer. |
82 virtual VideoStub* video_stub(); | 83 virtual VideoStub* video_stub(); |
83 | 84 |
84 // Return pointer to ClientStub. | 85 // Return pointer to ClientStub. |
85 virtual ClientStub* client_stub(); | 86 virtual ClientStub* client_stub(); |
86 | 87 |
87 // These two setters should be called before Init(). | 88 // These three setters should be called before Init(). |
| 89 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub); |
88 virtual void set_host_stub(HostStub* host_stub); | 90 virtual void set_host_stub(HostStub* host_stub); |
89 virtual void set_input_stub(InputStub* input_stub); | 91 virtual void set_input_stub(InputStub* input_stub); |
90 | 92 |
91 private: | 93 private: |
92 // Callback for protocol Session. | 94 // Callback for protocol Session. |
93 void OnSessionStateChange(Session::State state); | 95 void OnSessionStateChange(Session::State state); |
94 | 96 |
95 void OnSessionRouteChange(const std::string& channel_name, | 97 void OnSessionRouteChange(const std::string& channel_name, |
96 const net::IPEndPoint& remote_end_point, | 98 const net::IPEndPoint& remote_end_point, |
97 const net::IPEndPoint& local_end_point); | 99 const net::IPEndPoint& local_end_point); |
98 | 100 |
99 // Callback for channel initialization. | 101 // Callback for channel initialization. |
100 void OnChannelInitialized(bool successful); | 102 void OnChannelInitialized(bool successful); |
101 | 103 |
102 void NotifyIfChannelsReady(); | 104 void NotifyIfChannelsReady(); |
103 | 105 |
104 void CloseOnError(); | 106 void CloseOnError(); |
105 | 107 |
106 // Stops writing in the channels. | 108 // Stops writing in the channels. |
107 void CloseChannels(); | 109 void CloseChannels(); |
108 | 110 |
109 // Event handler for handling events sent from this object. | 111 // Event handler for handling events sent from this object. |
110 EventHandler* handler_; | 112 EventHandler* handler_; |
111 | 113 |
112 // Stubs that are called for incoming messages. | 114 // Stubs that are called for incoming messages. |
| 115 ClipboardStub* clipboard_stub_; |
113 HostStub* host_stub_; | 116 HostStub* host_stub_; |
114 InputStub* input_stub_; | 117 InputStub* input_stub_; |
115 | 118 |
116 // The libjingle channel used to send and receive data from the remote client. | 119 // The libjingle channel used to send and receive data from the remote client. |
117 scoped_ptr<Session> session_; | 120 scoped_ptr<Session> session_; |
118 | 121 |
119 scoped_ptr<HostControlDispatcher> control_dispatcher_; | 122 scoped_ptr<HostControlDispatcher> control_dispatcher_; |
120 scoped_ptr<HostEventDispatcher> event_dispatcher_; | 123 scoped_ptr<HostEventDispatcher> event_dispatcher_; |
121 scoped_ptr<VideoWriter> video_writer_; | 124 scoped_ptr<VideoWriter> video_writer_; |
122 | 125 |
123 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 126 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
124 }; | 127 }; |
125 | 128 |
126 } // namespace protocol | 129 } // namespace protocol |
127 } // namespace remoting | 130 } // namespace remoting |
128 | 131 |
129 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 132 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |