| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 return; | 700 return; |
| 701 } | 701 } |
| 702 | 702 |
| 703 // Ensure the Chrome plugins are loaded, as they may intercept network | 703 // Ensure the Chrome plugins are loaded, as they may intercept network |
| 704 // requests. Does nothing if they are already loaded. | 704 // requests. Does nothing if they are already loaded. |
| 705 PluginService::GetInstance()->LoadChromePlugins(this); | 705 PluginService::GetInstance()->LoadChromePlugins(this); |
| 706 URLRequest* request = new URLRequest(url, this); | 706 URLRequest* request = new URLRequest(url, this); |
| 707 | 707 |
| 708 request_id_--; | 708 request_id_--; |
| 709 | 709 |
| 710 scoped_refptr<ResourceHandler> handler = | 710 scoped_refptr<ResourceHandler> handler( |
| 711 new DownloadResourceHandler(this, | 711 new DownloadResourceHandler(this, |
| 712 child_id, | 712 child_id, |
| 713 route_id, | 713 route_id, |
| 714 request_id_, | 714 request_id_, |
| 715 url, | 715 url, |
| 716 download_file_manager_.get(), | 716 download_file_manager_.get(), |
| 717 request, | 717 request, |
| 718 prompt_for_save_location, | 718 prompt_for_save_location, |
| 719 save_info); | 719 save_info)); |
| 720 | 720 |
| 721 if (safe_browsing_->enabled()) { | 721 if (safe_browsing_->enabled()) { |
| 722 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, | 722 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, |
| 723 ResourceType::MAIN_FRAME); | 723 ResourceType::MAIN_FRAME); |
| 724 } | 724 } |
| 725 | 725 |
| 726 if (!URLRequest::IsHandledURL(url)) { | 726 if (!URLRequest::IsHandledURL(url)) { |
| 727 VLOG(1) << "Download request for unsupported protocol: " | 727 VLOG(1) << "Download request for unsupported protocol: " |
| 728 << url.possibly_invalid_spec(); | 728 << url.possibly_invalid_spec(); |
| 729 return; | 729 return; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 750 int child_id, | 750 int child_id, |
| 751 int route_id, | 751 int route_id, |
| 752 URLRequestContext* request_context) { | 752 URLRequestContext* request_context) { |
| 753 if (is_shutdown_) | 753 if (is_shutdown_) |
| 754 return; | 754 return; |
| 755 | 755 |
| 756 // Ensure the Chrome plugins are loaded, as they may intercept network | 756 // Ensure the Chrome plugins are loaded, as they may intercept network |
| 757 // requests. Does nothing if they are already loaded. | 757 // requests. Does nothing if they are already loaded. |
| 758 PluginService::GetInstance()->LoadChromePlugins(this); | 758 PluginService::GetInstance()->LoadChromePlugins(this); |
| 759 | 759 |
| 760 scoped_refptr<ResourceHandler> handler = | 760 scoped_refptr<ResourceHandler> handler( |
| 761 new SaveFileResourceHandler(child_id, | 761 new SaveFileResourceHandler(child_id, |
| 762 route_id, | 762 route_id, |
| 763 url, | 763 url, |
| 764 save_file_manager_.get()); | 764 save_file_manager_.get())); |
| 765 request_id_--; | 765 request_id_--; |
| 766 | 766 |
| 767 bool known_proto = URLRequest::IsHandledURL(url); | 767 bool known_proto = URLRequest::IsHandledURL(url); |
| 768 if (!known_proto) { | 768 if (!known_proto) { |
| 769 // Since any URLs which have non-standard scheme have been filtered | 769 // Since any URLs which have non-standard scheme have been filtered |
| 770 // by save manager(see GURL::SchemeIsStandard). This situation | 770 // by save manager(see GURL::SchemeIsStandard). This situation |
| 771 // should not happen. | 771 // should not happen. |
| 772 NOTREACHED(); | 772 NOTREACHED(); |
| 773 return; | 773 return; |
| 774 } | 774 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 NotifyReceivedRedirect(request, info->child_id(), new_url); | 1016 NotifyReceivedRedirect(request, info->child_id(), new_url); |
| 1017 | 1017 |
| 1018 if (HandleExternalProtocol(info->request_id(), info->child_id(), | 1018 if (HandleExternalProtocol(info->request_id(), info->child_id(), |
| 1019 info->route_id(), new_url, | 1019 info->route_id(), new_url, |
| 1020 info->resource_type(), info->resource_handler())) { | 1020 info->resource_type(), info->resource_handler())) { |
| 1021 // The request is complete so we can remove it. | 1021 // The request is complete so we can remove it. |
| 1022 RemovePendingRequest(info->child_id(), info->request_id()); | 1022 RemovePendingRequest(info->child_id(), info->request_id()); |
| 1023 return; | 1023 return; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 scoped_refptr<ResourceResponse> response = new ResourceResponse; | 1026 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 1027 PopulateResourceResponse(request, | 1027 PopulateResourceResponse(request, |
| 1028 info->replace_extension_localization_templates(), response); | 1028 info->replace_extension_localization_templates(), response); |
| 1029 if (!info->resource_handler()->OnRequestRedirected(info->request_id(), | 1029 if (!info->resource_handler()->OnRequestRedirected(info->request_id(), |
| 1030 new_url, | 1030 new_url, |
| 1031 response, defer_redirect)) | 1031 response, defer_redirect)) |
| 1032 CancelRequestInternal(request, false); | 1032 CancelRequestInternal(request, false); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 void ResourceDispatcherHost::OnAuthRequired( | 1035 void ResourceDispatcherHost::OnAuthRequired( |
| 1036 URLRequest* request, | 1036 URLRequest* request, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 StartReading(request); | 1116 StartReading(request); |
| 1117 } | 1117 } |
| 1118 } else { | 1118 } else { |
| 1119 OnResponseCompleted(request); | 1119 OnResponseCompleted(request); |
| 1120 } | 1120 } |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 bool ResourceDispatcherHost::CompleteResponseStarted(URLRequest* request) { | 1123 bool ResourceDispatcherHost::CompleteResponseStarted(URLRequest* request) { |
| 1124 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1124 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 1125 | 1125 |
| 1126 scoped_refptr<ResourceResponse> response = new ResourceResponse; | 1126 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 1127 PopulateResourceResponse(request, | 1127 PopulateResourceResponse(request, |
| 1128 info->replace_extension_localization_templates(), response); | 1128 info->replace_extension_localization_templates(), response); |
| 1129 | 1129 |
| 1130 if (request->ssl_info().cert) { | 1130 if (request->ssl_info().cert) { |
| 1131 int cert_id = | 1131 int cert_id = |
| 1132 CertStore::GetSharedInstance()->StoreCert(request->ssl_info().cert, | 1132 CertStore::GetSharedInstance()->StoreCert(request->ssl_info().cert, |
| 1133 info->child_id()); | 1133 info->child_id()); |
| 1134 response->response_head.security_info = | 1134 response->response_head.security_info = |
| 1135 SSLManager::SerializeSecurityInfo( | 1135 SSLManager::SerializeSecurityInfo( |
| 1136 cert_id, request->ssl_info().cert_status, | 1136 cert_id, request->ssl_info().cert_status, |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 return is_prefetch_enabled_; | 1928 return is_prefetch_enabled_; |
| 1929 } | 1929 } |
| 1930 | 1930 |
| 1931 // static | 1931 // static |
| 1932 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1932 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
| 1933 is_prefetch_enabled_ = value; | 1933 is_prefetch_enabled_ = value; |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 // static | 1936 // static |
| 1937 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1937 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
| OLD | NEW |