OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/ref_counted.h" |
5 #include "net/base/io_buffer.h" | 6 #include "net/base/io_buffer.h" |
6 #include "remoting/base/multiple_array_input_stream.h" | 7 #include "remoting/base/multiple_array_input_stream.h" |
7 #include "remoting/proto/control.pb.h" | 8 #include "remoting/proto/control.pb.h" |
8 #include "remoting/proto/event.pb.h" | 9 #include "remoting/proto/event.pb.h" |
9 #include "remoting/protocol/host_message_dispatcher.h" | 10 #include "remoting/protocol/host_message_dispatcher.h" |
10 #include "remoting/protocol/host_stub.h" | 11 #include "remoting/protocol/host_stub.h" |
11 #include "remoting/protocol/input_stub.h" | 12 #include "remoting/protocol/input_stub.h" |
12 #include "remoting/protocol/message_reader.h" | 13 #include "remoting/protocol/message_reader.h" |
13 #include "remoting/protocol/session.h" | 14 #include "remoting/protocol/session.h" |
14 | 15 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 session->control_channel(), | 72 session->control_channel(), |
72 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived)); | 73 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived)); |
73 return true; | 74 return true; |
74 } | 75 } |
75 | 76 |
76 void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) { | 77 void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) { |
77 scoped_refptr<RefCountedMessage<ControlMessage> > ref_msg = | 78 scoped_refptr<RefCountedMessage<ControlMessage> > ref_msg = |
78 new RefCountedMessage<ControlMessage>(message); | 79 new RefCountedMessage<ControlMessage>(message); |
79 if (message->has_suggest_resolution()) { | 80 if (message->has_suggest_resolution()) { |
80 host_stub_->SuggestResolution( | 81 host_stub_->SuggestResolution( |
81 message->suggest_resolution(), NewDeleteTask(ref_msg)); | 82 &message->suggest_resolution(), NewDeleteTask(ref_msg)); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 void HostMessageDispatcher::OnEventMessageReceived( | 86 void HostMessageDispatcher::OnEventMessageReceived( |
86 EventMessage* message) { | 87 EventMessage* message) { |
87 // TODO(hclam): Implement. | 88 scoped_refptr<RefCountedMessage<EventMessage> > ref_msg = |
| 89 new RefCountedMessage<EventMessage>(message); |
| 90 for (int i = 0; i < message->event_size(); ++i) { |
| 91 if (message->event(i).has_key()) { |
| 92 input_stub_->InjectKeyEvent( |
| 93 &message->event(i).key(), NewDeleteTask(ref_msg)); |
| 94 } |
| 95 if (message->event(i).has_mouse()) { |
| 96 input_stub_->InjectMouseEvent( |
| 97 &message->event(i).mouse(), NewDeleteTask(ref_msg)); |
| 98 } |
| 99 } |
88 } | 100 } |
89 | 101 |
90 } // namespace protocol | 102 } // namespace protocol |
91 } // namespace remoting | 103 } // namespace remoting |
OLD | NEW |