| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This stub is thread safe because of the use of BufferedSocketWriter. | |
| 6 // BufferedSocketWriter buffers messages and send them on them right thread. | |
| 7 | |
| 8 #include "remoting/protocol/client_control_sender.h" | |
| 9 | |
| 10 #include "base/task.h" | |
| 11 #include "remoting/protocol/buffered_socket_writer.h" | |
| 12 #include "remoting/proto/control.pb.h" | |
| 13 #include "remoting/proto/internal.pb.h" | |
| 14 #include "remoting/protocol/util.h" | |
| 15 | |
| 16 namespace remoting { | |
| 17 namespace protocol { | |
| 18 | |
| 19 ClientControlSender::ClientControlSender(base::MessageLoopProxy* message_loop, | |
| 20 net::Socket* socket) | |
| 21 : buffered_writer_(new BufferedSocketWriter(message_loop)) { | |
| 22 buffered_writer_->Init(socket, BufferedSocketWriter::WriteFailedCallback()); | |
| 23 | |
| 24 // Write legacy BeginSession message. | |
| 25 protocol::ControlMessage message; | |
| 26 message.mutable_begin_session_deprecated()->mutable_login_status()-> | |
| 27 set_success(true); | |
| 28 buffered_writer_->Write(SerializeAndFrameMessage(message), base::Closure()); | |
| 29 } | |
| 30 | |
| 31 ClientControlSender::~ClientControlSender() { | |
| 32 } | |
| 33 | |
| 34 | |
| 35 void ClientControlSender::Close() { | |
| 36 buffered_writer_->Close(); | |
| 37 } | |
| 38 | |
| 39 } // namespace protocol | |
| 40 } // namespace remoting | |
| OLD | NEW |