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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { | 94 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { |
95 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 95 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
96 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id; | 96 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id; |
97 if (socket_id == kNoSocketId) { | 97 if (socket_id == kNoSocketId) { |
98 LOG(ERROR) << "NoSocketId in OnClose"; | 98 LOG(ERROR) << "NoSocketId in OnClose"; |
99 return; | 99 return; |
100 } | 100 } |
101 DeleteSocketStreamHost(socket_id); | 101 DeleteSocketStreamHost(socket_id); |
102 } | 102 } |
103 | 103 |
104 void SocketStreamDispatcherHost::OnError(const net::SocketStream* socket, | |
105 int error) { | |
106 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | |
107 DVLOG(1) << "SocketStreamDispatcherHost::OnError socket_id=" << socket_id; | |
108 if (socket_id == content::kNoSocketId) { | |
109 LOG(ERROR) << "NoSocketId in OnError"; | |
110 return; | |
111 } | |
112 // SocketStream::Delegate::OnError() events are handled as WebSocket error | |
113 // event when user agent was required to fail WebSocket connection or the | |
114 // WebSocket connection is closed with prejudice. | |
115 if (!Send(new SocketStreamMsg_Failed(socket_id, error))) { | |
116 LOG(ERROR) << "SocketStreamMsg_Failed failed."; | |
117 DeleteSocketStreamHost(socket_id); | |
118 } | |
119 } | |
120 | |
121 void SocketStreamDispatcherHost::OnSSLCertificateError( | 104 void SocketStreamDispatcherHost::OnSSLCertificateError( |
122 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { | 105 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { |
123 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 106 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
124 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" | 107 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" |
125 << socket_id; | 108 << socket_id; |
126 if (socket_id == kNoSocketId) { | 109 if (socket_id == kNoSocketId) { |
127 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; | 110 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; |
128 return; | 111 return; |
129 } | 112 } |
130 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 113 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 LOG(ERROR) << "SocketStreamMsg_Closed failed."; | 223 LOG(ERROR) << "SocketStreamMsg_Closed failed."; |
241 } | 224 } |
242 } | 225 } |
243 | 226 |
244 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { | 227 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { |
245 return url_request_context_selector_->GetRequestContext( | 228 return url_request_context_selector_->GetRequestContext( |
246 ResourceType::SUB_RESOURCE); | 229 ResourceType::SUB_RESOURCE); |
247 } | 230 } |
248 | 231 |
249 } // namespace content | 232 } // namespace content |
OLD | NEW |