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/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/proto/control.pb.h" | 10 #include "remoting/proto/control.pb.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void HostControlDispatcher::SetCursorShape( | 58 void HostControlDispatcher::SetCursorShape( |
59 const CursorShapeInfo& cursor_shape) { | 59 const CursorShapeInfo& cursor_shape) { |
60 ControlMessage message; | 60 ControlMessage message; |
61 message.mutable_cursor_shape()->CopyFrom(cursor_shape); | 61 message.mutable_cursor_shape()->CopyFrom(cursor_shape); |
62 writer()->Write(SerializeAndFrameMessage(message), base::Closure()); | 62 writer()->Write(SerializeAndFrameMessage(message), base::Closure()); |
63 } | 63 } |
64 | 64 |
65 void HostControlDispatcher::OnMessageReceived( | 65 void HostControlDispatcher::OnMessageReceived( |
66 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { | 66 scoped_ptr<ControlMessage> message) { |
67 DCHECK(clipboard_stub_); | 67 DCHECK(clipboard_stub_); |
68 DCHECK(host_stub_); | 68 DCHECK(host_stub_); |
69 | 69 |
70 base::ScopedClosureRunner done_runner(done_task); | |
71 | |
72 if (message->has_clipboard_event()) { | 70 if (message->has_clipboard_event()) { |
73 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); | 71 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); |
74 } else if (message->has_client_resolution()) { | 72 } else if (message->has_client_resolution()) { |
75 host_stub_->NotifyClientResolution(message->client_resolution()); | 73 host_stub_->NotifyClientResolution(message->client_resolution()); |
76 } else if (message->has_video_control()) { | 74 } else if (message->has_video_control()) { |
77 host_stub_->ControlVideo(message->video_control()); | 75 host_stub_->ControlVideo(message->video_control()); |
78 } else if (message->has_audio_control()) { | 76 } else if (message->has_audio_control()) { |
79 host_stub_->ControlAudio(message->audio_control()); | 77 host_stub_->ControlAudio(message->audio_control()); |
80 } else if (message->has_capabilities()) { | 78 } else if (message->has_capabilities()) { |
81 host_stub_->SetCapabilities(message->capabilities()); | 79 host_stub_->SetCapabilities(message->capabilities()); |
82 } else if (message->has_pairing_request()) { | 80 } else if (message->has_pairing_request()) { |
83 host_stub_->RequestPairing(message->pairing_request()); | 81 host_stub_->RequestPairing(message->pairing_request()); |
84 } else if (message->has_extension_message()) { | 82 } else if (message->has_extension_message()) { |
85 host_stub_->DeliverClientMessage(message->extension_message()); | 83 host_stub_->DeliverClientMessage(message->extension_message()); |
86 } else { | 84 } else { |
87 LOG(WARNING) << "Unknown control message received."; | 85 LOG(WARNING) << "Unknown control message received."; |
88 } | 86 } |
89 } | 87 } |
90 | 88 |
91 } // namespace protocol | 89 } // namespace protocol |
92 } // namespace remoting | 90 } // namespace remoting |
OLD | NEW |