Chromium Code Reviews| 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_dispatcher_host.h" | 5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/socket_stream_host.h" | 8 #include "content/browser/renderer_host/socket_stream_host.h" |
| 9 #include "content/browser/ssl/ssl_manager.h" | 9 #include "content/browser/ssl/ssl_manager.h" |
| 10 #include "content/common/resource_messages.h" | 10 #include "content/common/resource_messages.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { | 92 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { |
| 93 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 93 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
| 94 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id; | 94 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id; |
| 95 if (socket_id == content::kNoSocketId) { | 95 if (socket_id == content::kNoSocketId) { |
| 96 LOG(ERROR) << "NoSocketId in OnClose"; | 96 LOG(ERROR) << "NoSocketId in OnClose"; |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 DeleteSocketStreamHost(socket_id); | 99 DeleteSocketStreamHost(socket_id); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SocketStreamDispatcherHost::OnError( | |
| 103 const net::SocketStream* socket, int error) { | |
|
Yuta Kitamura
2012/06/11 08:24:16
Function arguments should usually be placed in dif
| |
| 104 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | |
| 105 DVLOG(1) << "SocketStreamDispatcherHost::OnError socket_id=" << socket_id; | |
| 106 if (socket_id == content::kNoSocketId) { | |
| 107 LOG(ERROR) << "NoSocketId in OnError"; | |
| 108 return; | |
| 109 } | |
| 110 if (!Send(new SocketStreamMsg_Failed(socket_id, error))) { | |
|
Yuta Kitamura
2012/06/11 08:24:16
I suggest getting a reason message for |error| her
Li Yin
2012/06/12 08:54:20
Sending the error message sounds a good idea.
Mayb
Yuta Kitamura
2012/06/12 09:49:54
Yeah, it's perhaps better to do conversion after I
| |
| 111 LOG(ERROR) << "SocketStreamMsg_Failed failed."; | |
| 112 } | |
| 113 } | |
| 114 | |
| 102 void SocketStreamDispatcherHost::OnSSLCertificateError( | 115 void SocketStreamDispatcherHost::OnSSLCertificateError( |
| 103 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { | 116 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { |
| 104 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 117 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
| 105 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" | 118 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" |
| 106 << socket_id; | 119 << socket_id; |
| 107 if (socket_id == content::kNoSocketId) { | 120 if (socket_id == content::kNoSocketId) { |
| 108 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; | 121 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; |
| 109 return; | 122 return; |
| 110 } | 123 } |
| 111 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 124 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 hosts_.Remove(socket_id); | 232 hosts_.Remove(socket_id); |
| 220 if (!Send(new SocketStreamMsg_Closed(socket_id))) { | 233 if (!Send(new SocketStreamMsg_Closed(socket_id))) { |
| 221 LOG(ERROR) << "SocketStreamMsg_Closed failed."; | 234 LOG(ERROR) << "SocketStreamMsg_Closed failed."; |
| 222 } | 235 } |
| 223 } | 236 } |
| 224 | 237 |
| 225 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { | 238 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { |
| 226 return url_request_context_selector_->GetRequestContext( | 239 return url_request_context_selector_->GetRequestContext( |
| 227 ResourceType::SUB_RESOURCE); | 240 ResourceType::SUB_RESOURCE); |
| 228 } | 241 } |
| OLD | NEW |