OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_host.h" | 5 #include "remoting/protocol/connection_to_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } else if (state == SignalStrategy::DISCONNECTED) { | 117 } else if (state == SignalStrategy::DISCONNECTED) { |
118 VLOG(1) << "Connection closed."; | 118 VLOG(1) << "Connection closed."; |
119 CloseOnError(NETWORK_FAILURE); | 119 CloseOnError(NETWORK_FAILURE); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 void ConnectionToHost::OnSessionManagerReady() { | 123 void ConnectionToHost::OnSessionManagerReady() { |
124 DCHECK(message_loop_->BelongsToCurrentThread()); | 124 DCHECK(message_loop_->BelongsToCurrentThread()); |
125 | 125 |
126 // After SessionManager is initialized we can try to connect to the host. | 126 // After SessionManager is initialized we can try to connect to the host. |
127 CandidateSessionConfig* candidate_config = | 127 scoped_ptr<CandidateSessionConfig> candidate_config = |
128 CandidateSessionConfig::CreateDefault(); | 128 CandidateSessionConfig::CreateDefault(); |
129 V1ClientAuthenticator* authenticator = | 129 scoped_ptr<Authenticator> authenticator( |
130 new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_); | 130 new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_)); |
131 session_.reset(session_manager_->Connect( | 131 session_ = session_manager_->Connect( |
132 host_jid_, authenticator, candidate_config, | 132 host_jid_, authenticator.Pass(), candidate_config.Pass(), |
133 base::Bind(&ConnectionToHost::OnSessionStateChange, | 133 base::Bind(&ConnectionToHost::OnSessionStateChange, |
134 base::Unretained(this)))); | 134 base::Unretained(this))); |
135 } | 135 } |
136 | 136 |
137 void ConnectionToHost::OnIncomingSession( | 137 void ConnectionToHost::OnIncomingSession( |
138 Session* session, | 138 Session* session, |
139 SessionManager::IncomingSessionResponse* response) { | 139 SessionManager::IncomingSessionResponse* response) { |
140 DCHECK(message_loop_->BelongsToCurrentThread()); | 140 DCHECK(message_loop_->BelongsToCurrentThread()); |
141 // Client always rejects incoming sessions. | 141 // Client always rejects incoming sessions. |
142 *response = SessionManager::DECLINE; | 142 *response = SessionManager::DECLINE; |
143 } | 143 } |
144 | 144 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 if (state != state_) { | 241 if (state != state_) { |
242 state_ = state; | 242 state_ = state; |
243 error_ = error; | 243 error_ = error; |
244 event_callback_->OnConnectionState(state_, error_); | 244 event_callback_->OnConnectionState(state_, error_); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 } // namespace protocol | 248 } // namespace protocol |
249 } // namespace remoting | 249 } // namespace remoting |
OLD | NEW |