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

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

Issue 2533983003: Move hacks for Inspector in restoreCachedResourceIfNeeded() to ResourceFetcher (Closed)
Patch Set: Rebase Created 4 years 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 | « no previous file | third_party/WebKit/Source/core/css/CSSImageValue.cpp » ('j') | 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) 2007, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #include "core/css/CSSFontFaceSrcValue.h" 26 #include "core/css/CSSFontFaceSrcValue.h"
27 27
28 #include "core/css/CSSMarkup.h" 28 #include "core/css/CSSMarkup.h"
29 #include "core/css/StyleSheetContents.h" 29 #include "core/css/StyleSheetContents.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/Node.h" 31 #include "core/dom/Node.h"
32 #include "core/fetch/FetchInitiatorTypeNames.h" 32 #include "core/fetch/FetchInitiatorTypeNames.h"
33 #include "core/fetch/FetchRequest.h" 33 #include "core/fetch/FetchRequest.h"
34 #include "core/fetch/ResourceFetcher.h" 34 #include "core/fetch/ResourceFetcher.h"
35 #include "core/loader/MixedContentChecker.h"
36 #include "core/loader/resource/FontResource.h" 35 #include "core/loader/resource/FontResource.h"
37 #include "platform/CrossOriginAttributeValue.h" 36 #include "platform/CrossOriginAttributeValue.h"
38 #include "platform/fonts/FontCache.h" 37 #include "platform/fonts/FontCache.h"
39 #include "platform/fonts/FontCustomPlatformData.h" 38 #include "platform/fonts/FontCustomPlatformData.h"
40 #include "platform/weborigin/SecurityPolicy.h" 39 #include "platform/weborigin/SecurityPolicy.h"
41 #include "wtf/text/StringBuilder.h" 40 #include "wtf/text/StringBuilder.h"
42 41
43 namespace blink { 42 namespace blink {
44 43
45 bool CSSFontFaceSrcValue::isSupportedFormat() const { 44 bool CSSFontFaceSrcValue::isSupportedFormat() const {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 107 }
109 return m_fetched->resource(); 108 return m_fetched->resource();
110 } 109 }
111 110
112 void CSSFontFaceSrcValue::restoreCachedResourceIfNeeded( 111 void CSSFontFaceSrcValue::restoreCachedResourceIfNeeded(
113 Document* document) const { 112 Document* document) const {
114 ASSERT(m_fetched); 113 ASSERT(m_fetched);
115 ASSERT(document && document->fetcher()); 114 ASSERT(document && document->fetcher());
116 115
117 const String resourceURL = document->completeURL(m_absoluteResource); 116 const String resourceURL = document->completeURL(m_absoluteResource);
118 if (document->fetcher()->cachedResource(KURL(ParsedURLString, resourceURL))) 117 document->fetcher()->emulateLoadStartedForInspector(
119 return; 118 m_fetched->resource(), KURL(ParsedURLString, resourceURL),
120 119 WebURLRequest::RequestContextFont, FetchInitiatorTypeNames::css);
121 FetchRequest request(ResourceRequest(resourceURL),
122 FetchInitiatorTypeNames::css);
123 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy);
yhirano 2016/12/01 10:44:23 This statement is missing in the new code.
hiroshige 2016/12/02 06:17:10 I expected m_shouldCheckContentSecurityPolicy == m
124 request.mutableResourceRequest().setRequestContext(
125 WebURLRequest::RequestContextFont);
126 MixedContentChecker::shouldBlockFetch(
127 document->frame(), m_fetched->resource()->lastResourceRequest(),
128 m_fetched->resource()->lastResourceRequest().url(),
129 MixedContentChecker::SendReport);
130 document->fetcher()->requestLoadStarted(
131 m_fetched->resource()->identifier(), m_fetched->resource(), request,
132 ResourceFetcher::ResourceLoadingFromCache);
133 } 120 }
134 121
135 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const { 122 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const {
136 return m_isLocal == other.m_isLocal && m_format == other.m_format && 123 return m_isLocal == other.m_isLocal && m_format == other.m_format &&
137 m_specifiedResource == other.m_specifiedResource && 124 m_specifiedResource == other.m_specifiedResource &&
138 m_absoluteResource == other.m_absoluteResource; 125 m_absoluteResource == other.m_absoluteResource;
139 } 126 }
140 127
141 } // namespace blink 128 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698