Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: jingle/notifier/base/chrome_async_socket.cc

Issue 5958001: The MediatorThread worker thread needs to have a CertVerifier... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix typos in xmpp_connection_unittest.cc Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "jingle/notifier/base/chrome_async_socket.h" 5 #include "jingle/notifier/base/chrome_async_socket.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <winsock2.h> 8 #include <winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <arpa/inet.h> 10 #include <arpa/inet.h>
(...skipping 15 matching lines...) Expand all
26 #include "net/socket/client_socket_factory.h" 26 #include "net/socket/client_socket_factory.h"
27 #include "net/socket/ssl_client_socket.h" 27 #include "net/socket/ssl_client_socket.h"
28 #include "net/socket/tcp_client_socket.h" 28 #include "net/socket/tcp_client_socket.h"
29 #include "talk/base/socketaddress.h" 29 #include "talk/base/socketaddress.h"
30 30
31 namespace notifier { 31 namespace notifier {
32 32
33 ChromeAsyncSocket::ChromeAsyncSocket( 33 ChromeAsyncSocket::ChromeAsyncSocket(
34 net::ClientSocketFactory* client_socket_factory, 34 net::ClientSocketFactory* client_socket_factory,
35 const net::SSLConfig& ssl_config, 35 const net::SSLConfig& ssl_config,
36 net::CertVerifier* cert_verifier,
36 size_t read_buf_size, 37 size_t read_buf_size,
37 size_t write_buf_size, 38 size_t write_buf_size,
38 net::NetLog* net_log) 39 net::NetLog* net_log)
39 : connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), 40 : connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
40 &ChromeAsyncSocket::ProcessConnectDone), 41 &ChromeAsyncSocket::ProcessConnectDone),
41 read_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), 42 read_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
42 &ChromeAsyncSocket::ProcessReadDone), 43 &ChromeAsyncSocket::ProcessReadDone),
43 write_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), 44 write_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
44 &ChromeAsyncSocket::ProcessWriteDone), 45 &ChromeAsyncSocket::ProcessWriteDone),
45 ssl_connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), 46 ssl_connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
46 &ChromeAsyncSocket::ProcessSSLConnectDone), 47 &ChromeAsyncSocket::ProcessSSLConnectDone),
47 client_socket_factory_(client_socket_factory), 48 client_socket_factory_(client_socket_factory),
48 ssl_config_(ssl_config), 49 ssl_config_(ssl_config),
50 cert_verifier_(cert_verifier),
49 bound_net_log_( 51 bound_net_log_(
50 net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_SOCKET)), 52 net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_SOCKET)),
51 state_(STATE_CLOSED), 53 state_(STATE_CLOSED),
52 error_(ERROR_NONE), 54 error_(ERROR_NONE),
53 net_error_(net::OK), 55 net_error_(net::OK),
54 scoped_runnable_method_factory_( 56 scoped_runnable_method_factory_(
55 ALLOW_THIS_IN_INITIALIZER_LIST(this)), 57 ALLOW_THIS_IN_INITIALIZER_LIST(this)),
56 read_state_(IDLE), 58 read_state_(IDLE),
57 read_buf_(new net::IOBufferWithSize(read_buf_size)), 59 read_buf_(new net::IOBufferWithSize(read_buf_size)),
58 read_start_(0U), 60 read_start_(0U),
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 DCHECK_EQ(write_end_, 0U); 433 DCHECK_EQ(write_end_, 0U);
432 434
433 // Clear out any posted DoRead() tasks. 435 // Clear out any posted DoRead() tasks.
434 scoped_runnable_method_factory_.RevokeAll(); 436 scoped_runnable_method_factory_.RevokeAll();
435 437
436 DCHECK(transport_socket_.get()); 438 DCHECK(transport_socket_.get());
437 transport_socket_.reset( 439 transport_socket_.reset(
438 client_socket_factory_->CreateSSLClientSocket( 440 client_socket_factory_->CreateSSLClientSocket(
439 transport_socket_.release(), net::HostPortPair(domain_name, 443), 441 transport_socket_.release(), net::HostPortPair(domain_name, 443),
440 ssl_config_, NULL /* ssl_host_info */, 442 ssl_config_, NULL /* ssl_host_info */,
441 NULL /* TODO(wtc): cert_verifier */)); 443 cert_verifier_));
442 int status = transport_socket_->Connect(&ssl_connect_callback_); 444 int status = transport_socket_->Connect(&ssl_connect_callback_);
443 if (status != net::ERR_IO_PENDING) { 445 if (status != net::ERR_IO_PENDING) {
444 MessageLoop* message_loop = MessageLoop::current(); 446 MessageLoop* message_loop = MessageLoop::current();
445 CHECK(message_loop); 447 CHECK(message_loop);
446 message_loop->PostTask( 448 message_loop->PostTask(
447 FROM_HERE, 449 FROM_HERE,
448 scoped_runnable_method_factory_.NewRunnableMethod( 450 scoped_runnable_method_factory_.NewRunnableMethod(
449 &ChromeAsyncSocket::ProcessSSLConnectDone, status)); 451 &ChromeAsyncSocket::ProcessSSLConnectDone, status));
450 } 452 }
451 return true; 453 return true;
(...skipping 18 matching lines...) Expand all
470 } 472 }
471 state_ = STATE_TLS_OPEN; 473 state_ = STATE_TLS_OPEN;
472 PostDoRead(); 474 PostDoRead();
473 if (write_end_ > 0U) { 475 if (write_end_ > 0U) {
474 PostDoWrite(); 476 PostDoWrite();
475 } 477 }
476 SignalSSLConnected(); 478 SignalSSLConnected();
477 } 479 }
478 480
479 } // namespace notifier 481 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698