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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 message.mutable_video_control()->CopyFrom(video_control); | 53 message.mutable_video_control()->CopyFrom(video_control); |
54 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 54 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
55 } | 55 } |
56 | 56 |
57 void ClientControlDispatcher::ControlAudio(const AudioControl& audio_control) { | 57 void ClientControlDispatcher::ControlAudio(const AudioControl& audio_control) { |
58 ControlMessage message; | 58 ControlMessage message; |
59 message.mutable_audio_control()->CopyFrom(audio_control); | 59 message.mutable_audio_control()->CopyFrom(audio_control); |
60 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 60 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
61 } | 61 } |
62 | 62 |
| 63 void ClientControlDispatcher::SetCapabilities( |
| 64 const Capabilities& capabilities) { |
| 65 ControlMessage message; |
| 66 message.mutable_capabilities()->CopyFrom(capabilities); |
| 67 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 68 } |
| 69 |
63 void ClientControlDispatcher::OnMessageReceived( | 70 void ClientControlDispatcher::OnMessageReceived( |
64 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { | 71 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { |
65 DCHECK(client_stub_); | 72 DCHECK(client_stub_); |
66 DCHECK(clipboard_stub_); | 73 DCHECK(clipboard_stub_); |
67 base::ScopedClosureRunner done_runner(done_task); | 74 base::ScopedClosureRunner done_runner(done_task); |
68 | 75 |
69 if (message->has_clipboard_event()) { | 76 if (message->has_clipboard_event()) { |
70 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 77 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
| 78 } else if (message->has_capabilities()) { |
| 79 client_stub_->SetCapabilities(message->capabilities()); |
71 } else if (message->has_cursor_shape()) { | 80 } else if (message->has_cursor_shape()) { |
72 client_stub_->SetCursorShape(message->cursor_shape()); | 81 client_stub_->SetCursorShape(message->cursor_shape()); |
73 } else { | 82 } else { |
74 LOG(WARNING) << "Unknown control message received."; | 83 LOG(WARNING) << "Unknown control message received."; |
75 } | 84 } |
76 } | 85 } |
77 | 86 |
78 } // namespace protocol | 87 } // namespace protocol |
79 } // namespace remoting | 88 } // namespace remoting |
OLD | NEW |