gecko/layout/style/nsFontFaceLoader.h

67 lines
1.8 KiB
C
Raw Normal View History

2008-09-30 20:04:10 -07:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// vim:cindent:ts=2:et:sw=2:
2012-05-21 04:12:37 -07:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2008-09-30 20:04:10 -07:00
/* code for loading in @font-face defined font data */
#ifndef nsFontFaceLoader_h_
#define nsFontFaceLoader_h_
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsIStreamLoader.h"
#include "nsIChannel.h"
2008-09-30 20:04:10 -07:00
#include "gfxUserFontSet.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "nsCSSRules.h"
2008-09-30 20:04:10 -07:00
class nsPresContext;
class nsIPrincipal;
2008-09-30 20:04:10 -07:00
class nsFontFaceLoader : public nsIStreamLoaderObserver
2008-09-30 20:04:10 -07:00
{
public:
nsFontFaceLoader(gfxUserFontEntry* aFontToLoad, nsIURI* aFontURI,
mozilla::dom::FontFaceSet* aFontFaceSet,
nsIChannel* aChannel);
2008-09-30 20:04:10 -07:00
NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLOADEROBSERVER
2008-09-30 20:04:10 -07:00
// initiate the load
nsresult Init();
// cancel the load and remove its reference to mFontFaceSet
void Cancel();
2008-09-30 20:04:10 -07:00
void DropChannel() { mChannel = nullptr; }
void StartedLoading(nsIStreamLoader* aStreamLoader);
static void LoadTimerCallback(nsITimer* aTimer, void* aClosure);
static nsresult CheckLoadAllowed(nsIPrincipal* aSourcePrincipal,
nsIURI* aTargetURI,
nsISupports* aContext);
#ifdef PR_LOGGING
static PRLogModuleInfo* GetFontDownloaderLog();
#endif
protected:
virtual ~nsFontFaceLoader();
private:
nsRefPtr<gfxUserFontEntry> mUserFontEntry;
nsCOMPtr<nsIURI> mFontURI;
nsRefPtr<mozilla::dom::FontFaceSet> mFontFaceSet;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsITimer> mLoadTimer;
nsIStreamLoader* mStreamLoader;
2008-09-30 20:04:10 -07:00
};
#endif /* !defined(nsFontFaceLoader_h_) */