Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / FontPreloader.h
blob4d22f8378e70b3636d164703f5a0d38bea264264
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef FontPreloader_h_
8 #define FontPreloader_h_
10 #include "mozilla/FetchPreloader.h"
11 #include "nsContentSecurityManager.h"
12 #include "nsIContentPolicy.h"
13 #include "nsILoadInfo.h"
15 class gfxUserFontEntry;
16 struct gfxFontFaceSrc;
17 class nsIHttpChannel;
18 class nsIReferrerInfo;
20 namespace mozilla {
21 namespace dom {
22 class WorkerPrivate;
25 class FontPreloader final : public FetchPreloader {
26 public:
27 FontPreloader();
29 static void PrioritizeAsPreload(nsIChannel* aChannel);
31 static nsresult BuildChannel(
32 nsIChannel** aChannel, nsIURI* aURI, const CORSMode aCORSMode,
33 const dom::ReferrerPolicy& aReferrerPolicy,
34 gfxUserFontEntry* aUserFontEntry, const gfxFontFaceSrc* aFontFaceSrc,
35 dom::Document* aDocument, nsILoadGroup* aLoadGroup,
36 nsIInterfaceRequestor* aCallbacks, bool aIsPreload);
38 static nsresult BuildChannel(
39 nsIChannel** aChannel, nsIURI* aURI, const CORSMode aCORSMode,
40 const dom::ReferrerPolicy& aReferrerPolicy,
41 gfxUserFontEntry* aUserFontEntry, const gfxFontFaceSrc* aFontFaceSrc,
42 dom::WorkerPrivate* aWorkerPrivate, nsILoadGroup* aLoadGroup,
43 nsIInterfaceRequestor* aCallbacks, bool aIsPreload);
45 protected:
46 nsresult CreateChannel(nsIChannel** aChannel, nsIURI* aURI,
47 const CORSMode aCORSMode,
48 const dom::ReferrerPolicy& aReferrerPolicy,
49 dom::Document* aDocument, nsILoadGroup* aLoadGroup,
50 nsIInterfaceRequestor* aCallbacks,
51 uint64_t aEarlyHintPreloaderId) override;
53 static void BuildChannelFlags(
54 nsIURI* aURI, bool aIsPreload,
55 nsContentSecurityManager::CORSSecurityMapping& aCorsMapping,
56 nsSecurityFlags& aSecurityFlags, nsContentPolicyType& aContentPolicyType);
58 static nsresult BuildChannelSetup(nsIChannel* aChannel,
59 nsIHttpChannel* aHttpChannel,
60 nsIReferrerInfo* aReferrerInfo,
61 const gfxFontFaceSrc* aFontFaceSrc);
64 } // namespace mozilla
66 #endif