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 // TODO(ajwong): We assign and read from a few of the member variables on | 5 // TODO(ajwong): We assign and read from a few of the member variables on |
6 // two threads. We need to audit this for thread safety. | 6 // two threads. We need to audit this for thread safety. |
7 | 7 |
8 #include "remoting/jingle_glue/jingle_client.h" | 8 #include "remoting/jingle_glue/jingle_client.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "remoting/jingle_glue/gaia_token_pre_xmpp_auth.h" | 12 #include "jingle/notifier/communicator/gaia_token_pre_xmpp_auth.h" |
| 13 #include "jingle/notifier/communicator/xmpp_socket_adapter.h" |
13 #include "remoting/jingle_glue/iq_request.h" | 14 #include "remoting/jingle_glue/iq_request.h" |
14 #include "remoting/jingle_glue/jingle_thread.h" | 15 #include "remoting/jingle_glue/jingle_thread.h" |
15 #include "remoting/jingle_glue/relay_port_allocator.h" | 16 #include "remoting/jingle_glue/relay_port_allocator.h" |
16 #include "remoting/jingle_glue/xmpp_socket_adapter.h" | |
17 #include "third_party/libjingle/source/talk/base/asyncsocket.h" | 17 #include "third_party/libjingle/source/talk/base/asyncsocket.h" |
18 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 18 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
19 #include "third_party/libjingle/source/talk/p2p/base/sessionmanager.h" | 19 #include "third_party/libjingle/source/talk/p2p/base/sessionmanager.h" |
20 #include "third_party/libjingle/source/talk/p2p/client/sessionmanagertask.h" | 20 #include "third_party/libjingle/source/talk/p2p/client/sessionmanagertask.h" |
21 #ifdef USE_SSL_TUNNEL | 21 #ifdef USE_SSL_TUNNEL |
22 #include "third_party/libjingle/source/talk/session/tunnel/securetunnelsessioncl
ient.h" | 22 #include "third_party/libjingle/source/talk/session/tunnel/securetunnelsessioncl
ient.h" |
23 #endif | 23 #endif |
24 #include "third_party/libjingle/source/talk/session/tunnel/tunnelsessionclient.h
" | 24 #include "third_party/libjingle/source/talk/session/tunnel/tunnelsessionclient.h
" |
25 #include "third_party/libjingle/source/talk/xmpp/prexmppauth.h" | 25 #include "third_party/libjingle/source/talk/xmpp/prexmppauth.h" |
26 #include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h" | 26 #include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 settings.set_resource("chromoting"); | 118 settings.set_resource("chromoting"); |
119 settings.set_use_tls(true); | 119 settings.set_use_tls(true); |
120 settings.set_token_service(auth_token_service); | 120 settings.set_token_service(auth_token_service); |
121 settings.set_auth_cookie(auth_token); | 121 settings.set_auth_cookie(auth_token); |
122 settings.set_server(talk_base::SocketAddress("talk.google.com", 5222)); | 122 settings.set_server(talk_base::SocketAddress("talk.google.com", 5222)); |
123 | 123 |
124 client_ = new buzz::XmppClient(thread_->task_pump()); | 124 client_ = new buzz::XmppClient(thread_->task_pump()); |
125 client_->SignalStateChange.connect( | 125 client_->SignalStateChange.connect( |
126 this, &JingleClient::OnConnectionStateChanged); | 126 this, &JingleClient::OnConnectionStateChanged); |
127 | 127 |
128 buzz::AsyncSocket* socket = new XmppSocketAdapter(settings, false); | 128 buzz::AsyncSocket* socket = new notifier::XmppSocketAdapter(settings, false); |
129 | 129 |
130 client_->Connect(settings, "", socket, CreatePreXmppAuth(settings)); | 130 client_->Connect(settings, "", socket, CreatePreXmppAuth(settings)); |
131 client_->Start(); | 131 client_->Start(); |
132 | 132 |
133 network_manager_.reset(new talk_base::NetworkManager()); | 133 network_manager_.reset(new talk_base::NetworkManager()); |
134 | 134 |
135 RelayPortAllocator* port_allocator = | 135 RelayPortAllocator* port_allocator = |
136 new RelayPortAllocator(network_manager_.get(), "transp2"); | 136 new RelayPortAllocator(network_manager_.get(), "transp2"); |
137 port_allocator_.reset(port_allocator); | 137 port_allocator_.reset(port_allocator); |
138 port_allocator->SetJingleInfo(client_); | 138 port_allocator->SetJingleInfo(client_); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (new_state != state_) { | 222 if (new_state != state_) { |
223 state_ = new_state; | 223 state_ = new_state; |
224 if (callback_) | 224 if (callback_) |
225 callback_->OnStateChange(this, new_state); | 225 callback_->OnStateChange(this, new_state); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 buzz::PreXmppAuth* JingleClient::CreatePreXmppAuth( | 229 buzz::PreXmppAuth* JingleClient::CreatePreXmppAuth( |
230 const buzz::XmppClientSettings& settings) { | 230 const buzz::XmppClientSettings& settings) { |
231 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY); | 231 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY); |
232 return new GaiaTokenPreXmppAuth(jid.Str(), settings.auth_cookie(), | 232 return new notifier::GaiaTokenPreXmppAuth(jid.Str(), settings.auth_cookie(), |
233 settings.token_service()); | 233 settings.token_service()); |
234 } | 234 } |
235 | 235 |
236 } // namespace remoting | 236 } // namespace remoting |
OLD | NEW |