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 "base/ref_counted.h" |
6 #include "net/base/io_buffer.h" | 6 #include "net/base/io_buffer.h" |
7 #include "remoting/proto/control.pb.h" | 7 #include "remoting/proto/control.pb.h" |
8 #include "remoting/proto/event.pb.h" | 8 #include "remoting/proto/event.pb.h" |
9 #include "remoting/proto/internal.pb.h" | 9 #include "remoting/proto/internal.pb.h" |
10 #include "remoting/protocol/host_message_dispatcher.h" | 10 #include "remoting/protocol/host_message_dispatcher.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived)); | 73 NewCallback(this, &HostMessageDispatcher::OnControlMessageReceived)); |
74 return true; | 74 return true; |
75 } | 75 } |
76 | 76 |
77 void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) { | 77 void HostMessageDispatcher::OnControlMessageReceived(ControlMessage* message) { |
78 scoped_refptr<RefCountedMessage<ControlMessage> > ref_msg = | 78 scoped_refptr<RefCountedMessage<ControlMessage> > ref_msg = |
79 new RefCountedMessage<ControlMessage>(message); | 79 new RefCountedMessage<ControlMessage>(message); |
80 if (message->has_suggest_resolution()) { | 80 if (message->has_suggest_resolution()) { |
81 host_stub_->SuggestResolution( | 81 host_stub_->SuggestResolution( |
82 &message->suggest_resolution(), NewDeleteTask(ref_msg)); | 82 &message->suggest_resolution(), NewDeleteTask(ref_msg)); |
| 83 } else if (message->has_begin_session_request()) { |
| 84 host_stub_->BeginSessionRequest( |
| 85 &message->begin_session_request().credentials(), |
| 86 NewDeleteTask(ref_msg)); |
| 87 } else { |
| 88 NOTREACHED() << "Invalid control message received"; |
83 } | 89 } |
84 } | 90 } |
85 | 91 |
86 void HostMessageDispatcher::OnEventMessageReceived( | 92 void HostMessageDispatcher::OnEventMessageReceived( |
87 EventMessage* message) { | 93 EventMessage* message) { |
88 scoped_refptr<RefCountedMessage<EventMessage> > ref_msg = | 94 scoped_refptr<RefCountedMessage<EventMessage> > ref_msg = |
89 new RefCountedMessage<EventMessage>(message); | 95 new RefCountedMessage<EventMessage>(message); |
90 for (int i = 0; i < message->event_size(); ++i) { | 96 for (int i = 0; i < message->event_size(); ++i) { |
91 if (message->event(i).has_key()) { | 97 if (message->event(i).has_key()) { |
92 input_stub_->InjectKeyEvent( | 98 input_stub_->InjectKeyEvent( |
93 &message->event(i).key(), NewDeleteTask(ref_msg)); | 99 &message->event(i).key(), NewDeleteTask(ref_msg)); |
94 } | 100 } |
95 if (message->event(i).has_mouse()) { | 101 if (message->event(i).has_mouse()) { |
96 input_stub_->InjectMouseEvent( | 102 input_stub_->InjectMouseEvent( |
97 &message->event(i).mouse(), NewDeleteTask(ref_msg)); | 103 &message->event(i).mouse(), NewDeleteTask(ref_msg)); |
98 } | 104 } |
99 } | 105 } |
100 } | 106 } |
101 | 107 |
102 } // namespace protocol | 108 } // namespace protocol |
103 } // namespace remoting | 109 } // namespace remoting |
OLD | NEW |