| 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 #include "remoting/protocol/connection_to_client.h" | 5 #include "remoting/protocol/connection_to_client.h" |
| 6 | 6 |
| 7 #include "google/protobuf/message.h" | 7 #include "google/protobuf/message.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "remoting/protocol/util.h" | 9 #include "remoting/protocol/util.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 session_ = session; | 37 session_ = session; |
| 38 session_->SetStateChangeCallback( | 38 session_->SetStateChangeCallback( |
| 39 NewCallback(this, &ConnectionToClient::OnSessionStateChange)); | 39 NewCallback(this, &ConnectionToClient::OnSessionStateChange)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 protocol::Session* ConnectionToClient::session() { | 42 protocol::Session* ConnectionToClient::session() { |
| 43 return session_; | 43 return session_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ConnectionToClient::SendInitClientMessage(int width, int height) { | |
| 47 DCHECK_EQ(loop_, MessageLoop::current()); | |
| 48 | |
| 49 // If we are disconnected then return. | |
| 50 if (!session_) | |
| 51 return; | |
| 52 | |
| 53 ChromotingHostMessage msg; | |
| 54 msg.mutable_init_client()->set_width(width); | |
| 55 msg.mutable_init_client()->set_height(height); | |
| 56 DCHECK(msg.IsInitialized()); | |
| 57 control_writer_.SendMessage(msg); | |
| 58 } | |
| 59 | |
| 60 void ConnectionToClient::SendVideoPacket(const VideoPacket& packet) { | 46 void ConnectionToClient::SendVideoPacket(const VideoPacket& packet) { |
| 61 DCHECK_EQ(loop_, MessageLoop::current()); | 47 DCHECK_EQ(loop_, MessageLoop::current()); |
| 62 | 48 |
| 63 // If we are disconnected then return. | 49 // If we are disconnected then return. |
| 64 if (!session_) | 50 if (!session_) |
| 65 return; | 51 return; |
| 66 | 52 |
| 67 video_writer_->SendPacket(packet); | 53 video_writer_->SendPacket(packet); |
| 68 } | 54 } |
| 69 | 55 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 DCHECK(handler_); | 119 DCHECK(handler_); |
| 134 handler_->HandleMessage(this, message); | 120 handler_->HandleMessage(this, message); |
| 135 } | 121 } |
| 136 | 122 |
| 137 // OnClosed() is used as a callback for protocol::Session::Close(). | 123 // OnClosed() is used as a callback for protocol::Session::Close(). |
| 138 void ConnectionToClient::OnClosed() { | 124 void ConnectionToClient::OnClosed() { |
| 139 } | 125 } |
| 140 | 126 |
| 141 } // namespace protocol | 127 } // namespace protocol |
| 142 } // namespace remoting | 128 } // namespace remoting |
| OLD | NEW |