Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 void LinkLoader::didSendLoadForPrerender() | 91 void LinkLoader::didSendLoadForPrerender() |
| 92 { | 92 { |
| 93 m_client->didSendLoadForLinkPrerender(); | 93 m_client->didSendLoadForLinkPrerender(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void LinkLoader::didSendDOMContentLoadedForPrerender() | 96 void LinkLoader::didSendDOMContentLoadedForPrerender() |
| 97 { | 97 { |
| 98 m_client->didSendDOMContentLoadedForLinkPrerender(); | 98 m_client->didSendDOMContentLoadedForLinkPrerender(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const String& ty pe, const KURL& href, Document& document) | 101 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const String& cr ossOriginMode, const String& type, const KURL& href, Document& document) |
| 102 { | 102 { |
| 103 if (relAttribute.isDNSPrefetch()) { | 103 if (relAttribute.isDNSPrefetch()) { |
| 104 Settings* settings = document.settings(); | 104 Settings* settings = document.settings(); |
| 105 // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt | 105 // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt |
| 106 // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=4885 7>. | 106 // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=4885 7>. |
| 107 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && ! href.isEmpty()) | 107 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && ! href.isEmpty()) |
| 108 prefetchDNS(href.host()); | 108 prefetchDNS(href.host()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // FIXME(crbug.com/323096): Should take care of import. | 111 // FIXME(crbug.com/323096): Should take care of import. |
| 112 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h ref.isValid() && document.frame()) { | 112 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h ref.isValid() && document.frame()) { |
| 113 if (!m_client->shouldLoadLink()) | 113 if (!m_client->shouldLoadLink()) |
| 114 return false; | 114 return false; |
| 115 Resource::Type type = relAttribute.isLinkSubresource() ? Resource::Link Subresource : Resource::LinkPrefetch; | 115 Resource::Type type = relAttribute.isLinkSubresource() ? Resource::Link Subresource : Resource::LinkPrefetch; |
| 116 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link); | 116 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link); |
| 117 if (!crossOriginMode.isNull()) { | |
| 118 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; | |
|
abarth-chromium
2014/01/28 06:38:45
It's even twice in this CL. :)
| |
| 119 linkRequest.setCrossOriginAccessControl(document.securityOrigin(), a llowCredentials); | |
| 120 } | |
| 117 setResource(document.fetcher()->fetchLinkResource(type, linkRequest)); | 121 setResource(document.fetcher()->fetchLinkResource(type, linkRequest)); |
| 118 } | 122 } |
| 119 | 123 |
| 120 if (relAttribute.isLinkPrerender()) { | 124 if (relAttribute.isLinkPrerender()) { |
| 121 if (!m_prerender) { | 125 if (!m_prerender) { |
| 122 m_prerender = PrerenderHandle::create(document, this, href); | 126 m_prerender = PrerenderHandle::create(document, this, href); |
| 123 } else if (m_prerender->url() != href) { | 127 } else if (m_prerender->url() != href) { |
| 124 m_prerender->cancel(); | 128 m_prerender->cancel(); |
| 125 m_prerender = PrerenderHandle::create(document, this, href); | 129 m_prerender = PrerenderHandle::create(document, this, href); |
| 126 } | 130 } |
| 127 } else if (m_prerender) { | 131 } else if (m_prerender) { |
| 128 m_prerender->cancel(); | 132 m_prerender->cancel(); |
| 129 m_prerender.clear(); | 133 m_prerender.clear(); |
| 130 } | 134 } |
| 131 return true; | 135 return true; |
| 132 } | 136 } |
| 133 | 137 |
| 134 void LinkLoader::released() | 138 void LinkLoader::released() |
| 135 { | 139 { |
| 136 // Only prerenders need treatment here; other links either use the Resource interface, or are notionally | 140 // Only prerenders need treatment here; other links either use the Resource interface, or are notionally |
| 137 // atomic (dns prefetch). | 141 // atomic (dns prefetch). |
| 138 if (m_prerender) { | 142 if (m_prerender) { |
| 139 m_prerender->cancel(); | 143 m_prerender->cancel(); |
| 140 m_prerender.clear(); | 144 m_prerender.clear(); |
| 141 } | 145 } |
| 142 } | 146 } |
| 143 | 147 |
| 144 } | 148 } |
| OLD | NEW |