OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signaling/xmpp_signal_strategy.h" | 5 #include "remoting/signaling/xmpp_signal_strategy.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 | 253 |
254 void XmppSignalStrategy::Core::SetAuthInfo(const std::string& username, | 254 void XmppSignalStrategy::Core::SetAuthInfo(const std::string& username, |
255 const std::string& auth_token) { | 255 const std::string& auth_token) { |
256 DCHECK(thread_checker_.CalledOnValidThread()); | 256 DCHECK(thread_checker_.CalledOnValidThread()); |
257 xmpp_server_config_.username = username; | 257 xmpp_server_config_.username = username; |
258 xmpp_server_config_.auth_token = auth_token; | 258 xmpp_server_config_.auth_token = auth_token; |
259 } | 259 } |
260 | 260 |
261 void XmppSignalStrategy::Core::SendMessage(const std::string& message) { | 261 void XmppSignalStrategy::Core::SendMessage(const std::string& message) { |
| 262 HOST_LOG(INFO) << "============= Outgoing Stanza =========================="; |
| 263 HOST_LOG(INFO) << message; |
| 264 |
262 DCHECK(thread_checker_.CalledOnValidThread()); | 265 DCHECK(thread_checker_.CalledOnValidThread()); |
263 DCHECK(tls_state_ == TlsState::NOT_REQUESTED || | 266 DCHECK(tls_state_ == TlsState::NOT_REQUESTED || |
264 tls_state_ == TlsState::CONNECTED); | 267 tls_state_ == TlsState::CONNECTED); |
265 | 268 |
266 scoped_refptr<net::IOBufferWithSize> buffer = | 269 scoped_refptr<net::IOBufferWithSize> buffer = |
267 new net::IOBufferWithSize(message.size()); | 270 new net::IOBufferWithSize(message.size()); |
268 memcpy(buffer->data(), message.data(), message.size()); | 271 memcpy(buffer->data(), message.data(), message.size()); |
269 writer_->Write(buffer, | 272 writer_->Write(buffer, |
270 base::Bind(&Core::OnMessageSent, base::Unretained(this))); | 273 base::Bind(&Core::OnMessageSent, base::Unretained(this))); |
271 } | 274 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 343 |
341 if (tls_state_ == TlsState::WAITING_FOR_FLUSH && | 344 if (tls_state_ == TlsState::WAITING_FOR_FLUSH && |
342 !writer_->has_data_pending()) { | 345 !writer_->has_data_pending()) { |
343 StartTls(); | 346 StartTls(); |
344 } | 347 } |
345 } | 348 } |
346 | 349 |
347 void XmppSignalStrategy::Core::OnStanza( | 350 void XmppSignalStrategy::Core::OnStanza( |
348 const std::unique_ptr<buzz::XmlElement> stanza) { | 351 const std::unique_ptr<buzz::XmlElement> stanza) { |
349 DCHECK(thread_checker_.CalledOnValidThread()); | 352 DCHECK(thread_checker_.CalledOnValidThread()); |
350 | 353 HOST_LOG(INFO) << "============= Incoming Stanza =========================="; |
| 354 HOST_LOG(INFO) << stanza->Str(); |
351 base::ObserverListBase<Listener>::Iterator it(&listeners_); | 355 base::ObserverListBase<Listener>::Iterator it(&listeners_); |
352 for (Listener* listener = it.GetNext(); listener; listener = it.GetNext()) { | 356 for (Listener* listener = it.GetNext(); listener; listener = it.GetNext()) { |
353 if (listener->OnSignalStrategyIncomingStanza(stanza.get())) | 357 if (listener->OnSignalStrategyIncomingStanza(stanza.get())) |
354 return; | 358 return; |
355 } | 359 } |
356 } | 360 } |
357 | 361 |
358 void XmppSignalStrategy::Core::OnParserError() { | 362 void XmppSignalStrategy::Core::OnParserError() { |
359 DCHECK(thread_checker_.CalledOnValidThread()); | 363 DCHECK(thread_checker_.CalledOnValidThread()); |
360 | 364 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 std::string XmppSignalStrategy::GetNextId() { | 537 std::string XmppSignalStrategy::GetNextId() { |
534 return base::Uint64ToString(base::RandUint64()); | 538 return base::Uint64ToString(base::RandUint64()); |
535 } | 539 } |
536 | 540 |
537 void XmppSignalStrategy::SetAuthInfo(const std::string& username, | 541 void XmppSignalStrategy::SetAuthInfo(const std::string& username, |
538 const std::string& auth_token) { | 542 const std::string& auth_token) { |
539 core_->SetAuthInfo(username, auth_token); | 543 core_->SetAuthInfo(username, auth_token); |
540 } | 544 } |
541 | 545 |
542 } // namespace remoting | 546 } // namespace remoting |
OLD | NEW |