| OLD | NEW |
| 1 // Copyright (c) 2012 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 #include "remoting/protocol/host_control_dispatcher.h" | 5 #include "remoting/protocol/host_control_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "net/socket/stream_socket.h" | 8 #include "net/socket/stream_socket.h" |
| 9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
| 10 #include "remoting/proto/control.pb.h" | 10 #include "remoting/proto/control.pb.h" |
| 11 #include "remoting/proto/internal.pb.h" | 11 #include "remoting/proto/internal.pb.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 HostControlDispatcher::~HostControlDispatcher() { | 25 HostControlDispatcher::~HostControlDispatcher() { |
| 26 writer_->Close(); | 26 writer_->Close(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void HostControlDispatcher::OnInitialized() { | 29 void HostControlDispatcher::OnInitialized() { |
| 30 reader_.Init(channel(), base::Bind( | 30 reader_.Init(channel(), base::Bind( |
| 31 &HostControlDispatcher::OnMessageReceived, base::Unretained(this))); | 31 &HostControlDispatcher::OnMessageReceived, base::Unretained(this))); |
| 32 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback()); | 32 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback()); |
| 33 |
| 34 // Write legacy BeginSession message. |
| 35 // TODO(sergeyu): Remove it. See http://crbug.com/104670 . |
| 36 protocol::ControlMessage message; |
| 37 message.mutable_begin_session_deprecated()->mutable_login_status()-> |
| 38 set_success(true); |
| 39 writer_->Write(SerializeAndFrameMessage(message), base::Closure()); |
| 33 } | 40 } |
| 34 | 41 |
| 35 void HostControlDispatcher::OnMessageReceived( | 42 void HostControlDispatcher::OnMessageReceived( |
| 36 ControlMessage* message, const base::Closure& done_task) { | 43 ControlMessage* message, const base::Closure& done_task) { |
| 37 DCHECK(host_stub_); | 44 DCHECK(host_stub_); |
| 38 LOG(WARNING) << "Unknown control message received."; | 45 LOG(WARNING) << "Unknown control message received."; |
| 39 done_task.Run(); | 46 done_task.Run(); |
| 40 } | 47 } |
| 41 | 48 |
| 42 } // namespace protocol | 49 } // namespace protocol |
| 43 } // namespace remoting | 50 } // namespace remoting |
| OLD | NEW |