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 #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" |
(...skipping 12 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()); | |
40 } | 33 } |
41 | 34 |
42 void HostControlDispatcher::OnMessageReceived( | 35 void HostControlDispatcher::OnMessageReceived( |
43 ControlMessage* message, const base::Closure& done_task) { | 36 ControlMessage* message, const base::Closure& done_task) { |
44 DCHECK(host_stub_); | 37 DCHECK(host_stub_); |
45 LOG(WARNING) << "Unknown control message received."; | 38 LOG(WARNING) << "Unknown control message received."; |
46 done_task.Run(); | 39 done_task.Run(); |
47 } | 40 } |
48 | 41 |
49 } // namespace protocol | 42 } // namespace protocol |
50 } // namespace remoting | 43 } // namespace remoting |
OLD | NEW |