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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 base::strlcpy( | 1881 base::strlcpy( |
1882 url_buf, info.common_params.url.spec().c_str(), arraysize(url_buf)); | 1882 url_buf, info.common_params.url.spec().c_str(), arraysize(url_buf)); |
1883 base::debug::Alias(url_buf); | 1883 base::debug::Alias(url_buf); |
1884 CHECK(ContainsKey(active_resource_contexts_, resource_context)); | 1884 CHECK(ContainsKey(active_resource_contexts_, resource_context)); |
1885 | 1885 |
1886 const net::URLRequestContext* request_context = | 1886 const net::URLRequestContext* request_context = |
1887 resource_context->GetRequestContext(); | 1887 resource_context->GetRequestContext(); |
1888 | 1888 |
1889 int load_flags = info.begin_params.load_flags; | 1889 int load_flags = info.begin_params.load_flags; |
1890 load_flags |= net::LOAD_VERIFY_EV_CERT; | 1890 load_flags |= net::LOAD_VERIFY_EV_CERT; |
1891 if (info.is_main_frame) { | 1891 if (info.is_main_frame) |
1892 load_flags |= net::LOAD_MAIN_FRAME; | 1892 load_flags |= net::LOAD_MAIN_FRAME; |
1893 } else { | |
1894 load_flags |= net::LOAD_SUB_FRAME; | |
1895 } | |
1896 // Add a flag to selectively bypass the data reduction proxy if the resource | 1893 // Add a flag to selectively bypass the data reduction proxy if the resource |
1897 // type is not an image. | 1894 // type is not an image. |
1898 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 1895 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
1899 | 1896 |
1900 // TODO(davidben): BuildLoadFlagsForRequest includes logic for | 1897 // TODO(davidben): BuildLoadFlagsForRequest includes logic for |
1901 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? | 1898 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? |
1902 | 1899 |
1903 // Sync loads should have maximum priority and should be the only | 1900 // Sync loads should have maximum priority and should be the only |
1904 // requests that have the ignore limits flag set. | 1901 // requests that have the ignore limits flag set. |
1905 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); | 1902 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 bool is_sync_load) { | 2308 bool is_sync_load) { |
2312 int load_flags = request_data.load_flags; | 2309 int load_flags = request_data.load_flags; |
2313 | 2310 |
2314 // Although EV status is irrelevant to sub-frames and sub-resources, we have | 2311 // Although EV status is irrelevant to sub-frames and sub-resources, we have |
2315 // to perform EV certificate verification on all resources because an HTTP | 2312 // to perform EV certificate verification on all resources because an HTTP |
2316 // keep-alive connection created to load a sub-frame or a sub-resource could | 2313 // keep-alive connection created to load a sub-frame or a sub-resource could |
2317 // be reused to load a main frame. | 2314 // be reused to load a main frame. |
2318 load_flags |= net::LOAD_VERIFY_EV_CERT; | 2315 load_flags |= net::LOAD_VERIFY_EV_CERT; |
2319 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { | 2316 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { |
2320 load_flags |= net::LOAD_MAIN_FRAME; | 2317 load_flags |= net::LOAD_MAIN_FRAME; |
2321 } else if (request_data.resource_type == RESOURCE_TYPE_SUB_FRAME) { | |
2322 load_flags |= net::LOAD_SUB_FRAME; | |
2323 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { | 2318 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { |
2324 load_flags |= net::LOAD_PREFETCH; | 2319 load_flags |= net::LOAD_PREFETCH; |
2325 } | 2320 } |
2326 | 2321 |
2327 if (is_sync_load) | 2322 if (is_sync_load) |
2328 load_flags |= net::LOAD_IGNORE_LIMITS; | 2323 load_flags |= net::LOAD_IGNORE_LIMITS; |
2329 | 2324 |
2330 ChildProcessSecurityPolicyImpl* policy = | 2325 ChildProcessSecurityPolicyImpl* policy = |
2331 ChildProcessSecurityPolicyImpl::GetInstance(); | 2326 ChildProcessSecurityPolicyImpl::GetInstance(); |
2332 if (!policy->CanSendCookiesForOrigin(child_id, request_data.url)) { | 2327 if (!policy->CanSendCookiesForOrigin(child_id, request_data.url)) { |
(...skipping 12 matching lines...) Expand all Loading... |
2345 | 2340 |
2346 // Add a flag to selectively bypass the data reduction proxy if the resource | 2341 // Add a flag to selectively bypass the data reduction proxy if the resource |
2347 // type is not an image. | 2342 // type is not an image. |
2348 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2343 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2349 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2344 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2350 | 2345 |
2351 return load_flags; | 2346 return load_flags; |
2352 } | 2347 } |
2353 | 2348 |
2354 } // namespace content | 2349 } // namespace content |
OLD | NEW |