| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 extern "C" { | 8 extern "C" { |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 } | 10 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 void ProtocolTestClient::OnJidChange(const std::string& full_jid) { | 289 void ProtocolTestClient::OnJidChange(const std::string& full_jid) { |
| 290 local_jid_ = full_jid; | 290 local_jid_ = full_jid; |
| 291 } | 291 } |
| 292 | 292 |
| 293 void ProtocolTestClient::OnSessionManagerInitialized() { | 293 void ProtocolTestClient::OnSessionManagerInitialized() { |
| 294 if (host_jid_ != "") { | 294 if (host_jid_ != "") { |
| 295 ProtocolTestConnection* connection = new ProtocolTestConnection(this); | 295 ProtocolTestConnection* connection = new ProtocolTestConnection(this); |
| 296 connection->Init(session_manager_->Connect( | 296 connection->Init(session_manager_->Connect( |
| 297 host_jid_, "", kDummyAuthToken, | 297 host_jid_, "", kDummyAuthToken, |
| 298 CandidateSessionConfig::CreateDefault(), | 298 CandidateSessionConfig::CreateDefault(), |
| 299 NewCallback(connection, &ProtocolTestConnection::OnStateChange))); | 299 base::Bind(&ProtocolTestConnection::OnStateChange, connection))); |
| 300 connections_.push_back(make_scoped_refptr(connection)); | 300 connections_.push_back(make_scoped_refptr(connection)); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 void ProtocolTestClient::OnIncomingSession( | 304 void ProtocolTestClient::OnIncomingSession( |
| 305 Session* session, | 305 Session* session, |
| 306 SessionManager::IncomingSessionResponse* response) { | 306 SessionManager::IncomingSessionResponse* response) { |
| 307 std::cerr << "Accepting connection from " << session->jid() << std::endl; | 307 std::cerr << "Accepting connection from " << session->jid() << std::endl; |
| 308 | 308 |
| 309 session->set_config(SessionConfig::GetDefault()); | 309 session->set_config(SessionConfig::GetDefault()); |
| 310 *response = SessionManager::ACCEPT; | 310 *response = SessionManager::ACCEPT; |
| 311 | 311 |
| 312 ProtocolTestConnection* test_connection = new ProtocolTestConnection(this); | 312 ProtocolTestConnection* test_connection = new ProtocolTestConnection(this); |
| 313 session->SetStateChangeCallback( | 313 session->SetStateChangeCallback( |
| 314 NewCallback(test_connection, &ProtocolTestConnection::OnStateChange)); | 314 base::Bind(&ProtocolTestConnection::OnStateChange, test_connection)); |
| 315 test_connection->Init(session); | 315 test_connection->Init(session); |
| 316 base::AutoLock auto_lock(connections_lock_); | 316 base::AutoLock auto_lock(connections_lock_); |
| 317 connections_.push_back(make_scoped_refptr(test_connection)); | 317 connections_.push_back(make_scoped_refptr(test_connection)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace protocol | 320 } // namespace protocol |
| 321 } // namespace remoting | 321 } // namespace remoting |
| 322 | 322 |
| 323 using remoting::protocol::ProtocolTestClient; | 323 using remoting::protocol::ProtocolTestClient; |
| 324 | 324 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 std::string auth_service("oauth2"); | 359 std::string auth_service("oauth2"); |
| 360 if (cmd_line->HasSwitch("auth_service")) | 360 if (cmd_line->HasSwitch("auth_service")) |
| 361 auth_service = cmd_line->GetSwitchValueASCII("auth_service"); | 361 auth_service = cmd_line->GetSwitchValueASCII("auth_service"); |
| 362 | 362 |
| 363 scoped_refptr<ProtocolTestClient> client(new ProtocolTestClient()); | 363 scoped_refptr<ProtocolTestClient> client(new ProtocolTestClient()); |
| 364 | 364 |
| 365 client->Run(username, auth_token, host_jid, auth_service); | 365 client->Run(username, auth_token, host_jid, auth_service); |
| 366 | 366 |
| 367 return 0; | 367 return 0; |
| 368 } | 368 } |
| OLD | NEW |