| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 | 344 |
| 345 static Resource* prefetchIfNeeded(Document& document, | 345 static Resource* prefetchIfNeeded(Document& document, |
| 346 const KURL& href, | 346 const KURL& href, |
| 347 const LinkRelAttribute& relAttribute, | 347 const LinkRelAttribute& relAttribute, |
| 348 CrossOriginAttributeValue crossOrigin, | 348 CrossOriginAttributeValue crossOrigin, |
| 349 ReferrerPolicy referrerPolicy) { | 349 ReferrerPolicy referrerPolicy) { |
| 350 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) { | 350 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) { |
| 351 UseCounter::count(document, UseCounter::LinkRelPrefetch); | 351 UseCounter::count(document, UseCounter::LinkRelPrefetch); |
| 352 | 352 |
| 353 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), | 353 ResourceRequest resourceRequest(document.completeURL(href)); |
| 354 FetchInitiatorTypeNames::link); | |
| 355 if (referrerPolicy != ReferrerPolicyDefault) { | 354 if (referrerPolicy != ReferrerPolicyDefault) { |
| 356 linkRequest.mutableResourceRequest().setHTTPReferrer( | 355 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer( |
| 357 SecurityPolicy::generateReferrer(referrerPolicy, href, | 356 referrerPolicy, href, document.outgoingReferrer())); |
| 358 document.outgoingReferrer())); | |
| 359 } | 357 } |
| 358 |
| 359 FetchRequest linkRequest(resourceRequest, FetchInitiatorTypeNames::link); |
| 360 if (crossOrigin != CrossOriginAttributeNotSet) { | 360 if (crossOrigin != CrossOriginAttributeNotSet) { |
| 361 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), | 361 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), |
| 362 crossOrigin); | 362 crossOrigin); |
| 363 } | 363 } |
| 364 return LinkFetchResource::fetch(Resource::LinkPrefetch, linkRequest, | 364 return LinkFetchResource::fetch(Resource::LinkPrefetch, linkRequest, |
| 365 document.fetcher()); | 365 document.fetcher()); |
| 366 } | 366 } |
| 367 return nullptr; | 367 return nullptr; |
| 368 } | 368 } |
| 369 | 369 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 DEFINE_TRACE(LinkLoader) { | 488 DEFINE_TRACE(LinkLoader) { |
| 489 visitor->trace(m_client); | 489 visitor->trace(m_client); |
| 490 visitor->trace(m_prerender); | 490 visitor->trace(m_prerender); |
| 491 visitor->trace(m_linkPreloadResourceClient); | 491 visitor->trace(m_linkPreloadResourceClient); |
| 492 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 492 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
| 493 PrerenderClient::trace(visitor); | 493 PrerenderClient::trace(visitor); |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace blink | 496 } // namespace blink |
| OLD | NEW |