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/message_loop_proxy.h" | 7 #include "base/message_loop/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 28 matching lines...) Expand all Loading... |
39 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 39 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
40 } | 40 } |
41 | 41 |
42 void HostControlDispatcher::SetPairingResponse( | 42 void HostControlDispatcher::SetPairingResponse( |
43 const PairingResponse& pairing_response) { | 43 const PairingResponse& pairing_response) { |
44 ControlMessage message; | 44 ControlMessage message; |
45 message.mutable_pairing_response()->CopyFrom(pairing_response); | 45 message.mutable_pairing_response()->CopyFrom(pairing_response); |
46 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 46 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
47 } | 47 } |
48 | 48 |
| 49 void HostControlDispatcher::ProcessHostJson(const JsonMessage& json_message) { |
| 50 ControlMessage message; |
| 51 message.mutable_json_message()->CopyFrom(json_message); |
| 52 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
| 53 } |
| 54 |
49 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { | 55 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { |
50 ControlMessage message; | 56 ControlMessage message; |
51 message.mutable_clipboard_event()->CopyFrom(event); | 57 message.mutable_clipboard_event()->CopyFrom(event); |
52 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); | 58 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); |
53 } | 59 } |
54 | 60 |
55 void HostControlDispatcher::SetCursorShape( | 61 void HostControlDispatcher::SetCursorShape( |
56 const CursorShapeInfo& cursor_shape) { | 62 const CursorShapeInfo& cursor_shape) { |
57 ControlMessage message; | 63 ControlMessage message; |
58 message.mutable_cursor_shape()->CopyFrom(cursor_shape); | 64 message.mutable_cursor_shape()->CopyFrom(cursor_shape); |
(...skipping 12 matching lines...) Expand all Loading... |
71 } else if (message->has_client_resolution()) { | 77 } else if (message->has_client_resolution()) { |
72 host_stub_->NotifyClientResolution(message->client_resolution()); | 78 host_stub_->NotifyClientResolution(message->client_resolution()); |
73 } else if (message->has_video_control()) { | 79 } else if (message->has_video_control()) { |
74 host_stub_->ControlVideo(message->video_control()); | 80 host_stub_->ControlVideo(message->video_control()); |
75 } else if (message->has_audio_control()) { | 81 } else if (message->has_audio_control()) { |
76 host_stub_->ControlAudio(message->audio_control()); | 82 host_stub_->ControlAudio(message->audio_control()); |
77 } else if (message->has_capabilities()) { | 83 } else if (message->has_capabilities()) { |
78 host_stub_->SetCapabilities(message->capabilities()); | 84 host_stub_->SetCapabilities(message->capabilities()); |
79 } else if (message->has_pairing_request()) { | 85 } else if (message->has_pairing_request()) { |
80 host_stub_->RequestPairing(message->pairing_request()); | 86 host_stub_->RequestPairing(message->pairing_request()); |
| 87 } else if (message->has_json_message()) { |
| 88 host_stub_->ProcessClientJson(message->json_message()); |
81 } else { | 89 } else { |
82 LOG(WARNING) << "Unknown control message received."; | 90 LOG(WARNING) << "Unknown control message received."; |
83 } | 91 } |
84 } | 92 } |
85 | 93 |
86 } // namespace protocol | 94 } // namespace protocol |
87 } // namespace remoting | 95 } // namespace remoting |
OLD | NEW |