Chromium Code Reviews| Index: Source/core/loader/LinkLoader.cpp |
| diff --git a/Source/core/loader/LinkLoader.cpp b/Source/core/loader/LinkLoader.cpp |
| index 3a928f86edaef55ee6664c857ebe889ae7ba490d..78c2e5a1038fb6d8a0033ccb617d17d433761c1e 100644 |
| --- a/Source/core/loader/LinkLoader.cpp |
| +++ b/Source/core/loader/LinkLoader.cpp |
| @@ -113,7 +113,7 @@ void LinkLoader::didSendDOMContentLoadedForPrerender() |
| m_client->didSendDOMContentLoadedForLinkPrerender(); |
| } |
| -bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicString& crossOriginMode, const String& type, const KURL& href, Document& document) |
| +static void dnsPrefetchIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document) |
| { |
| if (relAttribute.isDNSPrefetch()) { |
| Settings* settings = document.settings(); |
| @@ -125,6 +125,26 @@ bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicStri |
| prefetchDNS(href.host()); |
| } |
| } |
| +} |
| + |
| +bool LinkLoader::loadLinkFromHeader(const String& headerValue, Document* document) |
| +{ |
| + if (!document) |
| + return false; |
| + LinkHeader header(headerValue); |
| + if (!header.valid() || header.url().isEmpty() || header.rel().isEmpty()) |
| + return false; |
| + LinkRelAttribute relAttribute(header.rel()); |
|
Mike West
2015/02/06 12:22:06
Can you add a test (or FIXME) for multiple link he
|
| + KURL url = document->completeURL(header.url()); |
| + dnsPrefetchIfNeeded(relAttribute, url, *document); |
| + |
| + // FIXME: Add more supported headers as needed. |
| + return true; |
| +} |
| + |
| +bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicString& crossOriginMode, const String& type, const KURL& href, Document& document) |
| +{ |
| + dnsPrefetchIfNeeded(relAttribute, href, document); |
| if (relAttribute.isPreconnect() && href.isValid()) { |
| preconnect(href); |