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

Unified Diff: Source/core/css/CSSFontFaceSrcValue.h

Issue 230383003: Webfont CORS-enabled fetching with fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add invalidator, retry only CORS failure Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSFontFaceSrcValue.h
diff --git a/Source/core/css/CSSFontFaceSrcValue.h b/Source/core/css/CSSFontFaceSrcValue.h
index 9ebf1093d6654a2d625d3601a9209bd7cffa8246..2fca6c5c260e2a4367a697000ca1571c091ec6a4 100644
--- a/Source/core/css/CSSFontFaceSrcValue.h
+++ b/Source/core/css/CSSFontFaceSrcValue.h
@@ -27,6 +27,7 @@
#define CSSFontFaceSrcValue_h
#include "core/css/CSSValue.h"
+#include "core/fetch/FontResource.h"
#include "core/fetch/ResourcePtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/WTFString.h"
@@ -78,18 +79,39 @@ private:
: CSSValue(FontFaceSrcClass)
, m_resource(resource)
, m_isLocal(local)
+ , m_corsEnabled(IsCORSEnabled)
#if ENABLE(SVG_FONTS)
, m_svgFontFaceElement(0)
#endif
{
}
+ // FIXME: Remove later, http://crbug.com/286681
+ class FontResourceInvalidator : public FontResourceClient {
+ public:
+ FontResourceInvalidator(CSSFontFaceSrcValue&);
+ ~FontResourceInvalidator();
+
+ virtual void fontLoaded(FontResource*) OVERRIDE;
+ virtual void corsFailed(FontResource*) OVERRIDE;
+ private:
+ CSSFontFaceSrcValue& m_srcValue;
+ ResourcePtr<FontResource> m_resource;
+ };
+
+ friend class FontResourceInvalidator;
+
+ bool shouldSetCrossOriginAccessControl(const KURL& resource, SecurityOrigin*);
+
String m_resource;
String m_format;
bool m_isLocal;
ResourcePtr<FontResource> m_fetched;
+ OwnPtr<FontResourceInvalidator> m_invalidator;
+ CORSEnabled m_corsEnabled;
+
#if ENABLE(SVG_FONTS)
SVGFontFaceElement* m_svgFontFaceElement;
#endif

Powered by Google App Engine
This is Rietveld 408576698