OLD | NEW |
1 // Copyright (c) 2010 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 "remoting/protocol/connection_to_client.h" | 5 #include "remoting/protocol/connection_to_client.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/client_control_sender.h" | 9 #include "remoting/protocol/client_control_sender.h" |
10 #include "remoting/protocol/host_message_dispatcher.h" | 10 #include "remoting/protocol/host_message_dispatcher.h" |
11 #include "remoting/protocol/host_stub.h" | 11 #include "remoting/protocol/host_stub.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return client_stub_.get(); | 76 return client_stub_.get(); |
77 } | 77 } |
78 | 78 |
79 void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) { | 79 void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) { |
80 if (state == protocol::Session::CONNECTED) { | 80 if (state == protocol::Session::CONNECTED) { |
81 client_stub_.reset(new ClientControlSender(session_->control_channel())); | 81 client_stub_.reset(new ClientControlSender(session_->control_channel())); |
82 video_writer_.reset(VideoWriter::Create(session_->config())); | 82 video_writer_.reset(VideoWriter::Create(session_->config())); |
83 video_writer_->Init(session_); | 83 video_writer_->Init(session_); |
84 | 84 |
85 dispatcher_.reset(new HostMessageDispatcher()); | 85 dispatcher_.reset(new HostMessageDispatcher()); |
86 dispatcher_->Initialize(session_.get(), host_stub_, input_stub_); | 86 dispatcher_->Initialize(this, host_stub_, input_stub_); |
87 } | 87 } |
88 | 88 |
89 // This method can be called from main thread so perform threading switching. | 89 // This method can be called from main thread so perform threading switching. |
90 if (MessageLoop::current() != loop_) { | 90 if (MessageLoop::current() != loop_) { |
91 loop_->PostTask( | 91 loop_->PostTask( |
92 FROM_HERE, | 92 FROM_HERE, |
93 NewRunnableMethod(this, &ConnectionToClient::StateChangeTask, state)); | 93 NewRunnableMethod(this, &ConnectionToClient::StateChangeTask, state)); |
94 } else { | 94 } else { |
95 StateChangeTask(state); | 95 StateChangeTask(state); |
96 } | 96 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Enable/disable each of the channels. | 139 // Enable/disable each of the channels. |
140 if (input_stub_) | 140 if (input_stub_) |
141 input_stub_->OnAuthenticated(); | 141 input_stub_->OnAuthenticated(); |
142 if (host_stub_) | 142 if (host_stub_) |
143 host_stub_->OnAuthenticated(); | 143 host_stub_->OnAuthenticated(); |
144 if (client_stub_.get()) | 144 if (client_stub_.get()) |
145 client_stub_->OnAuthenticated(); | 145 client_stub_->OnAuthenticated(); |
146 } | 146 } |
147 | 147 |
| 148 bool ConnectionToClient::client_authenticated() { |
| 149 return client_authenticated_; |
| 150 } |
| 151 |
148 } // namespace protocol | 152 } // namespace protocol |
149 } // namespace remoting | 153 } // namespace remoting |
OLD | NEW |