| 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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "net/socket/stream_socket.h" | 8 #include "net/socket/stream_socket.h" |
| 9 #include "remoting/base/compound_buffer.h" | 9 #include "remoting/base/compound_buffer.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 void HostControlDispatcher::SetCursorShape( | 58 void HostControlDispatcher::SetCursorShape( |
| 59 const CursorShapeInfo& cursor_shape) { | 59 const CursorShapeInfo& cursor_shape) { |
| 60 ControlMessage message; | 60 ControlMessage message; |
| 61 message.mutable_cursor_shape()->CopyFrom(cursor_shape); | 61 message.mutable_cursor_shape()->CopyFrom(cursor_shape); |
| 62 message_pipe()->Send(&message, base::Closure()); | 62 message_pipe()->Send(&message, base::Closure()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void HostControlDispatcher::OnIncomingMessage( | 65 void HostControlDispatcher::OnIncomingMessage( |
| 66 scoped_ptr<CompoundBuffer> buffer) { | 66 std::unique_ptr<CompoundBuffer> buffer) { |
| 67 DCHECK(clipboard_stub_); | 67 DCHECK(clipboard_stub_); |
| 68 DCHECK(host_stub_); | 68 DCHECK(host_stub_); |
| 69 | 69 |
| 70 scoped_ptr<ControlMessage> message = | 70 std::unique_ptr<ControlMessage> message = |
| 71 ParseMessage<ControlMessage>(buffer.get()); | 71 ParseMessage<ControlMessage>(buffer.get()); |
| 72 if (!message) | 72 if (!message) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 if (message->has_clipboard_event()) { | 75 if (message->has_clipboard_event()) { |
| 76 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 76 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
| 77 } else if (message->has_client_resolution()) { | 77 } else if (message->has_client_resolution()) { |
| 78 host_stub_->NotifyClientResolution(message->client_resolution()); | 78 host_stub_->NotifyClientResolution(message->client_resolution()); |
| 79 } else if (message->has_video_control()) { | 79 } else if (message->has_video_control()) { |
| 80 host_stub_->ControlVideo(message->video_control()); | 80 host_stub_->ControlVideo(message->video_control()); |
| 81 } else if (message->has_audio_control()) { | 81 } else if (message->has_audio_control()) { |
| 82 host_stub_->ControlAudio(message->audio_control()); | 82 host_stub_->ControlAudio(message->audio_control()); |
| 83 } else if (message->has_capabilities()) { | 83 } else if (message->has_capabilities()) { |
| 84 host_stub_->SetCapabilities(message->capabilities()); | 84 host_stub_->SetCapabilities(message->capabilities()); |
| 85 } else if (message->has_pairing_request()) { | 85 } else if (message->has_pairing_request()) { |
| 86 host_stub_->RequestPairing(message->pairing_request()); | 86 host_stub_->RequestPairing(message->pairing_request()); |
| 87 } else if (message->has_extension_message()) { | 87 } else if (message->has_extension_message()) { |
| 88 host_stub_->DeliverClientMessage(message->extension_message()); | 88 host_stub_->DeliverClientMessage(message->extension_message()); |
| 89 } else { | 89 } else { |
| 90 LOG(WARNING) << "Unknown control message received."; | 90 LOG(WARNING) << "Unknown control message received."; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace protocol | 94 } // namespace protocol |
| 95 } // namespace remoting | 95 } // namespace remoting |
| OLD | NEW |