| 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 "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 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 socket_ = net::SocketStreamJob::CreateSocketStreamJob( | 60 socket_ = net::SocketStreamJob::CreateSocketStreamJob( |
| 61 url, delegate_, request_context->transport_security_state(), | 61 url, delegate_, request_context->transport_security_state(), |
| 62 request_context->ssl_config_service()); | 62 request_context->ssl_config_service()); |
| 63 socket_->set_context(request_context); | 63 socket_->set_context(request_context); |
| 64 socket_->SetUserData(kSocketIdKey, new SocketStreamId(socket_id_)); | 64 socket_->SetUserData(kSocketIdKey, new SocketStreamId(socket_id_)); |
| 65 socket_->Connect(); | 65 socket_->Connect(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool SocketStreamHost::SendData(const std::vector<char>& data) { | 68 bool SocketStreamHost::SendData(const std::vector<char>& data) { |
| 69 VLOG(1) << "SocketStreamHost::SendData"; | 69 VLOG(1) << "SocketStreamHost::SendData"; |
| 70 return socket_ && socket_->SendData(&data[0], data.size()); | 70 return socket_.get() && socket_->SendData(&data[0], data.size()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SocketStreamHost::Close() { | 73 void SocketStreamHost::Close() { |
| 74 VLOG(1) << "SocketStreamHost::Close"; | 74 VLOG(1) << "SocketStreamHost::Close"; |
| 75 if (!socket_) | 75 if (!socket_.get()) |
| 76 return; | 76 return; |
| 77 socket_->Close(); | 77 socket_->Close(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void SocketStreamHost::CancelWithError(int error) { | 80 void SocketStreamHost::CancelWithError(int error) { |
| 81 VLOG(1) << "SocketStreamHost::CancelWithError: error=" << error; | 81 VLOG(1) << "SocketStreamHost::CancelWithError: error=" << error; |
| 82 if (!socket_) | 82 if (!socket_.get()) |
| 83 return; | 83 return; |
| 84 socket_->CancelWithError(error); | 84 socket_->CancelWithError(error); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SocketStreamHost::CancelWithSSLError(const net::SSLInfo& ssl_info) { | 87 void SocketStreamHost::CancelWithSSLError(const net::SSLInfo& ssl_info) { |
| 88 VLOG(1) << "SocketStreamHost::CancelWithSSLError"; | 88 VLOG(1) << "SocketStreamHost::CancelWithSSLError"; |
| 89 if (!socket_) | 89 if (!socket_.get()) |
| 90 return; | 90 return; |
| 91 socket_->CancelWithSSLError(ssl_info); | 91 socket_->CancelWithSSLError(ssl_info); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void SocketStreamHost::ContinueDespiteError() { | 94 void SocketStreamHost::ContinueDespiteError() { |
| 95 VLOG(1) << "SocketStreamHost::ContinueDespiteError"; | 95 VLOG(1) << "SocketStreamHost::ContinueDespiteError"; |
| 96 if (!socket_) | 96 if (!socket_.get()) |
| 97 return; | 97 return; |
| 98 socket_->ContinueDespiteError(); | 98 socket_->ContinueDespiteError(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace content | 101 } // namespace content |
| OLD | NEW |