Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 1755803002: Ship `referrerpolicy` attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update webexposed layout tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 28 matching lines...) Expand all
39 #include "core/frame/UseCounter.h" 39 #include "core/frame/UseCounter.h"
40 #include "core/html/CrossOriginAttribute.h" 40 #include "core/html/CrossOriginAttribute.h"
41 #include "core/html/HTMLImageElement.h" 41 #include "core/html/HTMLImageElement.h"
42 #include "core/html/parser/HTMLParserIdioms.h" 42 #include "core/html/parser/HTMLParserIdioms.h"
43 #include "core/inspector/InspectorInstrumentation.h" 43 #include "core/inspector/InspectorInstrumentation.h"
44 #include "core/layout/LayoutImage.h" 44 #include "core/layout/LayoutImage.h"
45 #include "core/layout/LayoutVideo.h" 45 #include "core/layout/LayoutVideo.h"
46 #include "core/layout/svg/LayoutSVGImage.h" 46 #include "core/layout/svg/LayoutSVGImage.h"
47 #include "core/svg/graphics/SVGImage.h" 47 #include "core/svg/graphics/SVGImage.h"
48 #include "platform/Logging.h" 48 #include "platform/Logging.h"
49 #include "platform/RuntimeEnabledFeatures.h"
50 #include "platform/weborigin/SecurityOrigin.h" 49 #include "platform/weborigin/SecurityOrigin.h"
51 #include "platform/weborigin/SecurityPolicy.h" 50 #include "platform/weborigin/SecurityPolicy.h"
52 #include "public/platform/WebURLRequest.h" 51 #include "public/platform/WebURLRequest.h"
53 52
54 namespace blink { 53 namespace blink {
55 54
56 static ImageEventSender& loadEventSender() 55 static ImageEventSender& loadEventSender()
57 { 56 {
58 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::load))); 57 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::load)));
59 return *sender; 58 return *sender;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ResourceRequest resourceRequest(url); 301 ResourceRequest resourceRequest(url);
303 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin); 302 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin);
304 if (updateBehavior == UpdateForcedReload) { 303 if (updateBehavior == UpdateForcedReload) {
305 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache); 304 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache);
306 resourceRequest.setLoFiState(WebURLRequest::LoFiOff); 305 resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
307 // ImageLoader defers the load of images when in an ImageDocument. 306 // ImageLoader defers the load of images when in an ImageDocument.
308 // Don't defer this load on a forced reload. 307 // Don't defer this load on a forced reload.
309 m_loadingImageDocument = false; 308 m_loadingImageDocument = false;
310 } 309 }
311 310
312 if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && referrer Policy != ReferrerPolicyDefault) 311 if (referrerPolicy != ReferrerPolicyDefault)
313 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(ref errerPolicy, url, document.outgoingReferrer())); 312 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(ref errerPolicy, url, document.outgoingReferrer()));
314 313
315 if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGet Attribute(HTMLNames::srcsetAttr).isNull()) 314 if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGet Attribute(HTMLNames::srcsetAttr).isNull())
316 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage Set); 315 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage Set);
317 FetchRequest request(resourceRequest, element()->localName(), resourceLo aderOptions); 316 FetchRequest request(resourceRequest, element()->localName(), resourceLo aderOptions);
318 configureRequest(request, bypassBehavior, *m_element, document.clientHin tsPreferences()); 317 configureRequest(request, bypassBehavior, *m_element, document.clientHin tsPreferences());
319 318
320 // Prevent the immediate creation of a ResourceLoader (and therefore a n etwork 319 // Prevent the immediate creation of a ResourceLoader (and therefore a n etwork
321 // request) for ImageDocument loads. In this case, the image contents ha ve already 320 // request) for ImageDocument loads. In this case, the image contents ha ve already
322 // been requested as a main resource and ImageDocumentParser will take c are of 321 // been requested as a main resource and ImageDocumentParser will take c are of
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 627
629 void ImageLoader::elementDidMoveToNewDocument() 628 void ImageLoader::elementDidMoveToNewDocument()
630 { 629 {
631 if (m_loadDelayCounter) 630 if (m_loadDelayCounter)
632 m_loadDelayCounter->documentChanged(m_element->document()); 631 m_loadDelayCounter->documentChanged(m_element->document());
633 clearFailedLoadURL(); 632 clearFailedLoadURL();
634 setImage(0); 633 setImage(0);
635 } 634 }
636 635
637 } // namespace blink 636 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698