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/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 std::unique_ptr<ResourceHandler> handler) { | 1713 std::unique_ptr<ResourceHandler> handler) { |
1714 // PlzNavigate: do not add ResourceThrottles for main resource requests from | 1714 // PlzNavigate: do not add ResourceThrottles for main resource requests from |
1715 // the renderer. Decisions about the navigation should have been done in the | 1715 // the renderer. Decisions about the navigation should have been done in the |
1716 // initial request. | 1716 // initial request. |
1717 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && | 1717 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && |
1718 child_id != -1) { | 1718 child_id != -1) { |
1719 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1719 DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
1720 return handler; | 1720 return handler; |
1721 } | 1721 } |
1722 | 1722 |
1723 PluginService* plugin_service = nullptr; | |
1724 #if defined(ENABLE_PLUGINS) | |
1725 plugin_service = PluginService::GetInstance(); | |
1726 #endif | |
1727 // Insert a buffered event handler before the actual one. | |
1728 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, | |
1729 plugin_service, request)); | |
1730 | |
1731 ScopedVector<ResourceThrottle> throttles; | 1723 ScopedVector<ResourceThrottle> throttles; |
1732 | 1724 |
1733 // Add a NavigationResourceThrottle for navigations. | 1725 // Add a NavigationResourceThrottle for navigations. |
1734 // PlzNavigate: the throttle is unnecessary as communication with the UI | 1726 // PlzNavigate: the throttle is unnecessary as communication with the UI |
1735 // thread is handled by the NavigationURLloader. | 1727 // thread is handled by the NavigationURLloader. |
1736 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) | 1728 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) |
1737 throttles.push_back(new NavigationResourceThrottle(request, delegate())); | 1729 throttles.push_back(new NavigationResourceThrottle(request, delegate())); |
1738 | 1730 |
1739 if (delegate_) { | 1731 if (delegate_) { |
1740 delegate_->RequestBeginning(request, | 1732 delegate_->RequestBeginning(request, |
(...skipping 10 matching lines...) Expand all Loading... |
1751 } | 1743 } |
1752 | 1744 |
1753 // TODO(ricea): Stop looking this up so much. | 1745 // TODO(ricea): Stop looking this up so much. |
1754 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1746 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1755 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, | 1747 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, |
1756 info->IsAsync(), request)); | 1748 info->IsAsync(), request)); |
1757 | 1749 |
1758 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 1750 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
1759 std::move(throttles))); | 1751 std::move(throttles))); |
1760 | 1752 |
| 1753 PluginService* plugin_service = nullptr; |
| 1754 #if defined(ENABLE_PLUGINS) |
| 1755 plugin_service = PluginService::GetInstance(); |
| 1756 #endif |
| 1757 |
| 1758 // Insert a buffered event handler to sniff the mime type first. |
| 1759 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, |
| 1760 plugin_service, request)); |
| 1761 |
1761 return handler; | 1762 return handler; |
1762 } | 1763 } |
1763 | 1764 |
1764 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { | 1765 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { |
1765 UnregisterDownloadedTempFile(filter_->child_id(), request_id); | 1766 UnregisterDownloadedTempFile(filter_->child_id(), request_id); |
1766 } | 1767 } |
1767 | 1768 |
1768 void ResourceDispatcherHostImpl::OnDidChangePriority( | 1769 void ResourceDispatcherHostImpl::OnDidChangePriority( |
1769 int request_id, | 1770 int request_id, |
1770 net::RequestPriority new_priority, | 1771 net::RequestPriority new_priority, |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2691 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
2691 response->head.security_info = SerializeSecurityInfo(ssl); | 2692 response->head.security_info = SerializeSecurityInfo(ssl); |
2692 } | 2693 } |
2693 | 2694 |
2694 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2695 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
2695 return cert_store_for_testing_ ? cert_store_for_testing_ | 2696 return cert_store_for_testing_ ? cert_store_for_testing_ |
2696 : CertStore::GetInstance(); | 2697 : CertStore::GetInstance(); |
2697 } | 2698 } |
2698 | 2699 |
2699 } // namespace content | 2700 } // namespace content |
OLD | NEW |