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 21 matching lines...) Expand all Loading... |
32 writer_.Init(channel(), BufferedSocketWriter::WriteFailedCallback()); | 32 writer_.Init(channel(), BufferedSocketWriter::WriteFailedCallback()); |
33 } | 33 } |
34 | 34 |
35 void HostControlDispatcher::SetCapabilities( | 35 void HostControlDispatcher::SetCapabilities( |
36 const Capabilities& capabilities) { | 36 const Capabilities& capabilities) { |
37 ControlMessage message; | 37 ControlMessage message; |
38 message.mutable_capabilities()->CopyFrom(capabilities); | 38 message.mutable_capabilities()->CopyFrom(capabilities); |
39 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 39 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
40 } | 40 } |
41 | 41 |
| 42 void HostControlDispatcher::SetPairingResponse( |
| 43 const PairingResponse& pairing_response) { |
| 44 ControlMessage message; |
| 45 message.mutable_pairing_response()->CopyFrom(pairing_response); |
| 46 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 47 } |
| 48 |
42 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { | 49 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { |
43 ControlMessage message; | 50 ControlMessage message; |
44 message.mutable_clipboard_event()->CopyFrom(event); | 51 message.mutable_clipboard_event()->CopyFrom(event); |
45 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 52 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
46 } | 53 } |
47 | 54 |
48 void HostControlDispatcher::SetCursorShape( | 55 void HostControlDispatcher::SetCursorShape( |
49 const CursorShapeInfo& cursor_shape) { | 56 const CursorShapeInfo& cursor_shape) { |
50 ControlMessage message; | 57 ControlMessage message; |
51 message.mutable_cursor_shape()->CopyFrom(cursor_shape); | 58 message.mutable_cursor_shape()->CopyFrom(cursor_shape); |
(...skipping 10 matching lines...) Expand all Loading... |
62 if (message->has_clipboard_event()) { | 69 if (message->has_clipboard_event()) { |
63 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 70 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
64 } else if (message->has_client_resolution()) { | 71 } else if (message->has_client_resolution()) { |
65 host_stub_->NotifyClientResolution(message->client_resolution()); | 72 host_stub_->NotifyClientResolution(message->client_resolution()); |
66 } else if (message->has_video_control()) { | 73 } else if (message->has_video_control()) { |
67 host_stub_->ControlVideo(message->video_control()); | 74 host_stub_->ControlVideo(message->video_control()); |
68 } else if (message->has_audio_control()) { | 75 } else if (message->has_audio_control()) { |
69 host_stub_->ControlAudio(message->audio_control()); | 76 host_stub_->ControlAudio(message->audio_control()); |
70 } else if (message->has_capabilities()) { | 77 } else if (message->has_capabilities()) { |
71 host_stub_->SetCapabilities(message->capabilities()); | 78 host_stub_->SetCapabilities(message->capabilities()); |
| 79 } else if (message->has_pairing_request()) { |
| 80 host_stub_->RequestPairing(message->pairing_request()); |
72 } else { | 81 } else { |
73 LOG(WARNING) << "Unknown control message received."; | 82 LOG(WARNING) << "Unknown control message received."; |
74 } | 83 } |
75 } | 84 } |
76 | 85 |
77 } // namespace protocol | 86 } // namespace protocol |
78 } // namespace remoting | 87 } // namespace remoting |
OLD | NEW |