OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h" | 5 #include "chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "chrome/browser/net/url_request_context_getter.h" | 8 #include "chrome/browser/net/url_request_context_getter.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "net/base/ssl_config_service.h" | 10 #include "net/base/ssl_config_service.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // SSLConfigService is not thread-safe, and the default values for SSLConfig | 73 // SSLConfigService is not thread-safe, and the default values for SSLConfig |
74 // are correct for us, so we don't use the config service to initialize this | 74 // are correct for us, so we don't use the config service to initialize this |
75 // object. | 75 // object. |
76 net::SSLConfig ssl_config; | 76 net::SSLConfig ssl_config; |
77 socket_->set_addr(talk_base::SocketAddress(hostname)); | 77 socket_->set_addr(talk_base::SocketAddress(hostname)); |
78 ssl_socket_.reset( | 78 ssl_socket_.reset( |
79 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 79 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
80 socket_, hostname, ssl_config)); | 80 socket_, hostname, ssl_config)); |
81 | 81 |
82 int result = ssl_socket_->Connect(&connected_callback_); | 82 int result = ssl_socket_->Connect(&connected_callback_, NULL); |
83 | 83 |
84 if (result == net::ERR_IO_PENDING || result == net::OK) { | 84 if (result == net::ERR_IO_PENDING || result == net::OK) { |
85 return 0; | 85 return 0; |
86 } else { | 86 } else { |
87 return result; | 87 return result; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 int SSLSocketAdapter::Send(const void* buf, size_t len) { | 91 int SSLSocketAdapter::Send(const void* buf, size_t len) { |
92 if (!ssl_connected_) { | 92 if (!ssl_connected_) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 SSLSocketAdapter *ssl_adapter) | 190 SSLSocketAdapter *ssl_adapter) |
191 : connect_callback_(NULL), | 191 : connect_callback_(NULL), |
192 read_callback_(NULL), | 192 read_callback_(NULL), |
193 write_callback_(NULL), | 193 write_callback_(NULL), |
194 read_buffer_len_(0), | 194 read_buffer_len_(0), |
195 write_buffer_len_(0), | 195 write_buffer_len_(0), |
196 socket_(socket) { | 196 socket_(socket) { |
197 socket_->SignalConnectEvent.connect(this, &TransportSocket::OnConnectEvent); | 197 socket_->SignalConnectEvent.connect(this, &TransportSocket::OnConnectEvent); |
198 } | 198 } |
199 | 199 |
200 int TransportSocket::Connect(net::CompletionCallback* callback) { | 200 int TransportSocket::Connect(net::CompletionCallback* callback, |
| 201 net::LoadLog* /* load_log */) { |
201 connect_callback_ = callback; | 202 connect_callback_ = callback; |
202 return socket_->Connect(addr_); | 203 return socket_->Connect(addr_); |
203 } | 204 } |
204 | 205 |
205 void TransportSocket::Disconnect() { | 206 void TransportSocket::Disconnect() { |
206 socket_->Close(); | 207 socket_->Close(); |
207 } | 208 } |
208 | 209 |
209 bool TransportSocket::IsConnected() const { | 210 bool TransportSocket::IsConnected() const { |
210 return (socket_->GetState() == talk_base::Socket::CS_CONNECTED); | 211 return (socket_->GetState() == talk_base::Socket::CS_CONNECTED); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 327 } |
327 } | 328 } |
328 callback->RunWithParams(Tuple1<int>(result)); | 329 callback->RunWithParams(Tuple1<int>(result)); |
329 return true; | 330 return true; |
330 } else { | 331 } else { |
331 return false; | 332 return false; |
332 } | 333 } |
333 } | 334 } |
334 | 335 |
335 } // namespace notifier | 336 } // namespace notifier |
OLD | NEW |