OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client_control_dispatcher.h" | 5 #include "remoting/protocol/client_control_dispatcher.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
12 #include "remoting/proto/control.pb.h" | 12 #include "remoting/proto/control.pb.h" |
13 #include "remoting/proto/internal.pb.h" | 13 #include "remoting/proto/internal.pb.h" |
14 #include "remoting/protocol/buffered_socket_writer.h" | 14 #include "remoting/protocol/buffered_socket_writer.h" |
15 #include "remoting/protocol/client_stub.h" | 15 #include "remoting/protocol/client_stub.h" |
16 #include "remoting/protocol/util.h" | 16 #include "remoting/protocol/util.h" |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 namespace protocol { | 19 namespace protocol { |
20 | 20 |
21 ClientControlDispatcher::ClientControlDispatcher() | 21 ClientControlDispatcher::ClientControlDispatcher() |
22 : ChannelDispatcherBase(kControlChannelName), | 22 : ChannelDispatcherBase(kControlChannelName), |
23 client_stub_(NULL), | 23 client_stub_(NULL), |
24 clipboard_stub_(NULL), | 24 clipboard_stub_(NULL), |
Wez
2012/05/23 00:01:57
Wot no initializer?
garykac
2012/05/26 01:58:01
Done.
| |
25 writer_(new BufferedSocketWriter(base::MessageLoopProxy::current())) { | 25 writer_(new BufferedSocketWriter(base::MessageLoopProxy::current())) { |
26 } | 26 } |
27 | 27 |
28 ClientControlDispatcher::~ClientControlDispatcher() { | 28 ClientControlDispatcher::~ClientControlDispatcher() { |
29 writer_->Close(); | 29 writer_->Close(); |
30 } | 30 } |
31 | 31 |
32 void ClientControlDispatcher::OnInitialized() { | 32 void ClientControlDispatcher::OnInitialized() { |
33 // TODO(garykac): Set write failed callback. | 33 // TODO(garykac): Set write failed callback. |
34 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback()); | 34 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback()); |
(...skipping 22 matching lines...) Expand all Loading... | |
57 } | 57 } |
58 | 58 |
59 void ClientControlDispatcher::OnMessageReceived( | 59 void ClientControlDispatcher::OnMessageReceived( |
60 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { | 60 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { |
61 DCHECK(client_stub_); | 61 DCHECK(client_stub_); |
62 DCHECK(clipboard_stub_); | 62 DCHECK(clipboard_stub_); |
63 base::ScopedClosureRunner done_runner(done_task); | 63 base::ScopedClosureRunner done_runner(done_task); |
64 | 64 |
65 if (message->has_clipboard_event()) { | 65 if (message->has_clipboard_event()) { |
66 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 66 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
67 } else if (message->has_cursor_shape()) { | |
68 cursor_shape_stub_->SetCursorShape(message->cursor_shape()); | |
67 } else { | 69 } else { |
68 LOG(WARNING) << "Unknown control message received."; | 70 LOG(WARNING) << "Unknown control message received."; |
69 } | 71 } |
70 } | 72 } |
71 | 73 |
72 } // namespace protocol | 74 } // namespace protocol |
73 } // namespace remoting | 75 } // namespace remoting |
OLD | NEW |