| 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) { | 1372 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) { |
| 1373 bad_message::ReceivedBadMessage(filter_, | 1373 bad_message::ReceivedBadMessage(filter_, |
| 1374 bad_message::RDH_INVALID_REQUEST_ID); | 1374 bad_message::RDH_INVALID_REQUEST_ID); |
| 1375 return; | 1375 return; |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 // PlzNavigate: reject invalid renderer main resource request. | 1378 // PlzNavigate: reject invalid renderer main resource request. |
| 1379 bool is_navigation_stream_request = | 1379 bool is_navigation_stream_request = |
| 1380 IsBrowserSideNavigationEnabled() && | 1380 IsBrowserSideNavigationEnabled() && |
| 1381 IsResourceTypeFrame(request_data.resource_type); | 1381 IsResourceTypeFrame(request_data.resource_type); |
| 1382 // TODO(carlosk): We have to work something out later to confirm this request |
| 1383 // is indeed for a navigation streaming through Mojo. |
| 1382 if (is_navigation_stream_request && | 1384 if (is_navigation_stream_request && |
| 1383 !request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme)) { | 1385 (!request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme) || |
| 1386 request_data.resource_body_stream_url.is_empty())) { |
| 1384 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL); | 1387 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL); |
| 1385 return; | 1388 return; |
| 1386 } | 1389 } |
| 1387 | 1390 |
| 1388 // Reject invalid priority. | 1391 // Reject invalid priority. |
| 1389 if (request_data.priority < net::MINIMUM_PRIORITY || | 1392 if (request_data.priority < net::MINIMUM_PRIORITY || |
| 1390 request_data.priority > net::MAXIMUM_PRIORITY) { | 1393 request_data.priority > net::MAXIMUM_PRIORITY) { |
| 1391 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY); | 1394 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY); |
| 1392 return; | 1395 return; |
| 1393 } | 1396 } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 ResourceContext* resource_context, | 1707 ResourceContext* resource_context, |
| 1705 AppCacheService* appcache_service, | 1708 AppCacheService* appcache_service, |
| 1706 int child_id, | 1709 int child_id, |
| 1707 int route_id, | 1710 int route_id, |
| 1708 scoped_ptr<ResourceHandler> handler) { | 1711 scoped_ptr<ResourceHandler> handler) { |
| 1709 // PlzNavigate: do not add ResourceThrottles for main resource requests from | 1712 // PlzNavigate: do not add ResourceThrottles for main resource requests from |
| 1710 // the renderer. Decisions about the navigation should have been done in the | 1713 // the renderer. Decisions about the navigation should have been done in the |
| 1711 // initial request. | 1714 // initial request. |
| 1712 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && | 1715 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && |
| 1713 child_id != -1) { | 1716 child_id != -1) { |
| 1714 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1717 // TODO(carlosk): We have to work something out later to confirm this |
| 1718 // request is indeed for a navigation streaming through Mojo. |
| 1719 // DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
| 1715 return handler; | 1720 return handler; |
| 1716 } | 1721 } |
| 1717 | 1722 |
| 1718 PluginService* plugin_service = nullptr; | 1723 PluginService* plugin_service = nullptr; |
| 1719 #if defined(ENABLE_PLUGINS) | 1724 #if defined(ENABLE_PLUGINS) |
| 1720 plugin_service = PluginService::GetInstance(); | 1725 plugin_service = PluginService::GetInstance(); |
| 1721 #endif | 1726 #endif |
| 1722 // Insert a buffered event handler before the actual one. | 1727 // Insert a buffered event handler before the actual one. |
| 1723 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, | 1728 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, |
| 1724 plugin_service, request)); | 1729 plugin_service, request)); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2690 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
| 2686 response->head.security_info = SerializeSecurityInfo(ssl); | 2691 response->head.security_info = SerializeSecurityInfo(ssl); |
| 2687 } | 2692 } |
| 2688 | 2693 |
| 2689 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2694 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
| 2690 return cert_store_for_testing_ ? cert_store_for_testing_ | 2695 return cert_store_for_testing_ ? cert_store_for_testing_ |
| 2691 : CertStore::GetInstance(); | 2696 : CertStore::GetInstance(); |
| 2692 } | 2697 } |
| 2693 | 2698 |
| 2694 } // namespace content | 2699 } // namespace content |
| OLD | NEW |