Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Overall code cleanup to request reviewers to PTAL. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 // policy. 1626 // policy.
1627 if (!is_swappable_navigation && 1627 if (!is_swappable_navigation &&
1628 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { 1628 SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
1629 is_swappable_navigation = 1629 is_swappable_navigation =
1630 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; 1630 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME;
1631 } 1631 }
1632 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) 1632 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER)
1633 handler.reset(new CrossSiteResourceHandler(std::move(handler), request)); 1633 handler.reset(new CrossSiteResourceHandler(std::move(handler), request));
1634 } 1634 }
1635 1635
1636 return AddStandardHandlers(request, request_data.resource_type, 1636 return AddStandardHandlers(
1637 resource_context, filter_->appcache_service(), 1637 request, request_data.resource_type, resource_context,
1638 child_id, route_id, std::move(handler)); 1638 request_data.fetch_request_context_type, filter_->appcache_service(),
1639 child_id, route_id, std::move(handler));
1639 } 1640 }
1640 1641
1641 std::unique_ptr<ResourceHandler> 1642 std::unique_ptr<ResourceHandler>
1642 ResourceDispatcherHostImpl::AddStandardHandlers( 1643 ResourceDispatcherHostImpl::AddStandardHandlers(
1643 net::URLRequest* request, 1644 net::URLRequest* request,
1644 ResourceType resource_type, 1645 ResourceType resource_type,
1645 ResourceContext* resource_context, 1646 ResourceContext* resource_context,
1647 RequestContextType fetch_request_context_type,
1646 AppCacheService* appcache_service, 1648 AppCacheService* appcache_service,
1647 int child_id, 1649 int child_id,
1648 int route_id, 1650 int route_id,
1649 std::unique_ptr<ResourceHandler> handler) { 1651 std::unique_ptr<ResourceHandler> handler) {
1650 // PlzNavigate: do not add ResourceThrottles for main resource requests from 1652 // PlzNavigate: do not add ResourceThrottles for main resource requests from
1651 // the renderer. Decisions about the navigation should have been done in the 1653 // the renderer. Decisions about the navigation should have been done in the
1652 // initial request. 1654 // initial request.
1653 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && 1655 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) &&
1654 child_id != -1) { 1656 child_id != -1) {
1655 DCHECK(request->url().SchemeIs(url::kBlobScheme)); 1657 DCHECK(request->url().SchemeIs(url::kBlobScheme));
1656 return handler; 1658 return handler;
1657 } 1659 }
1658 1660
1659 PluginService* plugin_service = nullptr; 1661 PluginService* plugin_service = nullptr;
1660 #if defined(ENABLE_PLUGINS) 1662 #if defined(ENABLE_PLUGINS)
1661 plugin_service = PluginService::GetInstance(); 1663 plugin_service = PluginService::GetInstance();
1662 #endif 1664 #endif
1663 // Insert a buffered event handler before the actual one. 1665 // Insert a buffered event handler before the actual one.
1664 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, 1666 handler.reset(new MimeTypeResourceHandler(std::move(handler), this,
1665 plugin_service, request)); 1667 plugin_service, request));
1666 1668
1667 ScopedVector<ResourceThrottle> throttles; 1669 ScopedVector<ResourceThrottle> throttles;
1668 1670
1669 // Add a NavigationResourceThrottle for navigations. 1671 // Add a NavigationResourceThrottle for navigations.
1670 // PlzNavigate: the throttle is unnecessary as communication with the UI 1672 // PlzNavigate: the throttle is unnecessary as communication with the UI
1671 // thread is handled by the NavigationURLloader. 1673 // thread is handled by the NavigationURLloader.
1672 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) 1674 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) {
1673 throttles.push_back(new NavigationResourceThrottle(request, delegate())); 1675 throttles.push_back(new NavigationResourceThrottle(
1676 request, delegate(), fetch_request_context_type));
1677 }
1674 1678
1675 if (delegate_) { 1679 if (delegate_) {
1676 delegate_->RequestBeginning(request, 1680 delegate_->RequestBeginning(request,
1677 resource_context, 1681 resource_context,
1678 appcache_service, 1682 appcache_service,
1679 resource_type, 1683 resource_type,
1680 &throttles); 1684 &throttles);
1681 } 1685 }
1682 1686
1683 if (request->has_upload()) { 1687 if (request->has_upload()) {
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2250 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2247 new_request.get(), 2251 new_request.get(),
2248 blob_context->GetBlobDataFromPublicURL(new_request->url())); 2252 blob_context->GetBlobDataFromPublicURL(new_request->url()));
2249 } 2253 }
2250 2254
2251 // TODO(davidben): Attach AppCacheInterceptor. 2255 // TODO(davidben): Attach AppCacheInterceptor.
2252 2256
2253 std::unique_ptr<ResourceHandler> handler( 2257 std::unique_ptr<ResourceHandler> handler(
2254 new NavigationResourceHandler(new_request.get(), loader, delegate())); 2258 new NavigationResourceHandler(new_request.get(), loader, delegate()));
2255 2259
2260 // TODO(carlosk): set the RequestContextType in a more correct way, if needed.
2261 // Source of inspiration: determineRequestContextFromNavigationType in
2262 // FrameLoader.cpp.
2256 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the 2263 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the
2257 // dependency on child_id/route_id. Those are used by the ResourceScheduler; 2264 // dependency on child_id/route_id. Those are used by the ResourceScheduler;
2258 // currently it's a no-op. 2265 // currently it's a no-op.
2259 handler = 2266 handler = AddStandardHandlers(new_request.get(), resource_type,
2260 AddStandardHandlers(new_request.get(), resource_type, resource_context, 2267 resource_context, REQUEST_CONTEXT_TYPE_LOCATION,
2261 nullptr, // appcache_service 2268 nullptr, // appcache_service
2262 -1, // child_id 2269 -1, // child_id
2263 -1, // route_id 2270 -1, // route_id
2264 std::move(handler)); 2271 std::move(handler));
2265 2272
2266 BeginRequestInternal(std::move(new_request), std::move(handler)); 2273 BeginRequestInternal(std::move(new_request), std::move(handler));
2267 } 2274 }
2268 2275
2269 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { 2276 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
2270 if (!async_revalidation_manager_) 2277 if (!async_revalidation_manager_)
2271 async_revalidation_manager_.reset(new AsyncRevalidationManager); 2278 async_revalidation_manager_.reset(new AsyncRevalidationManager);
2272 } 2279 }
2273 2280
2274 void ResourceDispatcherHostImpl::SetLoaderDelegate( 2281 void ResourceDispatcherHostImpl::SetLoaderDelegate(
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2603 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2597 response->head.security_info = SerializeSecurityInfo(ssl); 2604 response->head.security_info = SerializeSecurityInfo(ssl);
2598 } 2605 }
2599 2606
2600 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2607 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2601 return cert_store_for_testing_ ? cert_store_for_testing_ 2608 return cert_store_for_testing_ ? cert_store_for_testing_
2602 : CertStore::GetInstance(); 2609 : CertStore::GetInstance();
2603 } 2610 }
2604 2611
2605 } // namespace content 2612 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698