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

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

Issue 1302403005: Make img referrerpolicy attribute runtime-enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add some parens Created 5 years, 4 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
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h" 40 #include "core/frame/UseCounter.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/layout/LayoutImage.h" 43 #include "core/layout/LayoutImage.h"
44 #include "core/layout/LayoutVideo.h" 44 #include "core/layout/LayoutVideo.h"
45 #include "core/layout/svg/LayoutSVGImage.h" 45 #include "core/layout/svg/LayoutSVGImage.h"
46 #include "core/svg/graphics/SVGImage.h" 46 #include "core/svg/graphics/SVGImage.h"
47 #include "platform/Logging.h" 47 #include "platform/Logging.h"
48 #include "platform/RuntimeEnabledFeatures.h"
48 #include "platform/weborigin/SecurityOrigin.h" 49 #include "platform/weborigin/SecurityOrigin.h"
49 #include "platform/weborigin/SecurityPolicy.h" 50 #include "platform/weborigin/SecurityPolicy.h"
50 #include "public/platform/WebURLRequest.h" 51 #include "public/platform/WebURLRequest.h"
51 52
52 namespace blink { 53 namespace blink {
53 54
54 static ImageEventSender& loadEventSender() 55 static ImageEventSender& loadEventSender()
55 { 56 {
56 DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::load)); 57 DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::load));
57 return sender; 58 return sender;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>. 312 // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>.
312 ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultRe sourceOptions(); 313 ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultRe sourceOptions();
313 ResourceRequest resourceRequest(url); 314 ResourceRequest resourceRequest(url);
314 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin); 315 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin);
315 if (updateBehavior == UpdateForcedReload) { 316 if (updateBehavior == UpdateForcedReload) {
316 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache); 317 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache);
317 // ImageLoader defers the load of images when in an ImageDocument. D on't defer this load on a forced reload. 318 // ImageLoader defers the load of images when in an ImageDocument. D on't defer this load on a forced reload.
318 m_loadingImageDocument = false; 319 m_loadingImageDocument = false;
319 } 320 }
320 321
321 if (referrerPolicy != ReferrerPolicyDefault) 322 if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && referrer Policy != ReferrerPolicyDefault)
322 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(ref errerPolicy, url, document.outgoingReferrer())); 323 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(ref errerPolicy, url, document.outgoingReferrer()));
323 324
324 if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGet Attribute(HTMLNames::srcsetAttr).isNull()) 325 if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGet Attribute(HTMLNames::srcsetAttr).isNull())
325 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage Set); 326 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage Set);
326 FetchRequest request(resourceRequest, element()->localName(), resourceLo aderOptions); 327 FetchRequest request(resourceRequest, element()->localName(), resourceLo aderOptions);
327 configureRequest(request, bypassBehavior, *m_element, document.clientHin tsPreferences()); 328 configureRequest(request, bypassBehavior, *m_element, document.clientHin tsPreferences());
328 329
329 // Prevent the immediate creation of a ResourceLoader (and therefore a n etwork 330 // Prevent the immediate creation of a ResourceLoader (and therefore a n etwork
330 // request) for ImageDocument loads. In this case, the image contents ha ve already 331 // request) for ImageDocument loads. In this case, the image contents ha ve already
331 // been requested as a main resource and ImageDocumentParser will take c are of 332 // been requested as a main resource and ImageDocumentParser will take c are of
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 674
674 void ImageLoader::sourceImageChanged() 675 void ImageLoader::sourceImageChanged()
675 { 676 {
676 for (auto& client : m_clients) { 677 for (auto& client : m_clients) {
677 ImageLoaderClient* handle = client; 678 ImageLoaderClient* handle = client;
678 handle->notifyImageSourceChanged(); 679 handle->notifyImageSourceChanged();
679 } 680 }
680 } 681 }
681 682
682 } // namespace blink 683 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698