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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, ResourceType::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); |
| 155 if (socket_id == kNoSocketId) { |
| 156 return false; |
| 157 } |
| 158 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
| 159 DCHECK(socket_stream_host); |
154 return GetContentClient()->browser()->AllowGetCookie( | 160 return GetContentClient()->browser()->AllowGetCookie( |
155 url, url, net::CookieList(), resource_context_, 0, MSG_ROUTING_NONE); | 161 url, |
| 162 url, |
| 163 net::CookieList(), |
| 164 resource_context_, |
| 165 render_process_id_, |
| 166 socket_stream_host->render_frame_id()); |
156 } | 167 } |
157 | 168 |
158 bool SocketStreamDispatcherHost::CanSetCookie(net::SocketStream* request, | 169 bool SocketStreamDispatcherHost::CanSetCookie(net::SocketStream* request, |
159 const GURL& url, | 170 const GURL& url, |
160 const std::string& cookie_line, | 171 const std::string& cookie_line, |
161 net::CookieOptions* options) { | 172 net::CookieOptions* options) { |
| 173 int socket_id = SocketStreamHost::SocketIdFromSocketStream(request); |
| 174 if (socket_id == kNoSocketId) { |
| 175 return false; |
| 176 } |
| 177 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); |
| 178 DCHECK(socket_stream_host); |
162 return GetContentClient()->browser()->AllowSetCookie( | 179 return GetContentClient()->browser()->AllowSetCookie( |
163 url, url, cookie_line, resource_context_, 0, MSG_ROUTING_NONE, options); | 180 url, |
| 181 url, |
| 182 cookie_line, |
| 183 resource_context_, |
| 184 render_process_id_, |
| 185 socket_stream_host->render_frame_id(), |
| 186 options); |
164 } | 187 } |
165 | 188 |
166 void SocketStreamDispatcherHost::CancelSSLRequest( | 189 void SocketStreamDispatcherHost::CancelSSLRequest( |
167 const GlobalRequestID& id, | 190 const GlobalRequestID& id, |
168 int error, | 191 int error, |
169 const net::SSLInfo* ssl_info) { | 192 const net::SSLInfo* ssl_info) { |
170 int socket_id = id.request_id; | 193 int socket_id = id.request_id; |
171 DVLOG(2) << "SocketStreamDispatcherHost::CancelSSLRequest socket_id=" | 194 DVLOG(2) << "SocketStreamDispatcherHost::CancelSSLRequest socket_id=" |
172 << socket_id; | 195 << socket_id; |
173 DCHECK_NE(kNoSocketId, socket_id); | 196 DCHECK_NE(kNoSocketId, socket_id); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 iter.Advance()) { | 298 iter.Advance()) { |
276 int socket_id = iter.GetCurrentKey(); | 299 int socket_id = iter.GetCurrentKey(); |
277 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 300 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
278 delete socket_stream_host; | 301 delete socket_stream_host; |
279 hosts_.Remove(socket_id); | 302 hosts_.Remove(socket_id); |
280 } | 303 } |
281 on_shutdown_ = true; | 304 on_shutdown_ = true; |
282 } | 305 } |
283 | 306 |
284 } // namespace content | 307 } // namespace content |
OLD | NEW |