| 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/host/client_connection.h" | 5 #include "remoting/host/client_connection.h" |
| 6 | 6 |
| 7 #include "google/protobuf/message.h" | 7 #include "google/protobuf/message.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "remoting/protocol/messages_decoder.h" | 9 #include "remoting/protocol/messages_decoder.h" |
| 10 #include "remoting/protocol/util.h" | 10 #include "remoting/protocol/util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void ClientConnection::Disconnect() { | 69 void ClientConnection::Disconnect() { |
| 70 DCHECK_EQ(loop_, MessageLoop::current()); | 70 DCHECK_EQ(loop_, MessageLoop::current()); |
| 71 | 71 |
| 72 // If there is a channel then close it and release the reference. | 72 // If there is a channel then close it and release the reference. |
| 73 if (connection_) { | 73 if (connection_) { |
| 74 connection_->Close(NewRunnableMethod(this, &ClientConnection::OnClosed)); | 74 connection_->Close(NewRunnableMethod(this, &ClientConnection::OnClosed)); |
| 75 connection_ = NULL; | 75 connection_ = NULL; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 ClientConnection::ClientConnection() {} |
| 80 |
| 79 void ClientConnection::OnConnectionStateChange( | 81 void ClientConnection::OnConnectionStateChange( |
| 80 ChromotingConnection::State state) { | 82 ChromotingConnection::State state) { |
| 81 if (state == ChromotingConnection::CONNECTED) { | 83 if (state == ChromotingConnection::CONNECTED) { |
| 82 events_reader_.Init( | 84 events_reader_.Init( |
| 83 connection_->GetEventsChannel(), | 85 connection_->GetEventsChannel(), |
| 84 NewCallback(this, &ClientConnection::OnMessageReceived)); | 86 NewCallback(this, &ClientConnection::OnMessageReceived)); |
| 85 video_writer_.Init(connection_->GetVideoChannel()); | 87 video_writer_.Init(connection_->GetVideoChannel()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 loop_->PostTask(FROM_HERE, | 90 loop_->PostTask(FROM_HERE, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 DCHECK_EQ(loop_, MessageLoop::current()); | 124 DCHECK_EQ(loop_, MessageLoop::current()); |
| 123 DCHECK(handler_); | 125 DCHECK(handler_); |
| 124 handler_->HandleMessage(this, message); | 126 handler_->HandleMessage(this, message); |
| 125 } | 127 } |
| 126 | 128 |
| 127 // OnClosed() is used as a callback for ChromotingConnection::Close(). | 129 // OnClosed() is used as a callback for ChromotingConnection::Close(). |
| 128 void ClientConnection::OnClosed() { | 130 void ClientConnection::OnClosed() { |
| 129 } | 131 } |
| 130 | 132 |
| 131 } // namespace remoting | 133 } // namespace remoting |
| OLD | NEW |