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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #include "net/url_request/url_request.h" | 111 #include "net/url_request/url_request.h" |
112 #include "net/url_request/url_request_context.h" | 112 #include "net/url_request/url_request_context.h" |
113 #include "net/url_request/url_request_job_factory.h" | 113 #include "net/url_request/url_request_job_factory.h" |
114 #include "ppapi/features/features.h" | 114 #include "ppapi/features/features.h" |
115 #include "storage/browser/blob/blob_data_handle.h" | 115 #include "storage/browser/blob/blob_data_handle.h" |
116 #include "storage/browser/blob/blob_storage_context.h" | 116 #include "storage/browser/blob/blob_storage_context.h" |
117 #include "storage/browser/blob/blob_url_request_job_factory.h" | 117 #include "storage/browser/blob/blob_url_request_job_factory.h" |
118 #include "storage/browser/blob/shareable_file_reference.h" | 118 #include "storage/browser/blob/shareable_file_reference.h" |
119 #include "storage/browser/fileapi/file_permission_policy.h" | 119 #include "storage/browser/fileapi/file_permission_policy.h" |
120 #include "storage/browser/fileapi/file_system_context.h" | 120 #include "storage/browser/fileapi/file_system_context.h" |
| 121 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" |
121 #include "url/third_party/mozilla/url_parse.h" | 122 #include "url/third_party/mozilla/url_parse.h" |
122 #include "url/url_constants.h" | 123 #include "url/url_constants.h" |
123 | 124 |
124 using base::Time; | 125 using base::Time; |
125 using base::TimeDelta; | 126 using base::TimeDelta; |
126 using base::TimeTicks; | 127 using base::TimeTicks; |
127 using storage::ShareableFileReference; | 128 using storage::ShareableFileReference; |
128 using SyncLoadResultCallback = | 129 using SyncLoadResultCallback = |
129 content::ResourceDispatcherHostImpl::SyncLoadResultCallback; | 130 content::ResourceDispatcherHostImpl::SyncLoadResultCallback; |
130 | 131 |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 // initial request. | 1678 // initial request. |
1678 if (IsBrowserSideNavigationEnabled() && | 1679 if (IsBrowserSideNavigationEnabled() && |
1679 IsResourceTypeFrame(request_data.resource_type)) { | 1680 IsResourceTypeFrame(request_data.resource_type)) { |
1680 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1681 DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
1681 return handler; | 1682 return handler; |
1682 } | 1683 } |
1683 | 1684 |
1684 return AddStandardHandlers(request, request_data.resource_type, | 1685 return AddStandardHandlers(request, request_data.resource_type, |
1685 resource_context, | 1686 resource_context, |
1686 request_data.fetch_request_context_type, | 1687 request_data.fetch_request_context_type, |
| 1688 request_data.fetch_mixed_content_context_type, |
1687 requester_info->appcache_service(), child_id, | 1689 requester_info->appcache_service(), child_id, |
1688 route_id, std::move(handler)); | 1690 route_id, std::move(handler)); |
1689 } | 1691 } |
1690 | 1692 |
1691 std::unique_ptr<ResourceHandler> | 1693 std::unique_ptr<ResourceHandler> |
1692 ResourceDispatcherHostImpl::AddStandardHandlers( | 1694 ResourceDispatcherHostImpl::AddStandardHandlers( |
1693 net::URLRequest* request, | 1695 net::URLRequest* request, |
1694 ResourceType resource_type, | 1696 ResourceType resource_type, |
1695 ResourceContext* resource_context, | 1697 ResourceContext* resource_context, |
1696 RequestContextType fetch_request_context_type, | 1698 RequestContextType fetch_request_context_type, |
| 1699 blink::WebMixedContentContextType fetch_mixed_content_context_type, |
1697 AppCacheService* appcache_service, | 1700 AppCacheService* appcache_service, |
1698 int child_id, | 1701 int child_id, |
1699 int route_id, | 1702 int route_id, |
1700 std::unique_ptr<ResourceHandler> handler) { | 1703 std::unique_ptr<ResourceHandler> handler) { |
1701 // The InterceptingResourceHandler will replace its next handler with an | 1704 // The InterceptingResourceHandler will replace its next handler with an |
1702 // appropriate one based on the MIME type of the response if needed. It | 1705 // appropriate one based on the MIME type of the response if needed. It |
1703 // should be placed at the end of the chain, just before |handler|. | 1706 // should be placed at the end of the chain, just before |handler|. |
1704 handler.reset(new InterceptingResourceHandler(std::move(handler), request)); | 1707 handler.reset(new InterceptingResourceHandler(std::move(handler), request)); |
1705 InterceptingResourceHandler* intercepting_handler = | 1708 InterceptingResourceHandler* intercepting_handler = |
1706 static_cast<InterceptingResourceHandler*>(handler.get()); | 1709 static_cast<InterceptingResourceHandler*>(handler.get()); |
1707 | 1710 |
1708 std::vector<std::unique_ptr<ResourceThrottle>> throttles; | 1711 std::vector<std::unique_ptr<ResourceThrottle>> throttles; |
1709 | 1712 |
1710 // Add a NavigationResourceThrottle for navigations. | 1713 // Add a NavigationResourceThrottle for navigations. |
1711 // PlzNavigate: the throttle is unnecessary as communication with the UI | 1714 // PlzNavigate: the throttle is unnecessary as communication with the UI |
1712 // thread is handled by the NavigationURLloader. | 1715 // thread is handled by the NavigationURLloader. |
1713 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { | 1716 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { |
1714 throttles.push_back(base::MakeUnique<NavigationResourceThrottle>( | 1717 throttles.push_back(base::MakeUnique<NavigationResourceThrottle>( |
1715 request, delegate_, fetch_request_context_type)); | 1718 request, delegate_, fetch_request_context_type, |
| 1719 fetch_mixed_content_context_type)); |
1716 } | 1720 } |
1717 | 1721 |
1718 if (delegate_) { | 1722 if (delegate_) { |
1719 delegate_->RequestBeginning(request, | 1723 delegate_->RequestBeginning(request, |
1720 resource_context, | 1724 resource_context, |
1721 appcache_service, | 1725 appcache_service, |
1722 resource_type, | 1726 resource_type, |
1723 &throttles); | 1727 &throttles); |
1724 } | 1728 } |
1725 | 1729 |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 } | 2283 } |
2280 | 2284 |
2281 std::unique_ptr<ResourceHandler> handler( | 2285 std::unique_ptr<ResourceHandler> handler( |
2282 new NavigationResourceHandler(new_request.get(), loader, delegate())); | 2286 new NavigationResourceHandler(new_request.get(), loader, delegate())); |
2283 | 2287 |
2284 // TODO(davidben): Fix the dependency on child_id/route_id. Those are used | 2288 // TODO(davidben): Fix the dependency on child_id/route_id. Those are used |
2285 // by the ResourceScheduler. currently it's a no-op. | 2289 // by the ResourceScheduler. currently it's a no-op. |
2286 handler = AddStandardHandlers( | 2290 handler = AddStandardHandlers( |
2287 new_request.get(), resource_type, resource_context, | 2291 new_request.get(), resource_type, resource_context, |
2288 info.begin_params.request_context_type, | 2292 info.begin_params.request_context_type, |
| 2293 info.begin_params.mixed_content_context_type, |
2289 appcache_handle_core ? appcache_handle_core->GetAppCacheService() | 2294 appcache_handle_core ? appcache_handle_core->GetAppCacheService() |
2290 : nullptr, | 2295 : nullptr, |
2291 -1, // child_id | 2296 -1, // child_id |
2292 -1, // route_id | 2297 -1, // route_id |
2293 std::move(handler)); | 2298 std::move(handler)); |
2294 | 2299 |
2295 BeginRequestInternal(std::move(new_request), std::move(handler)); | 2300 BeginRequestInternal(std::move(new_request), std::move(handler)); |
2296 } | 2301 } |
2297 | 2302 |
2298 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { | 2303 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 &throttles); | 2827 &throttles); |
2823 if (!throttles.empty()) { | 2828 if (!throttles.empty()) { |
2824 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2829 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2825 std::move(throttles))); | 2830 std::move(throttles))); |
2826 } | 2831 } |
2827 } | 2832 } |
2828 return handler; | 2833 return handler; |
2829 } | 2834 } |
2830 | 2835 |
2831 } // namespace content | 2836 } // namespace content |
OLD | NEW |