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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSImageValue.cpp

Issue 2740253002: Remove FetchRequest::mutableResourceRequest() where removing is trivial (Closed)
Patch Set: Fix Created 3 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 m_relativeURL(absoluteURL), 48 m_relativeURL(absoluteURL),
49 m_absoluteURL(absoluteURL) {} 49 m_absoluteURL(absoluteURL) {}
50 50
51 CSSImageValue::~CSSImageValue() {} 51 CSSImageValue::~CSSImageValue() {}
52 52
53 StyleImage* CSSImageValue::cacheImage(const Document& document, 53 StyleImage* CSSImageValue::cacheImage(const Document& document,
54 CrossOriginAttributeValue crossOrigin) { 54 CrossOriginAttributeValue crossOrigin) {
55 if (!m_cachedImage) { 55 if (!m_cachedImage) {
56 if (m_absoluteURL.isEmpty()) 56 if (m_absoluteURL.isEmpty())
57 reResolveURL(document); 57 reResolveURL(document);
58 FetchRequest request(ResourceRequest(m_absoluteURL), 58 ResourceRequest resourceRequest(m_absoluteURL);
59 m_initiatorName.isEmpty() 59 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(
60 ? FetchInitiatorTypeNames::css 60 m_referrer.referrerPolicy, resourceRequest.url(), m_referrer.referrer));
61 : m_initiatorName); 61 FetchRequest request(resourceRequest, m_initiatorName.isEmpty()
62 request.mutableResourceRequest().setHTTPReferrer( 62 ? FetchInitiatorTypeNames::css
63 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy, 63 : m_initiatorName);
64 request.url(), m_referrer.referrer));
65 64
66 if (crossOrigin != CrossOriginAttributeNotSet) 65 if (crossOrigin != CrossOriginAttributeNotSet)
67 request.setCrossOriginAccessControl(document.getSecurityOrigin(), 66 request.setCrossOriginAccessControl(document.getSecurityOrigin(),
68 crossOrigin); 67 crossOrigin);
69 if (document.settings() && document.settings()->getFetchImagePlaceholders()) 68 if (document.settings() && document.settings()->getFetchImagePlaceholders())
70 request.setAllowImagePlaceholder(); 69 request.setAllowImagePlaceholder();
71 70
72 if (ImageResourceContent* cachedImage = 71 if (ImageResourceContent* cachedImage =
73 ImageResourceContent::fetch(request, document.fetcher())) 72 ImageResourceContent::fetch(request, document.fetcher()))
74 m_cachedImage = 73 m_cachedImage =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void CSSImageValue::reResolveURL(const Document& document) const { 124 void CSSImageValue::reResolveURL(const Document& document) const {
126 KURL url = document.completeURL(m_relativeURL); 125 KURL url = document.completeURL(m_relativeURL);
127 AtomicString urlString(url.getString()); 126 AtomicString urlString(url.getString());
128 if (urlString == m_absoluteURL) 127 if (urlString == m_absoluteURL)
129 return; 128 return;
130 m_absoluteURL = urlString; 129 m_absoluteURL = urlString;
131 m_cachedImage.clear(); 130 m_cachedImage.clear();
132 } 131 }
133 132
134 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSImageSetValue.cpp ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698