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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 info->set_ssl_client_auth_handler( | 1485 info->set_ssl_client_auth_handler( |
1486 new SSLClientAuthHandler(request, cert_request_info)); | 1486 new SSLClientAuthHandler(request, cert_request_info)); |
1487 info->ssl_client_auth_handler()->SelectCertificate(); | 1487 info->ssl_client_auth_handler()->SelectCertificate(); |
1488 } | 1488 } |
1489 | 1489 |
1490 void ResourceDispatcherHostImpl::OnSSLCertificateError( | 1490 void ResourceDispatcherHostImpl::OnSSLCertificateError( |
1491 net::URLRequest* request, | 1491 net::URLRequest* request, |
1492 const net::SSLInfo& ssl_info, | 1492 const net::SSLInfo& ssl_info, |
1493 bool is_hsts_host) { | 1493 bool is_hsts_host) { |
1494 DCHECK(request); | 1494 DCHECK(request); |
1495 SSLManager::OnSSLCertificateError(request, ssl_info, is_hsts_host); | 1495 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
| 1496 DCHECK(info); |
| 1497 GlobalRequestID request_id(info->GetChildID(), info->GetRequestID()); |
| 1498 int render_process_id; |
| 1499 int render_view_id; |
| 1500 if(!info->GetAssociatedRenderView(&render_process_id, &render_view_id)) |
| 1501 NOTREACHED(); |
| 1502 SSLManager::OnSSLCertificateError(this, request_id, info->GetResourceType(), |
| 1503 request->url(), render_process_id, render_view_id, ssl_info, |
| 1504 is_hsts_host); |
1496 } | 1505 } |
1497 | 1506 |
1498 void ResourceDispatcherHostImpl::OnResponseStarted(net::URLRequest* request) { | 1507 void ResourceDispatcherHostImpl::OnResponseStarted(net::URLRequest* request) { |
1499 VLOG(1) << "OnResponseStarted: " << request->url().spec(); | 1508 VLOG(1) << "OnResponseStarted: " << request->url().spec(); |
1500 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1509 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1501 | 1510 |
1502 if (request->status().is_success()) { | 1511 if (request->status().is_success()) { |
1503 if (PauseRequestIfNeeded(info)) { | 1512 if (PauseRequestIfNeeded(info)) { |
1504 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); | 1513 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); |
1505 return; | 1514 return; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 } | 1949 } |
1941 | 1950 |
1942 void ResourceDispatcherHostImpl::CallResponseCompleted(int child_id, | 1951 void ResourceDispatcherHostImpl::CallResponseCompleted(int child_id, |
1943 int request_id) { | 1952 int request_id) { |
1944 PendingRequestList::iterator i = pending_requests_.find( | 1953 PendingRequestList::iterator i = pending_requests_.find( |
1945 GlobalRequestID(child_id, request_id)); | 1954 GlobalRequestID(child_id, request_id)); |
1946 if (i != pending_requests_.end()) | 1955 if (i != pending_requests_.end()) |
1947 ResponseCompleted(i->second); | 1956 ResponseCompleted(i->second); |
1948 } | 1957 } |
1949 | 1958 |
| 1959 // SSLErrorHandler::Delegate --------------------------------------------------- |
| 1960 |
| 1961 void ResourceDispatcherHostImpl::CancelSSLRequest( |
| 1962 const GlobalRequestID& id, |
| 1963 int error, |
| 1964 const net::SSLInfo* ssl_info) { |
| 1965 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1966 net::URLRequest* request = GetURLRequest(id); |
| 1967 // The request can be NULL if it was cancelled by the renderer (as the |
| 1968 // request of the user navigating to a new page from the location bar). |
| 1969 if (!request || !request->is_pending()) |
| 1970 return; |
| 1971 DVLOG(1) << "CancelSSLRequest() url: " << request->url().spec(); |
| 1972 // TODO(toyoshim): Following method names SimulateSSLError() and |
| 1973 // SimulateError() looks inconsistent with other Cancel methods. |
| 1974 if (ssl_info) |
| 1975 request->SimulateSSLError(error, *ssl_info); |
| 1976 else |
| 1977 request->SimulateError(error); |
| 1978 } |
| 1979 |
| 1980 void ResourceDispatcherHostImpl::ContinueSSLRequest( |
| 1981 const GlobalRequestID& id) { |
| 1982 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1983 net::URLRequest* request = GetURLRequest(id); |
| 1984 // The request can be NULL if it was cancelled by the renderer (as the |
| 1985 // request of the user navigating to a new page from the location bar). |
| 1986 if (!request) |
| 1987 return; |
| 1988 DVLOG(1) << "ContinueSSLRequest() url: " << request->url().spec(); |
| 1989 request->ContinueDespiteLastError(); |
| 1990 } |
| 1991 |
1950 void ResourceDispatcherHostImpl::OnUserGesture(TabContents* tab) { | 1992 void ResourceDispatcherHostImpl::OnUserGesture(TabContents* tab) { |
1951 last_user_gesture_time_ = TimeTicks::Now(); | 1993 last_user_gesture_time_ = TimeTicks::Now(); |
1952 } | 1994 } |
1953 | 1995 |
1954 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( | 1996 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( |
1955 const GlobalRequestID& request_id) const { | 1997 const GlobalRequestID& request_id) const { |
1956 // This should be running in the IO loop. | 1998 // This should be running in the IO loop. |
1957 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1999 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1958 | 2000 |
1959 PendingRequestList::const_iterator i = pending_requests_.find(request_id); | 2001 PendingRequestList::const_iterator i = pending_requests_.find(request_id); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 return allow_cross_origin_auth_prompt_; | 2296 return allow_cross_origin_auth_prompt_; |
2255 } | 2297 } |
2256 | 2298 |
2257 bool ResourceDispatcherHostImpl::IsTransferredNavigation( | 2299 bool ResourceDispatcherHostImpl::IsTransferredNavigation( |
2258 const GlobalRequestID& transferred_request_id) const { | 2300 const GlobalRequestID& transferred_request_id) const { |
2259 return transferred_navigations_.find(transferred_request_id) != | 2301 return transferred_navigations_.find(transferred_request_id) != |
2260 transferred_navigations_.end(); | 2302 transferred_navigations_.end(); |
2261 } | 2303 } |
2262 | 2304 |
2263 } // namespace content | 2305 } // namespace content |
OLD | NEW |