Bug 1839526 [wpt PR 40658] - Update wpt metadata, a=testonly
[gecko.git] / layout / style / FontPreloader.h
blob0661ba632a80ea7d24fabeb7e63ad2ca80d597c6
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 // PreloaderBase
30 static void PrioritizeAsPreload(nsIChannel* aChannel);
31 void PrioritizeAsPreload() override;
33 static nsresult BuildChannel(
34 nsIChannel** aChannel, nsIURI* aURI, const CORSMode aCORSMode,
35 const dom::ReferrerPolicy& aReferrerPolicy,
36 gfxUserFontEntry* aUserFontEntry, const gfxFontFaceSrc* aFontFaceSrc,
37 dom::Document* aDocument, nsILoadGroup* aLoadGroup,
38 nsIInterfaceRequestor* aCallbacks, bool aIsPreload);
40 static nsresult BuildChannel(
41 nsIChannel** aChannel, nsIURI* aURI, const CORSMode aCORSMode,
42 const dom::ReferrerPolicy& aReferrerPolicy,
43 gfxUserFontEntry* aUserFontEntry, const gfxFontFaceSrc* aFontFaceSrc,
44 dom::WorkerPrivate* aWorkerPrivate, nsILoadGroup* aLoadGroup,
45 nsIInterfaceRequestor* aCallbacks, bool aIsPreload);
47 protected:
48 nsresult CreateChannel(nsIChannel** aChannel, nsIURI* aURI,
49 const CORSMode aCORSMode,
50 const dom::ReferrerPolicy& aReferrerPolicy,
51 dom::Document* aDocument, nsILoadGroup* aLoadGroup,
52 nsIInterfaceRequestor* aCallbacks,
53 uint64_t aEarlyHintPreloaderId) override;
55 static void BuildChannelFlags(
56 nsIURI* aURI, bool aIsPreload,
57 nsContentSecurityManager::CORSSecurityMapping& aCorsMapping,
58 nsSecurityFlags& aSecurityFlags, nsContentPolicyType& aContentPolicyType);
60 static nsresult BuildChannelSetup(nsIChannel* aChannel,
61 nsIHttpChannel* aHttpChannel,
62 nsIReferrerInfo* aReferrerInfo,
63 const gfxFontFaceSrc* aFontFaceSrc);
66 } // namespace mozilla
68 #endif