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 #include "base/memory/ref_counted.h" | |
6 #include "net/base/io_buffer.h" | |
7 #include "remoting/proto/control.pb.h" | |
8 #include "remoting/proto/event.pb.h" | |
9 #include "remoting/proto/internal.pb.h" | |
10 #include "remoting/protocol/client_message_dispatcher.h" | |
11 #include "remoting/protocol/client_stub.h" | |
12 #include "remoting/protocol/input_stub.h" | |
13 #include "remoting/protocol/message_reader.h" | |
14 #include "remoting/protocol/session.h" | |
15 | |
16 namespace remoting { | |
17 namespace protocol { | |
18 | |
19 ClientMessageDispatcher::ClientMessageDispatcher() : client_stub_(NULL) { | |
20 } | |
21 | |
22 ClientMessageDispatcher::~ClientMessageDispatcher() { | |
23 } | |
24 | |
25 void ClientMessageDispatcher::Initialize( | |
26 protocol::Session* session, ClientStub* client_stub) { | |
27 if (!session || !client_stub || !session->control_channel()) { | |
28 return; | |
29 } | |
30 | |
31 control_message_reader_.reset(new ProtobufMessageReader<ControlMessage>()); | |
32 client_stub_ = client_stub; | |
33 | |
34 control_message_reader_->Init( | |
35 session->control_channel(), | |
36 base::Bind(&ClientMessageDispatcher::OnControlMessageReceived, | |
37 base::Unretained(this))); | |
38 return; | |
39 } | |
40 | |
41 void ClientMessageDispatcher::OnControlMessageReceived( | |
42 ControlMessage* message, const base::Closure& done_task) { | |
43 | |
44 LOG(WARNING) << "Invalid control message received."; | |
45 done_task.Run(); | |
46 } | |
47 | |
48 } // namespace protocol | |
49 } // namespace remoting | |
OLD | NEW |