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 "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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void ConnectionToHost::OnSessionManagerInitialized() { | 133 void ConnectionToHost::OnSessionManagerInitialized() { |
134 DCHECK(message_loop_->BelongsToCurrentThread()); | 134 DCHECK(message_loop_->BelongsToCurrentThread()); |
135 | 135 |
136 // After SessionManager is initialized we can try to connect to the host. | 136 // After SessionManager is initialized we can try to connect to the host. |
137 CandidateSessionConfig* candidate_config = | 137 CandidateSessionConfig* candidate_config = |
138 CandidateSessionConfig::CreateDefault(); | 138 CandidateSessionConfig::CreateDefault(); |
139 std::string client_token = | 139 std::string client_token = |
140 protocol::GenerateSupportAuthToken(local_jid_, access_code_); | 140 protocol::GenerateSupportAuthToken(local_jid_, access_code_); |
141 session_.reset(session_manager_->Connect( | 141 session_.reset(session_manager_->Connect( |
142 host_jid_, host_public_key_, client_token, candidate_config, | 142 host_jid_, host_public_key_, client_token, candidate_config, |
143 NewCallback(this, &ConnectionToHost::OnSessionStateChange))); | 143 base::Bind(&ConnectionToHost::OnSessionStateChange, |
| 144 base::Unretained(this)))); |
144 | 145 |
145 // Set the shared-secret for securing SSL channels. | 146 // Set the shared-secret for securing SSL channels. |
146 session_->set_shared_secret(access_code_); | 147 session_->set_shared_secret(access_code_); |
147 } | 148 } |
148 | 149 |
149 void ConnectionToHost::OnIncomingSession( | 150 void ConnectionToHost::OnIncomingSession( |
150 Session* session, | 151 Session* session, |
151 SessionManager::IncomingSessionResponse* response) { | 152 SessionManager::IncomingSessionResponse* response) { |
152 DCHECK(message_loop_->BelongsToCurrentThread()); | 153 DCHECK(message_loop_->BelongsToCurrentThread()); |
153 // Client always rejects incoming sessions. | 154 // Client always rejects incoming sessions. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 266 |
266 if (state != state_) { | 267 if (state != state_) { |
267 state_ = state; | 268 state_ = state; |
268 error_ = error; | 269 error_ = error; |
269 event_callback_->OnConnectionState(state_, error_); | 270 event_callback_->OnConnectionState(state_, error_); |
270 } | 271 } |
271 } | 272 } |
272 | 273 |
273 } // namespace protocol | 274 } // namespace protocol |
274 } // namespace remoting | 275 } // namespace remoting |
OLD | NEW |