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 <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 load_flags |= net::LOAD_IGNORE_LIMITS; | 304 load_flags |= net::LOAD_IGNORE_LIMITS; |
305 | 305 |
306 ChildProcessSecurityPolicyImpl* policy = | 306 ChildProcessSecurityPolicyImpl* policy = |
307 ChildProcessSecurityPolicyImpl::GetInstance(); | 307 ChildProcessSecurityPolicyImpl::GetInstance(); |
308 if (!policy->CanSendCookiesForOrigin(child_id, request_data.url)) { | 308 if (!policy->CanSendCookiesForOrigin(child_id, request_data.url)) { |
309 load_flags |= (net::LOAD_DO_NOT_SEND_COOKIES | | 309 load_flags |= (net::LOAD_DO_NOT_SEND_COOKIES | |
310 net::LOAD_DO_NOT_SEND_AUTH_DATA | | 310 net::LOAD_DO_NOT_SEND_AUTH_DATA | |
311 net::LOAD_DO_NOT_SAVE_COOKIES); | 311 net::LOAD_DO_NOT_SAVE_COOKIES); |
312 } | 312 } |
313 | 313 |
| 314 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 315 switches::kEnableOfflineCacheAccess)) { |
| 316 load_flags |= net::LOAD_CACHE_RETURN_IF_OFFLINE; |
| 317 } |
| 318 |
314 // Raw headers are sensitive, as they include Cookie/Set-Cookie, so only | 319 // Raw headers are sensitive, as they include Cookie/Set-Cookie, so only |
315 // allow requesting them if requester has ReadRawCookies permission. | 320 // allow requesting them if requester has ReadRawCookies permission. |
316 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 321 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
317 && !policy->CanReadRawCookies(child_id)) { | 322 && !policy->CanReadRawCookies(child_id)) { |
318 VLOG(1) << "Denied unauthorized request for raw headers"; | 323 VLOG(1) << "Denied unauthorized request for raw headers"; |
319 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 324 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
320 } | 325 } |
321 | 326 |
322 return load_flags; | 327 return load_flags; |
323 } | 328 } |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 | 1737 |
1733 return i->second.get(); | 1738 return i->second.get(); |
1734 } | 1739 } |
1735 | 1740 |
1736 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, | 1741 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, |
1737 int request_id) const { | 1742 int request_id) const { |
1738 return GetLoader(GlobalRequestID(child_id, request_id)); | 1743 return GetLoader(GlobalRequestID(child_id, request_id)); |
1739 } | 1744 } |
1740 | 1745 |
1741 } // namespace content | 1746 } // namespace content |
OLD | NEW |