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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 // So far, for saving page, we need fetch content from cache, in the | 1880 // So far, for saving page, we need fetch content from cache, in the |
1881 // future, maybe we can use a configuration to configure this behavior. | 1881 // future, maybe we can use a configuration to configure this behavior. |
1882 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); | 1882 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); |
1883 | 1883 |
1884 // Since we're just saving some resources we need, disallow downloading. | 1884 // Since we're just saving some resources we need, disallow downloading. |
1885 ResourceRequestInfoImpl* extra_info = | 1885 ResourceRequestInfoImpl* extra_info = |
1886 CreateRequestInfo(child_id, render_view_route_id, | 1886 CreateRequestInfo(child_id, render_view_route_id, |
1887 render_frame_route_id, false, context); | 1887 render_frame_route_id, false, context); |
1888 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. | 1888 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. |
1889 | 1889 |
1890 std::unique_ptr<ResourceHandler> handler(new SaveFileResourceHandler( | 1890 std::unique_ptr<SaveFileResourceHandler> handler(new SaveFileResourceHandler( |
1891 request.get(), save_item_id, save_package_id, child_id, | 1891 request.get(), save_item_id, save_package_id, child_id, |
1892 render_frame_route_id, url, save_file_manager_.get())); | 1892 render_frame_route_id, url, save_file_manager_.get())); |
1893 | 1893 |
| 1894 // Check if the renderer is permitted to request the requested URL. |
| 1895 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(child_id, |
| 1896 url)) { |
| 1897 DVLOG(1) << "Denying unauthorized save of " << url.possibly_invalid_spec(); |
| 1898 handler->MarkAsUnauthorized(); |
| 1899 } |
| 1900 |
1894 BeginRequestInternal(std::move(request), std::move(handler)); | 1901 BeginRequestInternal(std::move(request), std::move(handler)); |
1895 } | 1902 } |
1896 | 1903 |
1897 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( | 1904 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( |
1898 const GlobalRequestID& id, | 1905 const GlobalRequestID& id, |
1899 const scoped_refptr<ResourceResponse>& response) { | 1906 const scoped_refptr<ResourceResponse>& response) { |
1900 GetLoader(id)->MarkAsTransferring(response); | 1907 GetLoader(id)->MarkAsTransferring(response); |
1901 } | 1908 } |
1902 | 1909 |
1903 void ResourceDispatcherHostImpl::CancelTransferringNavigation( | 1910 void ResourceDispatcherHostImpl::CancelTransferringNavigation( |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2608 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
2602 response->head.security_info = SerializeSecurityInfo(ssl); | 2609 response->head.security_info = SerializeSecurityInfo(ssl); |
2603 } | 2610 } |
2604 | 2611 |
2605 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2612 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
2606 return cert_store_for_testing_ ? cert_store_for_testing_ | 2613 return cert_store_for_testing_ ? cert_store_for_testing_ |
2607 : CertStore::GetInstance(); | 2614 : CertStore::GetInstance(); |
2608 } | 2615 } |
2609 | 2616 |
2610 } // namespace content | 2617 } // namespace content |
OLD | NEW |