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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1471 info->set_ssl_client_auth_handler( | 1471 info->set_ssl_client_auth_handler( |
1472 new SSLClientAuthHandler(request, cert_request_info)); | 1472 new SSLClientAuthHandler(request, cert_request_info)); |
1473 info->ssl_client_auth_handler()->SelectCertificate(); | 1473 info->ssl_client_auth_handler()->SelectCertificate(); |
1474 } | 1474 } |
1475 | 1475 |
1476 void ResourceDispatcherHostImpl::OnSSLCertificateError( | 1476 void ResourceDispatcherHostImpl::OnSSLCertificateError( |
1477 net::URLRequest* request, | 1477 net::URLRequest* request, |
1478 const net::SSLInfo& ssl_info, | 1478 const net::SSLInfo& ssl_info, |
1479 bool is_hsts_host) { | 1479 bool is_hsts_host) { |
1480 DCHECK(request); | 1480 DCHECK(request); |
1481 SSLManager::OnSSLCertificateError(request, ssl_info, is_hsts_host); | 1481 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1482 DCHECK(info); | |
1483 GlobalRequestID request_id(info->GetChildID(), info->GetRequestID()); | |
1484 int render_process_id; | |
1485 int render_view_id; | |
1486 if(!info->GetAssociatedRenderView(&render_process_id, &render_view_id)) | |
1487 NOTREACHED(); | |
1488 SSLManager::OnSSLCertificateError(this, request_id, info->GetResourceType(), | |
1489 request->url(), render_process_id, render_view_id, ssl_info, | |
1490 is_hsts_host); | |
1482 } | 1491 } |
1483 | 1492 |
1484 void ResourceDispatcherHostImpl::OnResponseStarted(net::URLRequest* request) { | 1493 void ResourceDispatcherHostImpl::OnResponseStarted(net::URLRequest* request) { |
1485 VLOG(1) << "OnResponseStarted: " << request->url().spec(); | 1494 VLOG(1) << "OnResponseStarted: " << request->url().spec(); |
1486 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1495 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1487 | 1496 |
1488 if (request->status().is_success()) { | 1497 if (request->status().is_success()) { |
1489 if (PauseRequestIfNeeded(info)) { | 1498 if (PauseRequestIfNeeded(info)) { |
1490 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); | 1499 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); |
1491 return; | 1500 return; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1926 } | 1935 } |
1927 | 1936 |
1928 void ResourceDispatcherHostImpl::CallResponseCompleted(int child_id, | 1937 void ResourceDispatcherHostImpl::CallResponseCompleted(int child_id, |
1929 int request_id) { | 1938 int request_id) { |
1930 PendingRequestList::iterator i = pending_requests_.find( | 1939 PendingRequestList::iterator i = pending_requests_.find( |
1931 GlobalRequestID(child_id, request_id)); | 1940 GlobalRequestID(child_id, request_id)); |
1932 if (i != pending_requests_.end()) | 1941 if (i != pending_requests_.end()) |
1933 ResponseCompleted(i->second); | 1942 ResponseCompleted(i->second); |
1934 } | 1943 } |
1935 | 1944 |
1945 // SSLErrorHandler::Delegate --------------------------------------------------- | |
darin (slow to review)
2012/03/12 22:10:16
nit: add a new line below here
Takashi Toyoshima
2012/03/12 22:13:18
Done.
| |
1946 void ResourceDispatcherHostImpl::CancelSSLRequest( | |
1947 const GlobalRequestID& id, | |
1948 int error, | |
1949 const net::SSLInfo* ssl_info) { | |
1950 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
1951 net::URLRequest* request = GetURLRequest(id); | |
1952 // The request can be NULL if it was cancelled by the renderer (as the | |
1953 // request of the user navigating to a new page from the location bar). | |
1954 if (!request || !request->is_pending()) | |
1955 return; | |
1956 DVLOG(1) << "CancelSSLRequest() url: " << request->url().spec(); | |
1957 // TODO(toyoshim): Following method names SimulateSSLError() and | |
1958 // SimulateError() looks inconsistent with other Cancel methods. | |
1959 if (ssl_info) | |
1960 request->SimulateSSLError(error, *ssl_info); | |
1961 else | |
1962 request->SimulateError(error); | |
1963 } | |
1964 | |
1965 void ResourceDispatcherHostImpl::ContinueSSLRequest( | |
1966 const GlobalRequestID& id) { | |
1967 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
1968 net::URLRequest* request = GetURLRequest(id); | |
1969 // The request can be NULL if it was cancelled by the renderer (as the | |
1970 // request of the user navigating to a new page from the location bar). | |
1971 if (!request) | |
1972 return; | |
1973 DVLOG(1) << "ContinueSSLRequest() url: " << request->url().spec(); | |
1974 request->ContinueDespiteLastError(); | |
1975 } | |
1976 | |
1936 void ResourceDispatcherHostImpl::OnUserGesture(TabContents* tab) { | 1977 void ResourceDispatcherHostImpl::OnUserGesture(TabContents* tab) { |
1937 last_user_gesture_time_ = TimeTicks::Now(); | 1978 last_user_gesture_time_ = TimeTicks::Now(); |
1938 } | 1979 } |
1939 | 1980 |
1940 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( | 1981 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( |
1941 const GlobalRequestID& request_id) const { | 1982 const GlobalRequestID& request_id) const { |
1942 // This should be running in the IO loop. | 1983 // This should be running in the IO loop. |
1943 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1984 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1944 | 1985 |
1945 PendingRequestList::const_iterator i = pending_requests_.find(request_id); | 1986 PendingRequestList::const_iterator i = pending_requests_.find(request_id); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2240 return allow_cross_origin_auth_prompt_; | 2281 return allow_cross_origin_auth_prompt_; |
2241 } | 2282 } |
2242 | 2283 |
2243 bool ResourceDispatcherHostImpl::IsTransferredNavigation( | 2284 bool ResourceDispatcherHostImpl::IsTransferredNavigation( |
2244 const GlobalRequestID& transferred_request_id) const { | 2285 const GlobalRequestID& transferred_request_id) const { |
2245 return transferred_navigations_.find(transferred_request_id) != | 2286 return transferred_navigations_.find(transferred_request_id) != |
2246 transferred_navigations_.end(); | 2287 transferred_navigations_.end(); |
2247 } | 2288 } |
2248 | 2289 |
2249 } // namespace content | 2290 } // namespace content |
OLD | NEW |