| 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/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 20 matching lines...) Expand all Loading... |
| 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 } | 33 } |
| 34 | 34 |
| 35 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { | 35 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { |
| 36 ControlMessage message; | 36 ControlMessage message; |
| 37 message.mutable_clipboard_event()->CopyFrom(event); | 37 message.mutable_clipboard_event()->CopyFrom(event); |
| 38 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 38 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void HostControlDispatcher::SetCursorShape( |
| 42 const CursorShapeInfo& cursor_shape) { |
| 43 ControlMessage message; |
| 44 message.mutable_cursor_shape()->CopyFrom(cursor_shape); |
| 45 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 46 } |
| 47 |
| 41 void HostControlDispatcher::OnMessageReceived( | 48 void HostControlDispatcher::OnMessageReceived( |
| 42 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { | 49 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { |
| 43 DCHECK(clipboard_stub_); | 50 DCHECK(clipboard_stub_); |
| 44 DCHECK(host_stub_); | 51 DCHECK(host_stub_); |
| 45 | 52 |
| 46 base::ScopedClosureRunner done_runner(done_task); | 53 base::ScopedClosureRunner done_runner(done_task); |
| 47 | 54 |
| 48 if (message->has_clipboard_event()) { | 55 if (message->has_clipboard_event()) { |
| 49 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 56 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
| 50 } else if (message->has_client_dimensions()) { | 57 } else if (message->has_client_dimensions()) { |
| 51 host_stub_->NotifyClientDimensions(message->client_dimensions()); | 58 host_stub_->NotifyClientDimensions(message->client_dimensions()); |
| 52 } else if (message->has_video_control()) { | 59 } else if (message->has_video_control()) { |
| 53 host_stub_->ControlVideo(message->video_control()); | 60 host_stub_->ControlVideo(message->video_control()); |
| 54 } else { | 61 } else { |
| 55 LOG(WARNING) << "Unknown control message received."; | 62 LOG(WARNING) << "Unknown control message received."; |
| 56 } | 63 } |
| 57 } | 64 } |
| 58 | 65 |
| 59 } // namespace protocol | 66 } // namespace protocol |
| 60 } // namespace remoting | 67 } // namespace remoting |
| OLD | NEW |