OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/profile.h" | 26 #include "chrome/browser/profile.h" |
27 #include "chrome/browser/renderer_host/async_resource_handler.h" | 27 #include "chrome/browser/renderer_host/async_resource_handler.h" |
28 #include "chrome/browser/renderer_host/buffered_resource_handler.h" | 28 #include "chrome/browser/renderer_host/buffered_resource_handler.h" |
29 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" | 29 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" |
30 #include "chrome/browser/renderer_host/download_resource_handler.h" | 30 #include "chrome/browser/renderer_host/download_resource_handler.h" |
31 #include "chrome/browser/renderer_host/render_view_host.h" | 31 #include "chrome/browser/renderer_host/render_view_host.h" |
32 #include "chrome/browser/renderer_host/resource_request_details.h" | 32 #include "chrome/browser/renderer_host/resource_request_details.h" |
33 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" | 33 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" |
34 #include "chrome/browser/renderer_host/save_file_resource_handler.h" | 34 #include "chrome/browser/renderer_host/save_file_resource_handler.h" |
35 #include "chrome/browser/renderer_host/sync_resource_handler.h" | 35 #include "chrome/browser/renderer_host/sync_resource_handler.h" |
| 36 #include "chrome/browser/ssl/ssl_client_auth_handler.h" |
36 #include "chrome/browser/tab_contents/tab_util.h" | 37 #include "chrome/browser/tab_contents/tab_util.h" |
37 #include "chrome/browser/tab_contents/tab_contents.h" | 38 #include "chrome/browser/tab_contents/tab_contents.h" |
38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/notification_service.h" | 40 #include "chrome/common/notification_service.h" |
40 #include "chrome/common/render_messages.h" | 41 #include "chrome/common/render_messages.h" |
41 #include "net/base/auth.h" | 42 #include "net/base/auth.h" |
42 #include "net/base/cert_status_flags.h" | 43 #include "net/base/cert_status_flags.h" |
43 #include "net/base/load_flags.h" | 44 #include "net/base/load_flags.h" |
44 #include "net/base/mime_util.h" | 45 #include "net/base/mime_util.h" |
45 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 } | 639 } |
639 | 640 |
640 // WebKit will send us a cancel for downloads since it no longer handles them. | 641 // WebKit will send us a cancel for downloads since it no longer handles them. |
641 // In this case, ignore the cancel since we handle downloads in the browser. | 642 // In this case, ignore the cancel since we handle downloads in the browser. |
642 ExtraRequestInfo* info = ExtraInfoForRequest(i->second); | 643 ExtraRequestInfo* info = ExtraInfoForRequest(i->second); |
643 if (!from_renderer || !info->is_download) { | 644 if (!from_renderer || !info->is_download) { |
644 if (info->login_handler) { | 645 if (info->login_handler) { |
645 info->login_handler->OnRequestCancelled(); | 646 info->login_handler->OnRequestCancelled(); |
646 info->login_handler = NULL; | 647 info->login_handler = NULL; |
647 } | 648 } |
| 649 if (info->ssl_client_auth_handler) { |
| 650 info->ssl_client_auth_handler->OnRequestCancelled(); |
| 651 info->ssl_client_auth_handler = NULL; |
| 652 } |
648 if (!i->second->is_pending() && allow_delete) { | 653 if (!i->second->is_pending() && allow_delete) { |
649 // No io is pending, canceling the request won't notify us of anything, | 654 // No io is pending, canceling the request won't notify us of anything, |
650 // so we explicitly remove it. | 655 // so we explicitly remove it. |
651 // TODO(sky): removing the request in this manner means we're not | 656 // TODO(sky): removing the request in this manner means we're not |
652 // notifying anyone. We need make sure the event handlers and others are | 657 // notifying anyone. We need make sure the event handlers and others are |
653 // notified so that everything is cleaned up properly. | 658 // notified so that everything is cleaned up properly. |
654 RemovePendingRequest(info->process_id, info->request_id); | 659 RemovePendingRequest(info->process_id, info->request_id); |
655 } else { | 660 } else { |
656 i->second->Cancel(); | 661 i->second->Cancel(); |
657 } | 662 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 DCHECK(!info->login_handler) << | 877 DCHECK(!info->login_handler) << |
873 "OnAuthRequired called with login_handler pending"; | 878 "OnAuthRequired called with login_handler pending"; |
874 info->login_handler = CreateLoginPrompt(auth_info, request, ui_loop_); | 879 info->login_handler = CreateLoginPrompt(auth_info, request, ui_loop_); |
875 } | 880 } |
876 | 881 |
877 void ResourceDispatcherHost::OnCertificateRequested( | 882 void ResourceDispatcherHost::OnCertificateRequested( |
878 URLRequest* request, | 883 URLRequest* request, |
879 net::SSLCertRequestInfo* cert_request_info) { | 884 net::SSLCertRequestInfo* cert_request_info) { |
880 DCHECK(request); | 885 DCHECK(request); |
881 | 886 |
882 bool select_first_cert = CommandLine::ForCurrentProcess()->HasSwitch( | 887 if (cert_request_info->client_certs.empty()) { |
883 switches::kAutoSSLClientAuth); | 888 // No need to query the user if there are no certs to choose from. |
884 net::X509Certificate* cert = | 889 request->ContinueWithCertificate(NULL); |
885 select_first_cert && !cert_request_info->client_certs.empty() ? | 890 return; |
886 cert_request_info->client_certs[0] : NULL; | 891 } |
887 request->ContinueWithCertificate(cert); | 892 |
| 893 ExtraRequestInfo* info = ExtraInfoForRequest(request); |
| 894 DCHECK(!info->ssl_client_auth_handler) << |
| 895 "OnCertificateRequested called with ssl_client_auth_handler pending"; |
| 896 info->ssl_client_auth_handler = |
| 897 new SSLClientAuthHandler(request, cert_request_info, io_loop_, ui_loop_); |
| 898 info->ssl_client_auth_handler->SelectCertificate(); |
888 } | 899 } |
889 | 900 |
890 void ResourceDispatcherHost::OnSSLCertificateError( | 901 void ResourceDispatcherHost::OnSSLCertificateError( |
891 URLRequest* request, | 902 URLRequest* request, |
892 int cert_error, | 903 int cert_error, |
893 net::X509Certificate* cert) { | 904 net::X509Certificate* cert) { |
894 DCHECK(request); | 905 DCHECK(request); |
895 SSLManager::OnSSLCertificateError(this, request, cert_error, cert, ui_loop_); | 906 SSLManager::OnSSLCertificateError(this, request, cert_error, cert, ui_loop_); |
896 } | 907 } |
897 | 908 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 case ViewHostMsg_UploadProgress_ACK::ID: | 1577 case ViewHostMsg_UploadProgress_ACK::ID: |
1567 case ViewHostMsg_SyncLoad::ID: | 1578 case ViewHostMsg_SyncLoad::ID: |
1568 return true; | 1579 return true; |
1569 | 1580 |
1570 default: | 1581 default: |
1571 break; | 1582 break; |
1572 } | 1583 } |
1573 | 1584 |
1574 return false; | 1585 return false; |
1575 } | 1586 } |
OLD | NEW |