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 "remoting/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "remoting/client/chromoting_view.h" | 8 #include "remoting/client/chromoting_view.h" |
9 #include "remoting/client/client_context.h" | 9 #include "remoting/client/client_context.h" |
10 #include "remoting/client/host_connection.h" | 10 #include "remoting/client/host_connection.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 HostMessageList* messages) { | 98 HostMessageList* messages) { |
99 if (message_loop() != MessageLoop::current()) { | 99 if (message_loop() != MessageLoop::current()) { |
100 message_loop()->PostTask( | 100 message_loop()->PostTask( |
101 FROM_HERE, | 101 FROM_HERE, |
102 NewRunnableMethod(this, &ChromotingClient::HandleMessages, | 102 NewRunnableMethod(this, &ChromotingClient::HandleMessages, |
103 conn, messages)); | 103 conn, messages)); |
104 return; | 104 return; |
105 } | 105 } |
106 | 106 |
107 for (size_t i = 0; i < messages->size(); ++i) { | 107 for (size_t i = 0; i < messages->size(); ++i) { |
108 HostMessage* msg = (*messages)[i]; | 108 ChromotingHostMessage* msg = (*messages)[i]; |
109 // TODO(ajwong): Consider creating a macro similar to the IPC message | 109 // TODO(ajwong): Consider creating a macro similar to the IPC message |
110 // mappings. Also reconsider the lifetime of the message object. | 110 // mappings. Also reconsider the lifetime of the message object. |
111 if (msg->has_init_client()) { | 111 if (msg->has_init_client()) { |
112 InitClient(msg); | 112 InitClient(msg); |
113 } else if (msg->has_begin_update_stream()) { | 113 } else if (msg->has_begin_update_stream()) { |
114 BeginUpdate(msg); | 114 BeginUpdate(msg); |
115 } else if (msg->has_update_stream_packet()) { | 115 } else if (msg->has_update_stream_packet()) { |
116 HandleUpdate(msg); | 116 HandleUpdate(msg); |
117 } else if (msg->has_end_update_stream()) { | 117 } else if (msg->has_end_update_stream()) { |
118 EndUpdate(msg); | 118 EndUpdate(msg); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 break; | 168 break; |
169 | 169 |
170 case FAILED: | 170 case FAILED: |
171 view_->SetSolidFill(kFailedColor); | 171 view_->SetSolidFill(kFailedColor); |
172 break; | 172 break; |
173 } | 173 } |
174 | 174 |
175 Repaint(); | 175 Repaint(); |
176 } | 176 } |
177 | 177 |
178 void ChromotingClient::InitClient(HostMessage* msg) { | 178 void ChromotingClient::InitClient(ChromotingHostMessage* msg) { |
179 DCHECK_EQ(message_loop(), MessageLoop::current()); | 179 DCHECK_EQ(message_loop(), MessageLoop::current()); |
180 DCHECK(msg->has_init_client()); | 180 DCHECK(msg->has_init_client()); |
181 scoped_ptr<HostMessage> deleter(msg); | 181 scoped_ptr<ChromotingHostMessage> deleter(msg); |
182 | 182 |
183 // Resize the window. | 183 // Resize the window. |
184 int width = msg->init_client().width(); | 184 int width = msg->init_client().width(); |
185 int height = msg->init_client().height(); | 185 int height = msg->init_client().height(); |
186 LOG(INFO) << "Init client received geometry: " << width << "x" << height; | 186 LOG(INFO) << "Init client received geometry: " << width << "x" << height; |
187 | 187 |
188 view_->SetHostScreenSize(width, height); | 188 view_->SetHostScreenSize(width, height); |
189 | 189 |
190 // Schedule the input handler to process the event queue. | 190 // Schedule the input handler to process the event queue. |
191 input_handler_->Initialize(); | 191 input_handler_->Initialize(); |
192 } | 192 } |
193 | 193 |
194 void ChromotingClient::BeginUpdate(HostMessage* msg) { | 194 void ChromotingClient::BeginUpdate(ChromotingHostMessage* msg) { |
195 DCHECK_EQ(message_loop(), MessageLoop::current()); | 195 DCHECK_EQ(message_loop(), MessageLoop::current()); |
196 DCHECK(msg->has_begin_update_stream()); | 196 DCHECK(msg->has_begin_update_stream()); |
197 | 197 |
198 view_->HandleBeginUpdateStream(msg); | 198 view_->HandleBeginUpdateStream(msg); |
199 } | 199 } |
200 | 200 |
201 void ChromotingClient::HandleUpdate(HostMessage* msg) { | 201 void ChromotingClient::HandleUpdate(ChromotingHostMessage* msg) { |
202 DCHECK_EQ(message_loop(), MessageLoop::current()); | 202 DCHECK_EQ(message_loop(), MessageLoop::current()); |
203 DCHECK(msg->has_update_stream_packet()); | 203 DCHECK(msg->has_update_stream_packet()); |
204 | 204 |
205 view_->HandleUpdateStreamPacket(msg); | 205 view_->HandleUpdateStreamPacket(msg); |
206 } | 206 } |
207 | 207 |
208 void ChromotingClient::EndUpdate(HostMessage* msg) { | 208 void ChromotingClient::EndUpdate(ChromotingHostMessage* msg) { |
209 DCHECK_EQ(message_loop(), MessageLoop::current()); | 209 DCHECK_EQ(message_loop(), MessageLoop::current()); |
210 DCHECK(msg->has_end_update_stream()); | 210 DCHECK(msg->has_end_update_stream()); |
211 | 211 |
212 view_->HandleEndUpdateStream(msg); | 212 view_->HandleEndUpdateStream(msg); |
213 } | 213 } |
214 | 214 |
215 } // namespace remoting | 215 } // namespace remoting |
OLD | NEW |