OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
11 #include "jingle/notifier/base/chrome_async_socket.h" | 11 #include "jingle/glue/chrome_async_socket.h" |
| 12 #include "jingle/glue/xmpp_client_socket_factory.h" |
12 #include "jingle/notifier/base/task_pump.h" | 13 #include "jingle/notifier/base/task_pump.h" |
13 #include "jingle/notifier/base/weak_xmpp_client.h" | 14 #include "jingle/notifier/base/weak_xmpp_client.h" |
14 #include "jingle/notifier/base/xmpp_client_socket_factory.h" | |
15 #include "net/base/ssl_config_service.h" | 15 #include "net/base/ssl_config_service.h" |
16 #include "net/socket/client_socket_factory.h" | 16 #include "net/socket/client_socket_factory.h" |
17 #include "net/url_request/url_request_context.h" | 17 #include "net/url_request/url_request_context.h" |
18 #include "talk/xmpp/xmppclientsettings.h" | 18 #include "talk/xmpp/xmppclientsettings.h" |
19 | 19 |
20 namespace notifier { | 20 namespace notifier { |
21 | 21 |
22 XmppConnection::Delegate::~Delegate() {} | 22 XmppConnection::Delegate::~Delegate() {} |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 buzz::AsyncSocket* CreateSocket( | 26 buzz::AsyncSocket* CreateSocket( |
27 const buzz::XmppClientSettings& xmpp_client_settings, | 27 const buzz::XmppClientSettings& xmpp_client_settings, |
28 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { | 28 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { |
29 bool use_fake_ssl_client_socket = | 29 bool use_fake_ssl_client_socket = |
30 (xmpp_client_settings.protocol() == cricket::PROTO_SSLTCP); | 30 (xmpp_client_settings.protocol() == cricket::PROTO_SSLTCP); |
31 // The default SSLConfig is good enough for us for now. | 31 // The default SSLConfig is good enough for us for now. |
32 const net::SSLConfig ssl_config; | 32 const net::SSLConfig ssl_config; |
33 // These numbers were taken from similar numbers in | 33 // These numbers were taken from similar numbers in |
34 // XmppSocketAdapter. | 34 // XmppSocketAdapter. |
35 const size_t kReadBufSize = 64U * 1024U; | 35 const size_t kReadBufSize = 64U * 1024U; |
36 const size_t kWriteBufSize = 64U * 1024U; | 36 const size_t kWriteBufSize = 64U * 1024U; |
37 XmppClientSocketFactory* const client_socket_factory = | 37 jingle_glue::XmppClientSocketFactory* const client_socket_factory = |
38 new XmppClientSocketFactory( | 38 new jingle_glue::XmppClientSocketFactory( |
39 net::ClientSocketFactory::GetDefaultFactory(), | 39 net::ClientSocketFactory::GetDefaultFactory(), |
40 ssl_config, | 40 ssl_config, |
41 request_context_getter, | 41 request_context_getter, |
42 use_fake_ssl_client_socket); | 42 use_fake_ssl_client_socket); |
43 return new ChromeAsyncSocket(client_socket_factory, | 43 return new jingle_glue::ChromeAsyncSocket(client_socket_factory, |
44 kReadBufSize, kWriteBufSize); | 44 kReadBufSize, kWriteBufSize); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 XmppConnection::XmppConnection( | 49 XmppConnection::XmppConnection( |
50 const buzz::XmppClientSettings& xmpp_client_settings, | 50 const buzz::XmppClientSettings& xmpp_client_settings, |
51 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 51 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
52 Delegate* delegate, | 52 Delegate* delegate, |
53 buzz::PreXmppAuth* pre_xmpp_auth) | 53 buzz::PreXmppAuth* pre_xmpp_auth) |
54 : task_pump_(new TaskPump()), | 54 : task_pump_(new TaskPump()), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 void XmppConnection::ClearClient() { | 140 void XmppConnection::ClearClient() { |
141 if (weak_xmpp_client_.get()) { | 141 if (weak_xmpp_client_.get()) { |
142 weak_xmpp_client_->Invalidate(); | 142 weak_xmpp_client_->Invalidate(); |
143 DCHECK(!weak_xmpp_client_.get()); | 143 DCHECK(!weak_xmpp_client_.get()); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 } // namespace notifier | 147 } // namespace notifier |
OLD | NEW |