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" | |
14 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
15 #include "remoting/protocol/session.h" | 14 #include "remoting/protocol/session.h" |
16 #include "remoting/protocol/video_writer.h" | 15 #include "remoting/protocol/video_writer.h" |
17 | 16 |
| 17 namespace base { |
| 18 class MessageLoopProxy; |
| 19 } // namespace base |
| 20 |
18 namespace remoting { | 21 namespace remoting { |
19 namespace protocol { | 22 namespace protocol { |
20 | 23 |
21 class ClientControlSender; | 24 class ClientControlSender; |
22 class ClientStub; | 25 class ClientStub; |
23 class HostStub; | 26 class HostStub; |
24 class InputStub; | 27 class InputStub; |
25 class HostMessageDispatcher; | 28 class HostMessageDispatcher; |
26 | 29 |
27 // This class represents a remote viewer connected to the chromoting host | 30 // This class represents a remote viewer connected to the chromoting host |
(...skipping 19 matching lines...) Expand all Loading... |
47 | 50 |
48 // Called when sequence number is updated. | 51 // Called when sequence number is updated. |
49 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, | 52 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, |
50 int64 sequence_number) = 0; | 53 int64 sequence_number) = 0; |
51 }; | 54 }; |
52 | 55 |
53 // Constructs a ConnectionToClient object. |message_loop| is the message loop | 56 // Constructs a ConnectionToClient object. |message_loop| is the message loop |
54 // that this object runs on. A viewer object receives events and messages from | 57 // that this object runs on. A viewer object receives events and messages from |
55 // a libjingle channel, these events are delegated to |handler|. | 58 // a libjingle channel, these events are delegated to |handler|. |
56 // It is guaranteed that |handler| is called only on the |message_loop|. | 59 // It is guaranteed that |handler| is called only on the |message_loop|. |
57 ConnectionToClient(MessageLoop* message_loop, | 60 ConnectionToClient(base::MessageLoopProxy* message_loop, |
58 EventHandler* handler); | 61 EventHandler* handler); |
59 | 62 |
60 virtual void Init(Session* session); | 63 virtual void Init(Session* session); |
61 | 64 |
62 // Returns the connection in use. | 65 // Returns the connection in use. |
63 virtual Session* session(); | 66 virtual Session* session(); |
64 | 67 |
65 // Disconnect the client connection. This method is allowed to be called | 68 // Disconnect the client connection. This method is allowed to be called |
66 // more than once and calls after the first one will be ignored. | 69 // more than once and calls after the first one will be ignored. |
67 // | 70 // |
(...skipping 26 matching lines...) Expand all Loading... |
94 void OnVideoInitialized(bool successful); | 97 void OnVideoInitialized(bool successful); |
95 | 98 |
96 void NotifyIfChannelsReady(); | 99 void NotifyIfChannelsReady(); |
97 | 100 |
98 void CloseOnError(); | 101 void CloseOnError(); |
99 | 102 |
100 // Stops writing in the channels. | 103 // Stops writing in the channels. |
101 void CloseChannels(); | 104 void CloseChannels(); |
102 | 105 |
103 // The message loop that this object runs on. | 106 // The message loop that this object runs on. |
104 MessageLoop* loop_; | 107 scoped_refptr<base::MessageLoopProxy> message_loop_; |
105 | 108 |
106 // Event handler for handling events sent from this object. | 109 // Event handler for handling events sent from this object. |
107 EventHandler* handler_; | 110 EventHandler* handler_; |
108 | 111 |
109 // Stubs that are called for incoming messages. | 112 // Stubs that are called for incoming messages. |
110 HostStub* host_stub_; | 113 HostStub* host_stub_; |
111 InputStub* input_stub_; | 114 InputStub* input_stub_; |
112 | 115 |
113 // The libjingle channel used to send and receive data from the remote client. | 116 // The libjingle channel used to send and receive data from the remote client. |
114 scoped_ptr<Session> session_; | 117 scoped_ptr<Session> session_; |
(...skipping 10 matching lines...) Expand all Loading... |
125 bool input_connected_; | 128 bool input_connected_; |
126 bool video_connected_; | 129 bool video_connected_; |
127 | 130 |
128 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 131 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
129 }; | 132 }; |
130 | 133 |
131 } // namespace protocol | 134 } // namespace protocol |
132 } // namespace remoting | 135 } // namespace remoting |
133 | 136 |
134 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 137 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |