Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: remoting/protocol/host_control_dispatcher.cc

Issue 8468022: Refactor channel dispatchers on the host side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "remoting/protocol/host_control_dispatcher.h"
6
7 #include "base/message_loop_proxy.h"
8 #include "remoting/proto/control.pb.h"
9 #include "remoting/proto/internal.pb.h"
10 #include "remoting/protocol/buffered_socket_writer.h"
11 #include "remoting/protocol/host_stub.h"
12 #include "remoting/protocol/session.h"
13 #include "remoting/protocol/util.h"
14
15 namespace remoting {
16 namespace protocol {
17
18 HostControlDispatcher::HostControlDispatcher()
19 : host_stub_(NULL),
20 writer_(new BufferedSocketWriter(base::MessageLoopProxy::current())) {
21 }
22
23 HostControlDispatcher::~HostControlDispatcher() {
24 writer_->Close();
25 }
26
27 void HostControlDispatcher::Init(Session* session) {
28 DCHECK(session);
29
30 reader_.Init(session->control_channel(), base::Bind(
31 &HostControlDispatcher::OnMessageReceived, base::Unretained(this)));
32 writer_->Init(session->control_channel(),
33 BufferedSocketWriter::WriteFailedCallback());
34
35 // Write legacy BeginSession message.
36 // TODO(sergeyu): Remove it. See http://crbug.com/104670 .
37 protocol::ControlMessage message;
38 message.mutable_begin_session_deprecated()->mutable_login_status()->
39 set_success(true);
40 writer_->Write(SerializeAndFrameMessage(message), base::Closure());
41 }
42
43 void HostControlDispatcher::OnMessageReceived(
44 ControlMessage* message, const base::Closure& done_task) {
45 DCHECK(host_stub_);
46 LOG(WARNING) << "Unknown control message received.";
47 done_task.Run();
48 }
49
50 } // namespace protocol
51 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698