| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ClientControlDispatcher::DeliverClientMessage( | 107 void ClientControlDispatcher::DeliverClientMessage( |
| 108 const ExtensionMessage& message) { | 108 const ExtensionMessage& message) { |
| 109 ControlMessage control_message; | 109 ControlMessage control_message; |
| 110 control_message.mutable_extension_message()->CopyFrom(message); | 110 control_message.mutable_extension_message()->CopyFrom(message); |
| 111 message_pipe()->Send(&control_message, base::Closure()); | 111 message_pipe()->Send(&control_message, base::Closure()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ClientControlDispatcher::OnIncomingMessage( | 114 void ClientControlDispatcher::OnIncomingMessage( |
| 115 scoped_ptr<CompoundBuffer> buffer) { | 115 std::unique_ptr<CompoundBuffer> buffer) { |
| 116 DCHECK(client_stub_); | 116 DCHECK(client_stub_); |
| 117 DCHECK(clipboard_stub_); | 117 DCHECK(clipboard_stub_); |
| 118 | 118 |
| 119 scoped_ptr<ControlMessage> message = | 119 std::unique_ptr<ControlMessage> message = |
| 120 ParseMessage<ControlMessage>(buffer.get()); | 120 ParseMessage<ControlMessage>(buffer.get()); |
| 121 if (!message) | 121 if (!message) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 if (message->has_clipboard_event()) { | 124 if (message->has_clipboard_event()) { |
| 125 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 125 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
| 126 } else if (message->has_capabilities()) { | 126 } else if (message->has_capabilities()) { |
| 127 client_stub_->SetCapabilities(message->capabilities()); | 127 client_stub_->SetCapabilities(message->capabilities()); |
| 128 } else if (message->has_cursor_shape()) { | 128 } else if (message->has_cursor_shape()) { |
| 129 if (CursorShapeIsValid(message->cursor_shape())) | 129 if (CursorShapeIsValid(message->cursor_shape())) |
| 130 client_stub_->SetCursorShape(message->cursor_shape()); | 130 client_stub_->SetCursorShape(message->cursor_shape()); |
| 131 } else if (message->has_pairing_response()) { | 131 } else if (message->has_pairing_response()) { |
| 132 client_stub_->SetPairingResponse(message->pairing_response()); | 132 client_stub_->SetPairingResponse(message->pairing_response()); |
| 133 } else if (message->has_extension_message()) { | 133 } else if (message->has_extension_message()) { |
| 134 client_stub_->DeliverHostMessage(message->extension_message()); | 134 client_stub_->DeliverHostMessage(message->extension_message()); |
| 135 } else if (message->has_video_layout()) { | 135 } else if (message->has_video_layout()) { |
| 136 client_stub_->SetVideoLayout(message->video_layout()); | 136 client_stub_->SetVideoLayout(message->video_layout()); |
| 137 } else { | 137 } else { |
| 138 LOG(WARNING) << "Unknown control message received."; | 138 LOG(WARNING) << "Unknown control message received."; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace protocol | 142 } // namespace protocol |
| 143 } // namespace remoting | 143 } // namespace remoting |
| OLD | NEW |