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
;
18 class nsIReferrerInfo
;
25 class FontPreloader final
: public FetchPreloader
{
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
);
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