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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 60 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
61 } | 61 } |
62 | 62 |
63 void ClientControlDispatcher::SetCapabilities( | 63 void ClientControlDispatcher::SetCapabilities( |
64 const Capabilities& capabilities) { | 64 const Capabilities& capabilities) { |
65 ControlMessage message; | 65 ControlMessage message; |
66 message.mutable_capabilities()->CopyFrom(capabilities); | 66 message.mutable_capabilities()->CopyFrom(capabilities); |
67 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 67 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
68 } | 68 } |
69 | 69 |
| 70 void ClientControlDispatcher::RequestPairing( |
| 71 const PairingRequest& pairing_request) { |
| 72 ControlMessage message; |
| 73 message.mutable_pairing_request()->CopyFrom(pairing_request); |
| 74 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 75 } |
| 76 |
70 void ClientControlDispatcher::OnMessageReceived( | 77 void ClientControlDispatcher::OnMessageReceived( |
71 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { | 78 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { |
72 DCHECK(client_stub_); | 79 DCHECK(client_stub_); |
73 DCHECK(clipboard_stub_); | 80 DCHECK(clipboard_stub_); |
74 base::ScopedClosureRunner done_runner(done_task); | 81 base::ScopedClosureRunner done_runner(done_task); |
75 | 82 |
76 if (message->has_clipboard_event()) { | 83 if (message->has_clipboard_event()) { |
77 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 84 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
78 } else if (message->has_capabilities()) { | 85 } else if (message->has_capabilities()) { |
79 client_stub_->SetCapabilities(message->capabilities()); | 86 client_stub_->SetCapabilities(message->capabilities()); |
80 } else if (message->has_cursor_shape()) { | 87 } else if (message->has_cursor_shape()) { |
81 client_stub_->SetCursorShape(message->cursor_shape()); | 88 client_stub_->SetCursorShape(message->cursor_shape()); |
| 89 } else if (message->has_pairing_response()) { |
| 90 client_stub_->SetPairingResponse(message->pairing_response()); |
82 } else { | 91 } else { |
83 LOG(WARNING) << "Unknown control message received."; | 92 LOG(WARNING) << "Unknown control message received."; |
84 } | 93 } |
85 } | 94 } |
86 | 95 |
87 } // namespace protocol | 96 } // namespace protocol |
88 } // namespace remoting | 97 } // namespace remoting |
OLD | NEW |