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 "chrome/browser/chromeos/web_socket_proxy.h" | 5 #include "chrome/browser/chromeos/web_socket_proxy.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/common/chrome_notification_types.h" | 43 #include "chrome/common/chrome_notification_types.h" |
44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
45 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/notification_details.h" | 46 #include "content/public/browser/notification_details.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/notification_types.h" | 48 #include "content/public/browser/notification_types.h" |
49 #include "content/public/common/url_constants.h" | 49 #include "content/public/common/url_constants.h" |
50 #include "googleurl/src/gurl.h" | 50 #include "googleurl/src/gurl.h" |
51 #include "googleurl/src/url_parse.h" | 51 #include "googleurl/src/url_parse.h" |
52 #include "net/base/address_list.h" | 52 #include "net/base/address_list.h" |
53 #include "net/base/cert_verifier.h" | |
54 #include "net/base/host_port_pair.h" | 53 #include "net/base/host_port_pair.h" |
55 #include "net/base/io_buffer.h" | 54 #include "net/base/io_buffer.h" |
| 55 #include "net/base/multi_threaded_cert_verifier.h" |
56 #include "net/base/net_errors.h" | 56 #include "net/base/net_errors.h" |
57 #include "net/base/ssl_config_service.h" | 57 #include "net/base/ssl_config_service.h" |
58 #include "net/socket/client_socket_factory.h" | 58 #include "net/socket/client_socket_factory.h" |
59 #include "net/socket/client_socket_handle.h" | 59 #include "net/socket/client_socket_handle.h" |
60 #include "net/socket/ssl_client_socket.h" | 60 #include "net/socket/ssl_client_socket.h" |
61 #include "net/socket/stream_socket.h" | 61 #include "net/socket/stream_socket.h" |
62 #include "third_party/libevent/evdns.h" | 62 #include "third_party/libevent/evdns.h" |
63 #include "third_party/libevent/event.h" | 63 #include "third_party/libevent/event.h" |
64 | 64 |
65 using content::BrowserThread; | 65 using content::BrowserThread; |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 if (result) { | 608 if (result) { |
609 Shut(result); | 609 Shut(result); |
610 return; | 610 return; |
611 } | 611 } |
612 net::ClientSocketHandle* handle = new net::ClientSocketHandle(); | 612 net::ClientSocketHandle* handle = new net::ClientSocketHandle(); |
613 handle->set_socket(socket_.release()); | 613 handle->set_socket(socket_.release()); |
614 net::ClientSocketFactory* factory = | 614 net::ClientSocketFactory* factory = |
615 net::ClientSocketFactory::GetDefaultFactory(); | 615 net::ClientSocketFactory::GetDefaultFactory(); |
616 net::SSLClientSocketContext ssl_context; | 616 net::SSLClientSocketContext ssl_context; |
617 if (!cert_verifier_.get()) | 617 if (!cert_verifier_.get()) |
618 cert_verifier_.reset(new net::CertVerifier()); | 618 cert_verifier_.reset(new net::MultiThreadedCertVerifier()); |
619 ssl_context.cert_verifier = cert_verifier_.get(); | 619 ssl_context.cert_verifier = cert_verifier_.get(); |
620 socket_.reset(factory->CreateSSLClientSocket( | 620 socket_.reset(factory->CreateSSLClientSocket( |
621 handle, host_port_pair_, ssl_config_, NULL, ssl_context)); | 621 handle, host_port_pair_, ssl_config_, NULL, ssl_context)); |
622 if (!socket_.get()) { | 622 if (!socket_.get()) { |
623 LOG(WARNING) << "Failed to create an SSL client socket."; | 623 LOG(WARNING) << "Failed to create an SSL client socket."; |
624 OnSSLHandshakeCompleted(net::ERR_UNEXPECTED); | 624 OnSSLHandshakeCompleted(net::ERR_UNEXPECTED); |
625 return; | 625 return; |
626 } | 626 } |
627 result = socket_->Connect(base::Bind(&SSLChan::OnSSLHandshakeCompleted, | 627 result = socket_->Connect(base::Bind(&SSLChan::OnSSLHandshakeCompleted, |
628 base::Unretained(this))); | 628 base::Unretained(this))); |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 | 1898 |
1899 void WebSocketProxy::Shutdown() { | 1899 void WebSocketProxy::Shutdown() { |
1900 static_cast<Serv*>(impl_)->Shutdown(); | 1900 static_cast<Serv*>(impl_)->Shutdown(); |
1901 } | 1901 } |
1902 | 1902 |
1903 void WebSocketProxy::OnNetworkChange() { | 1903 void WebSocketProxy::OnNetworkChange() { |
1904 static_cast<Serv*>(impl_)->OnNetworkChange(); | 1904 static_cast<Serv*>(impl_)->OnNetworkChange(); |
1905 } | 1905 } |
1906 | 1906 |
1907 } // namespace chromeos | 1907 } // namespace chromeos |
OLD | NEW |