| 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 "jingle/notifier/base/xmpp_connection.h" | 5 #include "jingle/notifier/base/xmpp_connection.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const buzz::XmppClientSettings& xmpp_client_settings, | 25 const buzz::XmppClientSettings& xmpp_client_settings, |
| 26 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { | 26 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { |
| 27 bool use_fake_ssl_client_socket = | 27 bool use_fake_ssl_client_socket = |
| 28 (xmpp_client_settings.protocol() == cricket::PROTO_SSLTCP); | 28 (xmpp_client_settings.protocol() == cricket::PROTO_SSLTCP); |
| 29 // The default SSLConfig is good enough for us for now. | 29 // The default SSLConfig is good enough for us for now. |
| 30 const net::SSLConfig ssl_config; | 30 const net::SSLConfig ssl_config; |
| 31 // These numbers were taken from similar numbers in | 31 // These numbers were taken from similar numbers in |
| 32 // XmppSocketAdapter. | 32 // XmppSocketAdapter. |
| 33 const size_t kReadBufSize = 64U * 1024U; | 33 const size_t kReadBufSize = 64U * 1024U; |
| 34 const size_t kWriteBufSize = 64U * 1024U; | 34 const size_t kWriteBufSize = 64U * 1024U; |
| 35 net::NetLog* const net_log = | |
| 36 request_context_getter->GetURLRequestContext()->net_log(); | |
| 37 XmppClientSocketFactory* const client_socket_factory = | 35 XmppClientSocketFactory* const client_socket_factory = |
| 38 new XmppClientSocketFactory( | 36 new XmppClientSocketFactory( |
| 39 net::ClientSocketFactory::GetDefaultFactory(), | 37 net::ClientSocketFactory::GetDefaultFactory(), |
| 40 ssl_config, | 38 ssl_config, |
| 41 request_context_getter, | 39 request_context_getter, |
| 42 use_fake_ssl_client_socket); | 40 use_fake_ssl_client_socket); |
| 43 return new ChromeAsyncSocket(client_socket_factory, | 41 return new ChromeAsyncSocket(client_socket_factory, |
| 44 kReadBufSize, kWriteBufSize, net_log); | 42 kReadBufSize, kWriteBufSize); |
| 45 } | 43 } |
| 46 | 44 |
| 47 } // namespace | 45 } // namespace |
| 48 | 46 |
| 49 XmppConnection::XmppConnection( | 47 XmppConnection::XmppConnection( |
| 50 const buzz::XmppClientSettings& xmpp_client_settings, | 48 const buzz::XmppClientSettings& xmpp_client_settings, |
| 51 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 49 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| 52 Delegate* delegate, buzz::PreXmppAuth* pre_xmpp_auth) | 50 Delegate* delegate, buzz::PreXmppAuth* pre_xmpp_auth) |
| 53 : task_pump_(new TaskPump()), | 51 : task_pump_(new TaskPump()), |
| 54 on_connect_called_(false), | 52 on_connect_called_(false), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 134 } |
| 137 | 135 |
| 138 void XmppConnection::ClearClient() { | 136 void XmppConnection::ClearClient() { |
| 139 if (weak_xmpp_client_.get()) { | 137 if (weak_xmpp_client_.get()) { |
| 140 weak_xmpp_client_->Invalidate(); | 138 weak_xmpp_client_->Invalidate(); |
| 141 DCHECK(!weak_xmpp_client_.get()); | 139 DCHECK(!weak_xmpp_client_.get()); |
| 142 } | 140 } |
| 143 } | 141 } |
| 144 | 142 |
| 145 } // namespace notifier | 143 } // namespace notifier |
| OLD | NEW |