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 <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "content/browser/renderer_host/render_view_host_impl.h" | 54 #include "content/browser/renderer_host/render_view_host_impl.h" |
55 #include "content/browser/resource_context_impl.h" | 55 #include "content/browser/resource_context_impl.h" |
56 #include "content/browser/service_worker/service_worker_request_handler.h" | 56 #include "content/browser/service_worker/service_worker_request_handler.h" |
57 #include "content/browser/streams/stream.h" | 57 #include "content/browser/streams/stream.h" |
58 #include "content/browser/streams/stream_context.h" | 58 #include "content/browser/streams/stream_context.h" |
59 #include "content/browser/streams/stream_registry.h" | 59 #include "content/browser/streams/stream_registry.h" |
60 #include "content/browser/web_contents/web_contents_impl.h" | 60 #include "content/browser/web_contents/web_contents_impl.h" |
61 #include "content/common/appcache_interfaces.h" | 61 #include "content/common/appcache_interfaces.h" |
62 #include "content/common/navigation_params.h" | 62 #include "content/common/navigation_params.h" |
63 #include "content/common/resource_messages.h" | 63 #include "content/common/resource_messages.h" |
| 64 #include "content/common/site_isolation_policy.h" |
64 #include "content/common/ssl_status_serialization.h" | 65 #include "content/common/ssl_status_serialization.h" |
65 #include "content/common/view_messages.h" | 66 #include "content/common/view_messages.h" |
66 #include "content/public/browser/browser_thread.h" | 67 #include "content/public/browser/browser_thread.h" |
67 #include "content/public/browser/content_browser_client.h" | 68 #include "content/public/browser/content_browser_client.h" |
68 #include "content/public/browser/download_manager.h" | 69 #include "content/public/browser/download_manager.h" |
69 #include "content/public/browser/download_url_parameters.h" | 70 #include "content/public/browser/download_url_parameters.h" |
70 #include "content/public/browser/global_request_id.h" | 71 #include "content/public/browser/global_request_id.h" |
71 #include "content/public/browser/plugin_service.h" | 72 #include "content/public/browser/plugin_service.h" |
72 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 73 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
73 #include "content/public/browser/resource_request_details.h" | 74 #include "content/public/browser/resource_request_details.h" |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 // CrossSiteResourceHandler is not needed. This codepath is not used for the | 1380 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1380 // actual navigation request, but only the subsequent blob URL load. This does | 1381 // actual navigation request, but only the subsequent blob URL load. This does |
1381 // not require request transfers. | 1382 // not require request transfers. |
1382 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1383 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1383 switches::kEnableBrowserSideNavigation)) { | 1384 switches::kEnableBrowserSideNavigation)) { |
1384 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1385 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1385 // check whether a transfer is required and, if so, pause for the UI thread | 1386 // check whether a transfer is required and, if so, pause for the UI thread |
1386 // to drive the transfer. | 1387 // to drive the transfer. |
1387 bool is_swappable_navigation = | 1388 bool is_swappable_navigation = |
1388 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; | 1389 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; |
1389 // If we are using --site-per-process, install it for subframes as well. | 1390 // If out-of-process iframes are possible, then all subframe requests need |
| 1391 // to go through the CrossSiteResourceHandler to enforce the site isolation |
| 1392 // policy. |
1390 if (!is_swappable_navigation && | 1393 if (!is_swappable_navigation && |
1391 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1394 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { |
1392 switches::kSitePerProcess)) { | |
1393 is_swappable_navigation = | 1395 is_swappable_navigation = |
1394 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | 1396 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; |
1395 } | 1397 } |
1396 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | 1398 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) |
1397 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | 1399 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); |
1398 } | 1400 } |
1399 | 1401 |
1400 return AddStandardHandlers(request, request_data.resource_type, | 1402 return AddStandardHandlers(request, request_data.resource_type, |
1401 resource_context, filter_->appcache_service(), | 1403 resource_context, filter_->appcache_service(), |
1402 child_id, route_id, handler.Pass()); | 1404 child_id, route_id, handler.Pass()); |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 2354 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
2353 && !policy->CanReadRawCookies(child_id)) { | 2355 && !policy->CanReadRawCookies(child_id)) { |
2354 VLOG(1) << "Denied unauthorized request for raw headers"; | 2356 VLOG(1) << "Denied unauthorized request for raw headers"; |
2355 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 2357 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
2356 } | 2358 } |
2357 | 2359 |
2358 return load_flags; | 2360 return load_flags; |
2359 } | 2361 } |
2360 | 2362 |
2361 } // namespace content | 2363 } // namespace content |
OLD | NEW |