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 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Constructs a ClientConnection object. |message_loop| is the message loop | 55 // Constructs a ClientConnection object. |message_loop| is the message loop |
56 // that this object runs on. A viewer object receives events and messages from | 56 // that this object runs on. A viewer object receives events and messages from |
57 // a libjingle channel, these events are delegated to |handler|. | 57 // a libjingle channel, these events are delegated to |handler|. |
58 // It is guranteed that |handler| is called only on the |message_loop|. | 58 // It is guranteed that |handler| is called only on the |message_loop|. |
59 ClientConnection(MessageLoop* message_loop, | 59 ClientConnection(MessageLoop* message_loop, |
60 ProtocolDecoder* decoder, | 60 ProtocolDecoder* decoder, |
61 EventHandler* handler); | 61 EventHandler* handler); |
62 | 62 |
63 virtual ~ClientConnection(); | 63 virtual ~ClientConnection(); |
64 | 64 |
65 // Creates a DataBuffer object that wraps around HostMessage. The DataBuffer | 65 // Creates a DataBuffer object that wraps around ChromotingHostMessage. The |
66 // object will be responsible for serializing and framing the message. | 66 // DataBuffer object will be responsible for serializing and framing the |
67 // DataBuffer will also own |msg| after this call. | 67 // message. DataBuffer will also own |msg| after this call. |
68 static scoped_refptr<media::DataBuffer> CreateWireFormatDataBuffer( | 68 static scoped_refptr<media::DataBuffer> CreateWireFormatDataBuffer( |
69 const HostMessage* msg); | 69 const ChromotingHostMessage* msg); |
70 | 70 |
71 virtual void set_jingle_channel(JingleChannel* channel) { | 71 virtual void set_jingle_channel(JingleChannel* channel) { |
72 channel_ = channel; | 72 channel_ = channel; |
73 } | 73 } |
74 | 74 |
75 // Returns the channel in use. | 75 // Returns the channel in use. |
76 virtual JingleChannel* jingle_channel() { return channel_; } | 76 virtual JingleChannel* jingle_channel() { return channel_; } |
77 | 77 |
78 // Send information to the client for initialization. | 78 // Send information to the client for initialization. |
79 virtual void SendInitClientMessage(int width, int height); | 79 virtual void SendInitClientMessage(int width, int height); |
80 | 80 |
81 // Notifies the viewer the start of an update stream. | 81 // Notifies the viewer the start of an update stream. |
82 virtual void SendBeginUpdateStreamMessage(); | 82 virtual void SendBeginUpdateStreamMessage(); |
83 | 83 |
84 // Send encoded update stream data to the viewer. | 84 // Send encoded update stream data to the viewer. |
85 // | 85 // |
86 // |data| is the actual bytes in wire format. That means it is fully framed | 86 // |data| is the actual bytes in wire format. That means it is fully framed |
87 // and serialized from a HostMessage. This is a special case only for | 87 // and serialized from a ChromotingHostMessage. This is a special case only |
88 // UpdateStreamPacket to reduce the amount of memory copies. | 88 // for UpdateStreamPacket to reduce the amount of memory copies. |
89 // | 89 // |
90 // |data| should be created by calling to | 90 // |data| should be created by calling to |
91 // CreateWireFormatDataBuffer(HostMessage). | 91 // CreateWireFormatDataBuffer(ChromotingHostMessage). |
92 virtual void SendUpdateStreamPacketMessage( | 92 virtual void SendUpdateStreamPacketMessage( |
93 scoped_refptr<media::DataBuffer> data); | 93 scoped_refptr<media::DataBuffer> data); |
94 | 94 |
95 // Notifies the viewer the update stream has ended. | 95 // Notifies the viewer the update stream has ended. |
96 virtual void SendEndUpdateStreamMessage(); | 96 virtual void SendEndUpdateStreamMessage(); |
97 | 97 |
98 // Gets the number of update stream messages not yet transmitted. | 98 // Gets the number of update stream messages not yet transmitted. |
99 // Note that the value returned is an estimate using average size of the | 99 // Note that the value returned is an estimate using average size of the |
100 // most recent update streams. | 100 // most recent update streams. |
101 // TODO(hclam): Report this number accurately. | 101 // TODO(hclam): Report this number accurately. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Event handler for handling events sent from this object. | 147 // Event handler for handling events sent from this object. |
148 EventHandler* handler_; | 148 EventHandler* handler_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(ClientConnection); | 150 DISALLOW_COPY_AND_ASSIGN(ClientConnection); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace remoting | 153 } // namespace remoting |
154 | 154 |
155 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ | 155 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ |
OLD | NEW |