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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/renderer_host/socket_stream_host.h" | 10 #include "content/browser/renderer_host/socket_stream_host.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 DVLOG(2) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" | 137 DVLOG(2) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" |
138 << socket_id; | 138 << socket_id; |
139 if (socket_id == kNoSocketId) { | 139 if (socket_id == kNoSocketId) { |
140 DVLOG(1) << "NoSocketId in OnSSLCertificateError"; | 140 DVLOG(1) << "NoSocketId in OnSSLCertificateError"; |
141 return; | 141 return; |
142 } | 142 } |
143 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 143 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
144 DCHECK(socket_stream_host); | 144 DCHECK(socket_stream_host); |
145 GlobalRequestID request_id(-1, socket_id); | 145 GlobalRequestID request_id(-1, socket_id); |
146 SSLManager::OnSSLCertificateError( | 146 SSLManager::OnSSLCertificateError( |
147 weak_ptr_factory_.GetWeakPtr(), request_id, ResourceType::SUB_RESOURCE, | 147 weak_ptr_factory_.GetWeakPtr(), request_id, RESOURCE_TYPE_SUB_RESOURCE, |
148 socket->url(), render_process_id_, socket_stream_host->render_frame_id(), | 148 socket->url(), render_process_id_, socket_stream_host->render_frame_id(), |
149 ssl_info, fatal); | 149 ssl_info, fatal); |
150 } | 150 } |
151 | 151 |
152 bool SocketStreamDispatcherHost::CanGetCookies(net::SocketStream* socket, | 152 bool SocketStreamDispatcherHost::CanGetCookies(net::SocketStream* socket, |
153 const GURL& url) { | 153 const GURL& url) { |
154 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 154 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
155 if (socket_id == kNoSocketId) { | 155 if (socket_id == kNoSocketId) { |
156 return false; | 156 return false; |
157 } | 157 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); | 280 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
281 DCHECK(socket_stream_host); | 281 DCHECK(socket_stream_host); |
282 delete socket_stream_host; | 282 delete socket_stream_host; |
283 hosts_.Remove(socket_id); | 283 hosts_.Remove(socket_id); |
284 if (!Send(new SocketStreamMsg_Closed(socket_id))) { | 284 if (!Send(new SocketStreamMsg_Closed(socket_id))) { |
285 DVLOG(1) << "SocketStreamMsg_Closed failed."; | 285 DVLOG(1) << "SocketStreamMsg_Closed failed."; |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { | 289 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { |
290 return request_context_callback_.Run(ResourceType::SUB_RESOURCE); | 290 return request_context_callback_.Run(RESOURCE_TYPE_SUB_RESOURCE); |
291 } | 291 } |
292 | 292 |
293 void SocketStreamDispatcherHost::Shutdown() { | 293 void SocketStreamDispatcherHost::Shutdown() { |
294 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 294 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
295 // TODO(ukai): Implement IDMap::RemoveAll(). | 295 // TODO(ukai): Implement IDMap::RemoveAll(). |
296 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_); | 296 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_); |
297 !iter.IsAtEnd(); | 297 !iter.IsAtEnd(); |
298 iter.Advance()) { | 298 iter.Advance()) { |
299 int socket_id = iter.GetCurrentKey(); | 299 int socket_id = iter.GetCurrentKey(); |
300 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 300 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
301 delete socket_stream_host; | 301 delete socket_stream_host; |
302 hosts_.Remove(socket_id); | 302 hosts_.Remove(socket_id); |
303 } | 303 } |
304 on_shutdown_ = true; | 304 on_shutdown_ = true; |
305 } | 305 } |
306 | 306 |
307 } // namespace content | 307 } // namespace content |
OLD | NEW |