| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 5 #include "base/memory/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/client_message_dispatcher.h" | 10 #include "remoting/protocol/client_message_dispatcher.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 client_stub_ = client_stub; | 32 client_stub_ = client_stub; |
| 33 | 33 |
| 34 control_message_reader_->Init( | 34 control_message_reader_->Init( |
| 35 session->control_channel(), | 35 session->control_channel(), |
| 36 NewCallback(this, &ClientMessageDispatcher::OnControlMessageReceived)); | 36 NewCallback(this, &ClientMessageDispatcher::OnControlMessageReceived)); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void ClientMessageDispatcher::OnControlMessageReceived( | 40 void ClientMessageDispatcher::OnControlMessageReceived( |
| 41 ControlMessage* message, Task* done_task) { | 41 ControlMessage* message, Task* done_task) { |
| 42 // TODO(sergeyu): Add message validation. | 42 if (message->has_begin_session_response()) { |
| 43 if (message->has_notify_resolution()) { | 43 const BeginSessionResponse& response = message->begin_session_response(); |
| 44 client_stub_->NotifyResolution( | 44 if (response.has_login_status() && |
| 45 &message->notify_resolution(), done_task); | 45 response.login_status().has_success()) { |
| 46 return; | 46 client_stub_->BeginSessionResponse( |
| 47 } else if (message->has_begin_session_response()) { | 47 &response.login_status(), done_task); |
| 48 client_stub_->BeginSessionResponse( | 48 return; |
| 49 &message->begin_session_response().login_status(), done_task); | 49 } |
| 50 return; | |
| 51 } else { | |
| 52 LOG(WARNING) << "Invalid control message received."; | |
| 53 } | 50 } |
| 54 | 51 |
| 52 LOG(WARNING) << "Invalid control message received."; |
| 53 |
| 55 done_task->Run(); | 54 done_task->Run(); |
| 56 delete done_task; | 55 delete done_task; |
| 57 } | 56 } |
| 58 | 57 |
| 59 } // namespace protocol | 58 } // namespace protocol |
| 60 } // namespace remoting | 59 } // namespace remoting |
| OLD | NEW |