| 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 "content/browser/renderer_host/socket_stream_host.h" | 5 #include "content/browser/renderer_host/socket_stream_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/socket_stream.h" | 8 #include "content/common/socket_stream.h" |
| 9 #include "net/socket_stream/socket_stream_job.h" | 9 #include "net/socket_stream/socket_stream_job.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 SocketStreamHost::~SocketStreamHost() { | 42 SocketStreamHost::~SocketStreamHost() { |
| 43 VLOG(1) << "SocketStreamHost destructed socket_id=" << socket_id_; | 43 VLOG(1) << "SocketStreamHost destructed socket_id=" << socket_id_; |
| 44 socket_->DetachDelegate(); | 44 socket_->DetachDelegate(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void SocketStreamHost::Connect(const GURL& url, | 47 void SocketStreamHost::Connect(const GURL& url, |
| 48 net::URLRequestContext* request_context) { | 48 net::URLRequestContext* request_context) { |
| 49 VLOG(1) << "SocketStreamHost::Connect url=" << url; | 49 VLOG(1) << "SocketStreamHost::Connect url=" << url; |
| 50 socket_ = net::SocketStreamJob::CreateSocketStreamJob( | 50 socket_ = net::SocketStreamJob::CreateSocketStreamJob( |
| 51 url, delegate_, *request_context); | 51 url, delegate_, request_context->transport_security_state(), |
| 52 request_context->ssl_config_service()); |
| 52 socket_->set_context(request_context); | 53 socket_->set_context(request_context); |
| 53 socket_->SetUserData(kSocketIdKey, new SocketStreamId(socket_id_)); | 54 socket_->SetUserData(kSocketIdKey, new SocketStreamId(socket_id_)); |
| 54 socket_->Connect(); | 55 socket_->Connect(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 bool SocketStreamHost::SendData(const std::vector<char>& data) { | 58 bool SocketStreamHost::SendData(const std::vector<char>& data) { |
| 58 VLOG(1) << "SocketStreamHost::SendData"; | 59 VLOG(1) << "SocketStreamHost::SendData"; |
| 59 return socket_ && socket_->SendData(&data[0], data.size()); | 60 return socket_ && socket_->SendData(&data[0], data.size()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void SocketStreamHost::Close() { | 63 void SocketStreamHost::Close() { |
| 63 VLOG(1) << "SocketStreamHost::Close"; | 64 VLOG(1) << "SocketStreamHost::Close"; |
| 64 if (!socket_) | 65 if (!socket_) |
| 65 return; | 66 return; |
| 66 socket_->Close(); | 67 socket_->Close(); |
| 67 } | 68 } |
| OLD | NEW |