tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FontLoaderUtils.h (2647B)


      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/. */
      6 
      7 #ifndef GECKO_LAYOUT_STYLE_FONTLOADERUTILS_H_
      8 #define GECKO_LAYOUT_STYLE_FONTLOADERUTILS_H_
      9 
     10 #include "ErrorList.h"
     11 #include "nsContentSecurityManager.h"
     12 
     13 class gfxUserFontEntry;
     14 class nsIChannel;
     15 class nsIHttpChannel;
     16 class nsIInterfaceRequestor;
     17 class nsILoadGroup;
     18 class nsIURI;
     19 struct gfxFontFaceSrc;
     20 
     21 namespace mozilla {
     22 enum CORSMode : uint8_t;
     23 namespace dom {
     24 class Document;
     25 class WorkerPrivate;
     26 enum class ReferrerPolicy : uint8_t;
     27 }  // namespace dom
     28 
     29 class FontLoaderUtils {
     30 public:
     31  // @param aSuppportsPriorityValue See <nsISupportsPriority.idl>.
     32  static nsresult BuildChannel(nsIChannel** aChannel, nsIURI* aURI,
     33                               const CORSMode aCORSMode,
     34                               const dom::ReferrerPolicy& aReferrerPolicy,
     35                               gfxUserFontEntry* aUserFontEntry,
     36                               const gfxFontFaceSrc* aFontFaceSrc,
     37                               dom::Document* aDocument,
     38                               nsILoadGroup* aLoadGroup,
     39                               nsIInterfaceRequestor* aCallbacks,
     40                               bool aIsPreload, int32_t aSupportsPriorityValue);
     41 
     42  static nsresult BuildChannel(nsIChannel** aChannel, nsIURI* aURI,
     43                               const CORSMode aCORSMode,
     44                               const dom::ReferrerPolicy& aReferrerPolicy,
     45                               gfxUserFontEntry* aUserFontEntry,
     46                               const gfxFontFaceSrc* aFontFaceSrc,
     47                               dom::WorkerPrivate* aWorkerPrivate,
     48                               nsILoadGroup* aLoadGroup,
     49                               nsIInterfaceRequestor* aCallbacks);
     50 
     51 private:
     52  static void BuildChannelFlags(
     53      nsIURI* aURI, bool aIsPreload,
     54      nsContentSecurityManager::CORSSecurityMapping& aCorsMapping,
     55      nsSecurityFlags& aSecurityFlags, nsContentPolicyType& aContentPolicyType);
     56 
     57  static nsresult BuildChannelSetup(nsIChannel* aChannel,
     58                                    nsIHttpChannel* aHttpChannel,
     59                                    nsIReferrerInfo* aReferrerInfo,
     60                                    const gfxFontFaceSrc* aFontFaceSrc,
     61                                    int32_t aSupportsPriorityValue);
     62 };
     63 
     64 }  // namespace mozilla
     65 
     66 #endif  // GECKO_LAYOUT_STYLE_FONTLOADERUTILS_H_