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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "net/socket/stream_socket.h" | 8 #include "net/socket/stream_socket.h" |
9 #include "remoting/base/compound_buffer.h" | 9 #include "remoting/base/compound_buffer.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 DCHECK(host_stub_); | 68 DCHECK(host_stub_); |
69 | 69 |
70 std::unique_ptr<ControlMessage> message = | 70 std::unique_ptr<ControlMessage> message = |
71 ParseMessage<ControlMessage>(buffer.get()); | 71 ParseMessage<ControlMessage>(buffer.get()); |
72 if (!message) | 72 if (!message) |
73 return; | 73 return; |
74 | 74 |
75 if (message->has_clipboard_event()) { | 75 if (message->has_clipboard_event()) { |
76 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 76 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
77 } else if (message->has_client_resolution()) { | 77 } else if (message->has_client_resolution()) { |
78 host_stub_->NotifyClientResolution(message->client_resolution()); | 78 const ClientResolution& resolution = message->client_resolution(); |
79 if (!resolution.has_dips_width() || !resolution.has_dips_height() || | |
80 resolution.dips_width() <= 0 || resolution.dips_height() <= 0) { | |
81 LOG(ERROR) << "Received invalid ClientResolution message."; | |
82 return; | |
83 } | |
84 host_stub_->NotifyClientResolution(resolution); | |
Jamie
2016/05/31 20:40:47
It seems odd that this is the only message we vali
Sergey Ulanov
2016/06/01 10:08:51
Agree. Added a TODO.
| |
79 } else if (message->has_video_control()) { | 85 } else if (message->has_video_control()) { |
80 host_stub_->ControlVideo(message->video_control()); | 86 host_stub_->ControlVideo(message->video_control()); |
81 } else if (message->has_audio_control()) { | 87 } else if (message->has_audio_control()) { |
82 host_stub_->ControlAudio(message->audio_control()); | 88 host_stub_->ControlAudio(message->audio_control()); |
83 } else if (message->has_capabilities()) { | 89 } else if (message->has_capabilities()) { |
84 host_stub_->SetCapabilities(message->capabilities()); | 90 host_stub_->SetCapabilities(message->capabilities()); |
85 } else if (message->has_pairing_request()) { | 91 } else if (message->has_pairing_request()) { |
86 host_stub_->RequestPairing(message->pairing_request()); | 92 host_stub_->RequestPairing(message->pairing_request()); |
87 } else if (message->has_extension_message()) { | 93 } else if (message->has_extension_message()) { |
88 host_stub_->DeliverClientMessage(message->extension_message()); | 94 host_stub_->DeliverClientMessage(message->extension_message()); |
89 } else { | 95 } else { |
90 LOG(WARNING) << "Unknown control message received."; | 96 LOG(WARNING) << "Unknown control message received."; |
91 } | 97 } |
92 } | 98 } |
93 | 99 |
94 } // namespace protocol | 100 } // namespace protocol |
95 } // namespace remoting | 101 } // namespace remoting |
OLD | NEW |